本文整理汇总了Python中robot.Robot.turn_left方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.turn_left方法的具体用法?Python Robot.turn_left怎么用?Python Robot.turn_left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robot.Robot
的用法示例。
在下文中一共展示了Robot.turn_left方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Robot
# 需要导入模块: from robot import Robot [as 别名]
# 或者: from robot.Robot import turn_left [as 别名]
from robot import Robot
import time
__author__ = 'stefan'
robot = Robot()
robot.drive(100, 100)
time.sleep(1)
robot.drive_backward(80)
time.sleep(1)
robot.turn_left(80)
time.sleep(1)
robot.turn_right(80)
time.sleep(1)
robot.stop()
示例2: Robot
# 需要导入模块: from robot import Robot [as 别名]
# 或者: from robot.Robot import turn_left [as 别名]
from robot import Robot
import time
__author__ = 'stefan'
robot = Robot()
try:
while True:
print("driving forward")
robot.drive_forward(80)
while not robot.sees_obstacle():
time.sleep(0.1)
print("obstacle - turning left")
robot.turn_left(100)
# if obstacle is close (2)
while robot.sees_obstacle() == 2:
# let it turn a while
time.sleep(0.25)
except KeyboardInterrupt:
robot.stop()
示例3:
# 需要导入模块: from robot import Robot [as 别名]
# 或者: from robot.Robot import turn_left [as 别名]
while not found:
location = markov.current_estimate()
destination = (1, 1)
# drive
robot.drive(0.10)
markov.move()
# rotate
direction = Orientation.calculate_direction((location[1], location[2]), destination)
while direction != markov._orientation:
rotate_direction = Orientation.rotate(markov._orientation, direction)
if rotate_direction == Orientation.LEFT:
markov.rotate_left()
robot.turn_left()
time.sleep(3)
elif rotate_direction == Orientation.RIGHT:
markov.rotate_right()
robot.turn_right()
time.sleep(3)
else:
pass
# calculate
time.sleep(2)
measurement = robot.sense_color()
markov.update(measurement)
if measurement == Colors.YELLOW:
if robot.sense_color() == Colors.YELLOW: