update: trying to solve bug with limit attribute

This commit is contained in:
Björn Ellensohn 2023-04-18 14:05:06 +02:00
parent 1e7748e0af
commit d149aedf4f

View File

@ -14,7 +14,6 @@ class TeleopTwistJoy(Node):
self.timer = self.create_timer(0.01, self.timer_callback) self.timer = self.create_timer(0.01, self.timer_callback)
self.twist = Twist() self.twist = Twist()
self.enable = False self.enable = False
self.limit = 0.5
def joy_callback(self, joy_msg): def joy_callback(self, joy_msg):
# if joy_msg.buttons[4]: #lb # if joy_msg.buttons[4]: #lb
@ -25,8 +24,8 @@ class TeleopTwistJoy(Node):
# self.limit += 0.5 # self.limit += 0.5
# if self.limit > 3: # if self.limit > 3:
# self.limit = 3 # self.limit = 3
self.twist.linear.x = self.limit * joy_msg.axes[1] self.twist.linear.x = 0.5 * joy_msg.axes[1]
self.twist.angular.z = self.limit * joy_msg.axes[0] self.twist.angular.z = 1 * joy_msg.axes[0]
if joy_msg.buttons[7]: #start if joy_msg.buttons[7]: #start
self.enable = True self.enable = True
enable_chassis(self) enable_chassis(self)