找回密码
 马上注册

QQ登录

只需一步,快速开始

查看: 4992|回复: 8

求高手一个编程的问题!

[复制链接]
发表于 2012-3-21 00:14:06 | 显示全部楼层 |阅读模式
悬赏1乐币未解决
请问一下,我在8547搭建的智能车上安装一个超声传感器,在编程上设计车距离障碍物一定距离车就转弯,现在前轮的转弯不知道如何编程。请高手指教一下,谢谢!

如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
发表于 2012-3-21 08:23:28 | 显示全部楼层
将前轮马达分别接在BC端口上:设置超声波传感器小于某一距离

1.jpg


如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2012-3-21 17:05:06 | 显示全部楼层
{:soso_e141:}假设有A,B电机,你可以设置A电机运行,B电机停止运行。这样就可以像某个方向转向
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

 楼主| 发表于 2012-3-21 22:26:48 来自手机 | 显示全部楼层
谢谢楼上两位的说明,但有个问题,四轮的车是不能利用BC电机来转弯的。另外控制前面两个轮转弯的是A电机啊。那如何在程序上控制A电机来使到车前轮转弯呢?
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2012-3-21 23:04:04 | 显示全部楼层
做成并行程序效果,参考这个:http://bbs.cmnxt.com/thread-7405-1-1.html
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

 楼主| 发表于 2012-3-22 00:30:21 | 显示全部楼层
我做的是这台车啊!并行程序好像行不通啊?http://www.nxtprograms.com/NXT2/race_car/index.html
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2012-3-22 08:37:29 | 显示全部楼层
  并行程序是必须的,你仔细看看http://www.nxtprograms.com/NXT2/race_car/steps.html#Program提供的例子程序。其中有个colorrace就是并行处理的
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2012-3-22 08:44:03 | 显示全部楼层
本帖最后由 ntwuhui 于 2012-3-22 08:45 编辑

Race                 Car 程序: RaceCar.zip (1.06 MB, 下载次数: 10)
原始说明:
Single NXT Programs:
  • The ColorRace                         program demonstrates some example autonomous behavior using the                         color sensor to react to changes in the color of the surface.                          You can create a short "course" for the car to drive and mark                         actions with different colored tape or strips of paper.  The                         color sensor can sense six different colors, and in this example                         program, the actions for the six color numbers are:

    • Black: Ignored
    • Blue: Turn left (start                                 turning at first blue line, stop turning at second blue line)
    • Green: Speed up to                                 full power
    • Yellow: Slow down to                                 30% power
    • Red: Stop
    • White: Ignored

    The car should be started                         with the front wheels pointed straight ahead (adjust them before                         starting the program by turning the knob wheel on the steering                         motor), and it will start out driving straight slowly.
    Note that autonomous                         operation is tricky, because there is limited control, and the                         steering has a lot of mechanical "slop" in it, which makes getting a                         straight start and consistent turns challenging.  
    You may also need to                         change the colors used in the program to adjust for the color of                         your floor and markers used.  To test which color the car sees                         over various surfaces, use the View -> Color feature in the                         NXT brick menu and roll the car over various surfaces.
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2012-3-23 18:43:18 | 显示全部楼层
学习了。。。
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|中文乐高 ( 桂ICP备13001575号-7 )

GMT+8, 2024-6-3 02:17 , Processed in 0.093688 second(s), 24 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表