With the spot_micro_joy node it is possible to control the robot by a joystick. The default configuration is set up for an PS4 controller which kan be connected by bluetooth directly. If you want to use another controler you need at least 4 axes and 4 buttons.
To test if you joystick is working you can use the jstest command line this:
ubuntu@spotmicro:~$ jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Wireless Controller) has 8 axes (X, Y, Rx, Ry, Z, Rz, Hat0X, Hat0Y)
and 13 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?, ?, ?).
Testing ... (interrupt to exit)
Axes: 0: 0 1: 0 2: 0 3: 0 4:-32767 5:-32767 6: 0 7: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off 8:off 9:off 10:off 11:off 12:off ^C
To check if your controller is woking with ROS, mapped and calibrated correctly you might try to start the joy ROS Node by hand. If you need to calibrate your joystick, i recommend jstest-gtk. To persist you configuration run jscal-store.
ubuntu@spotmicro:~$ rosrun joy joy_node
[ INFO] [1615052346.145750548]: Opened joystick: /dev/input/js0. deadzone_: 0.050000.
In another teminal take a look into the messages your joy_node emits
ubuntu@spotmicro:~$ rostopic echo joy
header:
seq: 1
stamp:
secs: 1615052430
nsecs: 954517162
frame_id: ''
axes: [0.0, -0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
buttons: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---
All axes should send values between -1 and 1. Buttons are 1 or 0.
Now you can check (and modify if needed) the mappings in spotMicroJoystickMove.py
Once done, bring your robot in a save position and start roslaunch spot_micro_joy everything.launch
which will
start everything needed to operate the robot by joystick.
It is a good idea to start with a low value for transit_angle_rl. Once everything is working fine you might increase it to get a more agile and responsive doggy :)