乐高机器人java程序代码_用JAVA编写一个乐高机器人躲避障碍物运动到目标点的程序....

写出一个可以控制机器人的小程序,使机器人从一边到一个相对面,并至少跨越一个障碍物.规则如下:1,障碍物必须设置在机器人行走的路线上.2,空间的基本配置如插图3,不能用轨道之类的东西...

写出一个可以控制机器人的小程序,使机器人从一边到一个相对面,并至少跨越一个障碍物.

规则如下:

1,障碍物必须设置在机器人行走的路线上.

2,空间的基本配置如插图

3, 不能用轨道之类的东西引导机器人.

4,机器人可以触碰到障碍物.

程序需要包含下列的指令:

stop(); 停止 或等待下一个指令

This stops both motors, but then moves onto the next instruction if you want it stop and wait use halt().

forward(time1); 前进 (1/1000秒)

This moves the robot forward for time1 milliseconds

spinRight(time1); 向右旋转 (1/1000秒)

This moves the robot in a tight circle to the right using both motors time1 milliseconds (1/1000th of second)

turnRight(time1); 向右转 (1/1000秒)

This moves the robot in a looser circle than spinRight() to the right using both motors time1 milliseconds (1/1000th of second)

spinLeft(time1); 向左旋转(1/1000秒)

This moves t

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值