To run the RadioMaster TX16S, you must meet certain requirements listed below:
- Docker Engine and Docker Compose.
- Device with Linux based OS (e.g. robot, laptop).
- Hardware receiver dongle (ELRS receiver with an integrated USB to UART converter) connected to a USB port of the User Computer.
husarion_ugv_crsf_teleop package creates a ROS 2 node, allowing control of the ROS-powered mobile and manipulation robots with a CRSF compatible RC remote such as RadioMaster TX16S. crsf_teleop
node converts received CRSF packets from the receiver dongle to geometry_msgs/Twist
message type in order to provide velocity commands for the robot.
The result of this demo will be the publication of a velocity messages on the ROS topic /cmd_vel
. An example with a mobile robot will be described below.
[!WARNING] Husarion OS If you are using Husarion OS, you can skip this step as the udev rules are already set up.
To be able to distinguish between connected devices it is necessary to add a rule that aliases detected hardware dongle to a known symlink file.
Open (or create) the udev rules file:
sudo nano /etc/udev/rules.d/99-local.rules
Append the following line to the file:
ACTION=="add", ,ATTRS{interface}=="PAD02 Dongle", SYMLINK+="ttyUSBPAD"
Press ctrl + o and then ctrl + x to save and quit.
Reload rules by executing:
sudo udevadm control --reload-rules
sudo udevadm trigger
Connect receiver dongle to the USB port of the User Computer. You can verify that the device is detected by typing:
ls /dev | grep "ttyUSBPAD"
You should see a file named ttyUSBPAD
in the output.
git clone https://github.com/husarion/husarion_ugv_crsf_teleop.git
cd husarion_ugv_crsf_teleop
By default the node is set up to work with Panther robot. To load Lynx configuration, you need to change the params_file
parameter in the docker-compose.yml
file.
command: >
ros2 launch husarion_ugv_crsf_teleop teleop.launch.py params_file:=/config/crsf_teleop_lynx.yaml
Default parameter files for Panther and Lynx can be found in the husarion_ugv_crsf_teleop/config
directory and can be changed directly.
Custom parameters file can be provided by setting the params_file
launch argument.
docker compose up -d
You can view the logs of the running container by typing:
docker compose logs -f
After a successful connection to the RC remote, you should see the following message:
[panther.crsf_teleop]: Connected
[panther.crsf_teleop]: Link quality restored: 100%
Exec into running container:
docker compose exec -it husarion_ugv_crsf_teleop /bin/bash
Now you should see the relevant ROS 2 topic:
user@docker:~$ ros2 topic list
/panther/cmd_vel
/panther/link_status
/parameter_events
/rosout
Tilting sticks on the RC controller should result in /cmd_vel
topic being updated with velocity commands. Namespace fields should be updated with used robot model name (e.g. panther
).
ros2 topic echo /<namespace>/cmd_vel
Additionally, you can check the link status by echoing the /link_status
topic:
ros2 topic echo /<namespace>/link_status
Sticks are mapped to the following axes:
- Left stick horizontal: angular velocity
- Right stick vertical: linear velocity
RC controller has some additional buttons that can be used for different functionalities:
- SG switch - tri-state switch, selects robot speed from values specified in the parameters yaml file (slow, normal, fast)
- SF switch - emergency stop
- SA switch (down position) - silence
cmd_vel
messages, allows other nodes to control the robot while enabling e_stop functionality
[!WARNING] SF switch By default the SA switch has no functionality assigned. You can enable silence mode by adding the following line to the custom
params.yaml
file:silence_cmd_vel: true