Dockerized ROS node allowing control of ROS-powered mobile robots with Logitech F710 gamepad. Joy2Twist node is converting sensor_msgs/Joy
message to geometry_msgs/Twist
in order to provide velocity commands for the mobile robot. Therefore this package is compliant (but not supported by Husarion) with any other gamepad controller which is able to publish the sensor_msgs/Joy
message.
Connect joy via nano USB receiver and make sure it is in DirectInput Mode (switch in front o the pad with letters D and X, select D).
To test if joy works, use jstest /dev/input/js0
.
If the output is:
jstest: No such file or directory
See ls /dev/input | grep js
and find your joy number. If it differs, apply changes in compose.yaml and launch file.
ROS2 distro | Supported architectures |
---|---|
galactic |
linux/amd64 , linux/arm64
|
humble |
linux/amd64 , linux/arm64
|
Available on Docker Hub
Flash the right firmware:
docker stop rosbot-xl microros || true &&
docker run --rm -it --privileged
--mount type=bind,source=/dev/ttyUSBDB,target=/dev/ttyUSBDB
husarion/rosbot-xl:humble-0.8.2-20230913
flash-firmware.py -p /dev/ttyUSBDB
Connect Logitech F710 dongle to the ROSbot XL and run (on ROSbot):
cd joy2twist/demo/single_robot
docker compose -f compose.rosbotxl.yaml up
Flash the right firmware:
docker stop rosbot microros || true && docker run
--rm -it --privileged
husarion/rosbot:humble-0.6.1-20230712
flash-firmware.py /root/firmware.bin
Connect Logitech F710 dongle to the ROSbot 2R and run (on ROSbot):
cd joy2twist/demo/single_robot
docker compose -f compose.rosbot2r.yaml up
Connect a Logitech F710 USB dongle to your PC. Clone this repo to your PC and go to the joy2twist/demo/
directory and run in a separate terminal:
./sync_with_robot.sh <YOUR_ROSBOT_IP>
Change the namespace in the multiple_robots/.env
file:
ROS_NAMESPACE=robot1
Now SSH to your robot:
ssh husarion@<YOUR_ROSBOT_IP>
Go to the folder /home/husarion/demo/multiple_robots
, and launch the container for ROSbot:
docker compose -f compose.rosbot2r.yaml up
Topic filtering
If you will then check on the PC the available ROS 2 nodes you will get:
$ ros2 topic list /parameter_events /robot1/cmd_vel /rosoutNote that nly the single
/robot1/cmd_vel
topic is available outside the robot thanks to the configuration from theros2router_config.yaml
file.To control the robot by using the teleop, just run:
ros2 run teleop_twist_keyboard teleop_twist_keyboard __ns:=/robot1
To run the joy2twist
container execute the following command on your PC in the joy2twist/demo/multiple_robots
directory:
docker compose -f compose.pc.yaml up