Skip to content

Commit c2aa2ac

Browse files
Re #51 remapped Logitech Joy to be similar to Xbox
The Logitech linux driver must have changed in Ubuntu 14.04 as it is treated the same as an Xbox controller now. Updated the controller mappings to make them nearly identical now.
1 parent 7907ff4 commit c2aa2ac

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/baxter_external_devices/joystick.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,30 +233,28 @@ def _on_joy(self, msg):
233233
Args:
234234
msg(Joy): a joystick input message
235235
"""
236-
237-
self._controls['btnLeft'] = (msg.buttons[0] == 1)
236+
self._controls['btnLeft'] = (msg.buttons[2] == 1)
238237
self._controls['btnUp'] = (msg.buttons[3] == 1)
239-
self._controls['btnDown'] = (msg.buttons[1] == 1)
240-
self._controls['btnRight'] = (msg.buttons[2] == 1)
238+
self._controls['btnDown'] = (msg.buttons[0] == 1)
239+
self._controls['btnRight'] = (msg.buttons[1] == 1)
241240

242-
self._controls['dPadUp'] = (msg.axes[5] > 0.5)
243-
self._controls['dPadDown'] = (msg.axes[5] < -0.5)
244-
self._controls['dPadLeft'] = (msg.axes[4] > 0.5)
245-
self._controls['dPadRight'] = (msg.axes[4] < -0.5)
241+
self._controls['dPadUp'] = (msg.axes[7] > 0.5)
242+
self._controls['dPadDown'] = (msg.axes[7] < -0.5)
243+
self._controls['dPadLeft'] = (msg.axes[6] > 0.5)
244+
self._controls['dPadRight'] = (msg.axes[6] < -0.5)
246245

247246
self._controls['leftStickHorz'] = msg.axes[0]
248247
self._controls['leftStickVert'] = msg.axes[1]
249-
self._controls['rightStickHorz'] = msg.axes[2]
250-
self._controls['rightStickVert'] = msg.axes[3]
248+
self._controls['rightStickHorz'] = msg.axes[3]
249+
self._controls['rightStickVert'] = msg.axes[4]
251250

252251
self._controls['leftBumper'] = (msg.buttons[4] == 1)
253252
self._controls['rightBumper'] = (msg.buttons[5] == 1)
254-
self._controls['leftTrigger'] = (msg.buttons[6] == 1)
255-
self._controls['rightTrigger'] = (msg.buttons[7] == 1)
256-
257-
self._controls['function1'] = (msg.buttons[8] == 1)
258-
self._controls['function2'] = (msg.buttons[9] == 1)
253+
self._controls['leftTrigger'] = (msg.axes[2] < 0.0)
254+
self._controls['rightTrigger'] = (msg.axes[5] < 0.0)
259255

256+
self._controls['function1'] = (msg.buttons[6] == 1)
257+
self._controls['function2'] = (msg.buttons[7] == 1)
260258

261259
class PS3Controller(Joystick):
262260
"""

0 commit comments

Comments
 (0)