radioROS is a simple Python-based ROS2 package that allows robots to utilize an RC receiver in their projects. This package should theoretically work for any receiver since there is an ESP32 that carefully reads the PWM data and publishes it via serial. Other packages use SBUS, which is not standardized, and most receivers don't have this feature, and those that do are expensive.
-
First, get an ESP32 and upload the
esp32_code.ino
that's within thefirmware
directory. -
Connect the ESP32 to the receiver as follows:
It's very simple with only 8 connections in total. Be sure to pair the receiver beforehand.
-
Clone this repo into your ROS2 workspace:
cd ros2_ws/src git clone https://github.com/TheHassanShahzad/radioROS.git cd .. colcon build --packages-select radioROS source install/setup.bash
The package contains two nodes:
-
pwm_publisher
- Responsible for reading the incoming serial data from the ESP32 and publishing the data to the
/receiver_data
topic of typeInt16MultiArray
. - Takes
serial_port
as a parameter (default is/dev/ttyUSB0
).
- Responsible for reading the incoming serial data from the ESP32 and publishing the data to the
-
pwm_to_twist
- Subscribes to the
/receiver_data
topic and publishesTwist
messages to the/cmd_vel
topic. - Takes the following parameters:
max_linear_speed
(default is 1.0)max_angular_speed
(default is 1.0)topic
(default iscmd_vel
)
- Subscribes to the
pwm_to_twist
can only work ifpwm_publisher
is running.pwm_publisher
only works if the transmitter is powered on, so the ESP32 is publishing PWM data.
The ESP32 code required to make this ROS2 package work can be found in the firmware
directory. Follow these steps to upload the code to your ESP32:
- Open the
esp32_code.ino
file located in thefirmware
directory using the Arduino IDE or any other compatible IDE. - Connect your ESP32 to your computer.
- Select the correct board and port in the IDE.
- Upload the code to the ESP32.