mirror of
https://github.com/bjoernellens1/rmp220_teleop.git
synced 2024-11-22 07:53:47 +00:00
update
This commit is contained in:
parent
192c685b29
commit
ef964834fa
@ -14,17 +14,15 @@ 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
|
||||||
self.twist.linear.x = 0.5 * joy_msg.axes[1]
|
self.limit -= 0.5
|
||||||
self.twist.angular.z = 0.5 * joy_msg.axes[0]
|
|
||||||
elif joy_msg.buttons[5]: #rb
|
elif joy_msg.buttons[5]: #rb
|
||||||
self.twist.linear.x = 3 * joy_msg.axes[1]
|
self.limit += 0.5
|
||||||
self.twist.angular.z = 1.5 * joy_msg.axes[0]
|
self.twist.linear.x = self.limit * joy_msg.axes[1]
|
||||||
else:
|
self.twist.angular.z = self.limit * joy_msg.axes[0]
|
||||||
self.twist.linear.x = 1 * joy_msg.axes[1]
|
|
||||||
self.twist.angular.z = 1.0 * 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user