当前位置: 首页>>代码示例>>Python>>正文


Python Robot.turn_left方法代码示例

本文整理汇总了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()
开发者ID:wendlers,项目名称:edubot-nodemcu-fw,代码行数:22,代码来源:remote_simple.py

示例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()
开发者ID:wendlers,项目名称:edubot-nodemcu-fw,代码行数:30,代码来源:obstacle_avoider.py

示例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:
开发者ID:rddesmit,项目名称:expeditie3_weekopdracht1,代码行数:33,代码来源:weekopdracht_1.py


注:本文中的robot.Robot.turn_left方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。