X-Git-Url: https://defiant.homedns.org/gitweb/?p=ros_wild_thumper.git;a=blobdiff_plain;f=scripts%2Fmove_base.py;fp=scripts%2Fmove_base.py;h=fbd265fb9c6001c75879da1d0cb406ab7d110f9a;hp=bac2742386fd45c2c6b3e2c69bef366507835fac;hb=ece97d94709b5e779ec2a48cf47319163a122bc5;hpb=eef02300bd4b99a11e6a1756f7b8d4e25c6c0908 diff --git a/scripts/move_base.py b/scripts/move_base.py index bac2742..fbd265f 100755 --- a/scripts/move_base.py +++ b/scripts/move_base.py @@ -3,7 +3,7 @@ import rospy import struct -from i2c import i2c +from i2c import * from math import * from geometry_msgs.msg import Twist @@ -15,6 +15,7 @@ class MoveBase: rospy.Subscriber("cmd_vel", Twist, self.cmdVelReceived) self.set_speed(0, 0) rospy.loginfo("Init done") + i2c_write_reg(0x50, 0x90, struct.pack("BB", 1, 1)) # switch direction self.run() def run(self): @@ -37,8 +38,8 @@ class MoveBase: if right > 255: right=255 elif right < -255: right=-255 - dev = i2c(0x56) - s = struct.pack(">Bhh", 0x1, left, right) + dev = i2c(0x50) + s = struct.pack(">Bhhhh", 0x1, right, right, left, left) dev.write(s) dev.close()