def __init__(self, filename=None, replay=False, assertWrite=True, ipPair=None): if ipPair is not None: setIPs(*ipPair) self.node = NodeROS(subscribe=[ '/imu/data', '/imu/mag', '/imu/rpy', '/imu/temperature', '/husky/data/encoders', '/husky/data/power_status', '/husky/data/safety_status', '/joy', '/husky/data/system_status' ], publish=['/husky/cmd_vel'], heartbeat='/husky/data/encoders', filename=filename, replay=replay, assertWrite=assertWrite) self.speed = 0.0 self.angularSpeed = 0.0 self.enc = None # unknown self.time = None self.power = None self.imu = None self.mag = None self.azimuth = None self.emergencyStopPressed = None self.greenPressed = None self.redPressed = None self.joyAxis = (0, 0, 0, 0, 0, 0) self.update()
def __init__( self, filename=None, replay=False, assertWrite=True, ipPair=None ): if ipPair is not None: setIPs( *ipPair ) self.node = NodeROS( subscribe=['/imu/data', '/imu/mag', '/imu/rpy', '/imu/temperature', '/husky/data/encoders', '/husky/data/power_status', '/husky/data/safety_status', '/joy', '/husky/data/system_status'], publish=['/husky/cmd_vel'], heartbeat='/husky/data/encoders', filename=filename, replay=replay, assertWrite=assertWrite ) self.speed = 0.0 self.angularSpeed = 0.0 self.enc = None # unknown self.time = None self.power = None self.imu = None self.mag = None self.azimuth = None self.emergencyStopPressed = None self.greenPressed = None self.redPressed = None self.joyAxis = (0,0, 0,0, 0,0) self.update()
robot.turnToAzimuth(math.radians(180.0)) robot.goStraight(1.0) def test6(robot): for azi, dist in [(-1.13311392218, 11.091), (0.175614628559, 3.584), (1.62315635666, 11.842), (-2.77704236902, 4.407), (-1.14243399246, 1.0)]: # unknown robot.turnToAzimuth(azi) robot.goStraight(dist, maxSpeed=0.3) if __name__ == "__main__": if len(sys.argv) < 2 or (len(sys.argv) == 2 and "meta" not in sys.argv[1]): print __doc__ sys.exit(1) filename = None assertWrite = True if "meta" in sys.argv[1]: filename = sys.argv[1] if len(sys.argv) > 2 and sys.argv[2] == 'F': assertWrite = False else: setIPs(sys.argv[1], 'http://' + sys.argv[2] + ':11311') robot = HuskyROS(filename=filename, assertWrite=assertWrite) test6(robot) #------------------------------------------------------------------- # vim: expandtab sw=4 ts=4
def test6( robot ): for azi,dist in [ (-1.13311392218, 11.091), (0.175614628559, 3.584), (1.62315635666, 11.842), (-2.77704236902, 4.407), (-1.14243399246, 1.0)]: # unknown robot.turnToAzimuth( azi ) robot.goStraight( dist, maxSpeed=0.3 ) if __name__ == "__main__": if len(sys.argv) < 2 or (len(sys.argv)==2 and "meta" not in sys.argv[1]): print __doc__ sys.exit(1) filename = None assertWrite = True if "meta" in sys.argv[1]: filename = sys.argv[1] if len(sys.argv) > 2 and sys.argv[2] == 'F': assertWrite = False else: setIPs( sys.argv[1], 'http://'+sys.argv[2]+':11311' ) robot = HuskyROS( filename=filename, assertWrite=assertWrite ) test6( robot ) #------------------------------------------------------------------- # vim: expandtab sw=4 ts=4