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.
Button | Function |
---|---|
LB |
enable driving |
RB |
slow driving mode |
RT |
fast driving mode |
If neither RB
nor RT
is pressed, the robot operates in regular driving mode.
To drive robot use sticks.
By default, linear X
and Y
are held by the left stick. Angular Z
is controlled with the right stick.
ROS node is translating /joy
topic to /cmd_vel
topic.
/cmd_vel
(geometry_msgs/Twist)
/joy
(sensor_msgs/Joy)
Following parameters change joystick axes mapped to given robot axes of freedom. For more information about parameter values, refer to the joy package wiki page.
~axis_linear_x
(int, default: 3)~axis_linear_y
(int, default: 2)~axis_angular_z
(int, default: 0)
The robot can be operated at 3 scales of speed depending on pressed buttons. It's possible to adjust velocity scaling factors using a config file. The Units are m/s for linear movement and rad/s for angular movement.
fast
(float, default: 1)regular
(float, default: 0.5)slow
(float, default: 0.2)
ROS2 distro | Supported architectures |
---|---|
galactic |
linux/amd64 , linux/arm64 |
humble |
linux/amd64 , linux/arm64 |
Available on Docker Hub
-
Clone this repo on your ROSbot:
git clone https://github.com/husarion/joy2twist.git cd joy2twist/
-
Create
demo/.env
based ondemo/.env.template
file and modify it if needed (see comments)#SBC <> STM32 serial connection. Set: #SERIAL_PORT=/dev/ttyS1 # ROSbot 2 #SERIAL_PORT=/dev/ttyS4 # ROSbot 2 PRO SERIAL_PORT=/dev/ttyAMA0 # ROSbot 2R
-
Launch on ROSbot
Go to the
joy2twist/demo
folder and run:cd joy2twist/demo docker compose -f compose.rosbot.yaml up