2 # -*- coding: iso-8859-15 -*-
8 from geometry_msgs.msg import Twist
14 rospy.init_node('wild_thumper_move_base')
15 rospy.Subscriber("cmd_vel", Twist, self.cmdVelReceived)
17 rospy.loginfo("Init done")
21 rate = rospy.Rate(10.0)
22 while not rospy.is_shutdown():
25 def set_speed(self, left, right):
26 if left > 255: left=255
27 elif left < -255: left=-255
28 if right > 255: right=255
29 elif right < -255: right=-255
32 s = struct.pack(">Bhh", 0x1, left, right)
36 def cmdVelReceived(self, msg):
38 rot = msg.angular.z # rad/s
40 right = rot*pi*WHEEL_DIST + trans
42 self.set_speed(left, right)
45 if __name__ == "__main__":