写出一个可以控制机器人的小程序,使机器人从一边到一个相对面,并至少跨越一个障碍物.规则如下: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