mirror of
https://github.com/bjoernellens1/rmp220_teleop.git
synced 2024-11-21 15:33:48 +00:00
update: enable/disable button
This commit is contained in:
parent
b6c3e18b0d
commit
33a99d98c3
@ -13,10 +13,17 @@ class TeleopTwistJoy(Node):
|
||||
self.joy_sub = self.create_subscription(Joy, 'joy', self.joy_callback, 10)
|
||||
self.timer = self.create_timer(0.01, self.timer_callback)
|
||||
self.twist = Twist()
|
||||
self.enable = False
|
||||
|
||||
def joy_callback(self, joy_msg):
|
||||
self.twist.linear.x = 1 * joy_msg.axes[1]
|
||||
self.twist.angular.z = 1.0 * joy_msg.axes[0]
|
||||
if joy_msg.buttons[8]:
|
||||
self.enable = True
|
||||
enable_chassis()
|
||||
if joy_msg.buttons[4]:
|
||||
self.enable = False
|
||||
disable_chassis()
|
||||
|
||||
def timer_callback(self):
|
||||
self.cmd_vel_pub.publish(self.twist)
|
||||
|
Loading…
Reference in New Issue
Block a user