本文整理汇总了Python中Robot.Robot.forward方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.forward方法的具体用法?Python Robot.forward怎么用?Python Robot.forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Robot.Robot
的用法示例。
在下文中一共展示了Robot.forward方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_walking_angular_turn
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
def test_walking_angular_turn(self):
r = Robot("Tamara", [0, 0], 0)
r.forward_multiplicator = 1
r.sideward_multiplicator = 1
r.angular_multiplicator = 1
r.forward = 0
r.sideward = 0
r.angular = 10
self.worldService.update_robot(r, 1)
self.assertAlmostEqual(10, r.orientation)
示例2: test_walking_simple_axis_left
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
def test_walking_simple_axis_left(self):
r = Robot("Tamara", [0, 0], 180)
r.forward_multiplicator = 1
r.sideward_multiplicator = 1
r.angular_multiplicator = 1
r.forward = 1
r.sideward = 0
r.angular = 0
self.worldService.update_robot(r, 1)
self.assertAlmostEqual(-1, r.xy[0])
self.assertAlmostEqual(0, r.xy[1])
示例3: Robot
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
import sys
from time import sleep
from Robot import Robot
from Mover import Mover
from Shooter import Shooter
from Light import Light
from Sonar import Sonar
from nxt.motor import PORT_A, PORT_B, PORT_C
from nxt.sensor import PORT_4, PORT_3, PORT_2, PORT_1
print "Robot3"
robot = Robot('ICTCLUB3')
robot.extend(Light(PORT_3))
robot.extend(Mover(PORT_B,PORT_C))
dark = 200
def isblack():
return robot.howbright() < dark
def iswhite():
return not ( isblack() and isblack() and isblack() )
while iswhite():
robot.forward(0.1,3)
robot.__del__()
示例4: Robot
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
import sys
from time import sleep
from Robot import Robot
from Mover import Mover
from Shooter import Shooter
from Light import Light
from Sonar import Sonar
from nxt.motor import PORT_A, PORT_B, PORT_C
from nxt.sensor import PORT_4, PORT_3, PORT_2, PORT_1
print "Robot4"
robot = Robot('ICTCLUB4')
robot.extend(Light(PORT_3))
robot.extend(Mover(PORT_B, PORT_C))
robot.extend(Sonar(PORT_1))
#Program starts here
for x in range(10,10000):
robot.forward(0.1,80)
if robot.howfar() < 40 :
robot.turnright(4,80)
robot.__del__()
示例5: Robot
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
import sys
from time import sleep
from Robot import Robot
from Mover import Mover
from Shooter import Shooter
from Light import Light
from Sonar import Sonar
from nxt.motor import PORT_A, PORT_B, PORT_C
from nxt.sensor import PORT_4, PORT_3, PORT_2, PORT_1
print "Robot2"
robot = Robot('ICTCLUB2')
robot.extend(Light(PORT_3))
robot.extend(Mover(PORT_B, PORT_C))
robot.forward(2,50)
robot.backward(2,50)
robot.forward(2,30)
robot.turnright(1.5,20)
robot.forward(2,30)
robot.turnright(1.5,20)
robot.forward(2,30)
robot.turnright(1.5,20)
robot.forward(2,30)
示例6: Robot
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import forward [as 别名]
import sys
from time import sleep
from Robot import Robot
from Mover import Mover
from Shooter import Shooter
from Light import Light
from Sonar import Sonar
from nxt.motor import PORT_A, PORT_B, PORT_C
from nxt.sensor import PORT_4, PORT_3, PORT_2, PORT_1
print "Robot4"
robot = Robot('ICTCLUB4')
robot.extend(Light(PORT_3))
robot.extend(Mover(PORT_B, PORT_C))
a=1
while a == 1:
robot.forward(1,50)
if robot.howfar() < 10:
robot.turnleft(1,50)
robot.__del__()