This ROS2 package provides an interface to control the DJI RoboMaster Base via ROS2. The robomaster_core node uses the robomaster_can_controller library to communicate with the RoboMaster motion controller over the CAN Bus interface.
- Communication with RoboMaster base over CAN bus.
- Publishes odometry, IMU data, battery state, and joint states from the sensor data of the RoboMaster's motion controller.
- Subscribes to command velocity, wheel speed, and LED color commands to control the RoboMaster base.
Clone the repository:
git clone git@gitlab.cc-asp.fraunhofer.de:iml/oe130/ROS2/robomaster/ros2/robomasterbase/robomaster_core.git
Install dependencies:
rosdep install --from-paths src --ignore-src -r -y
Build the package:
colcon build --symlink-install
Source the workspace:
source install/setup.bashRun the node:
ros2 run robomaster_core robomaster_node
Node Name:robomaster
| Parameter Name | Type | Default Value | Description |
|---|---|---|---|
can_interface | string | can0 | CAN interface to use for communication with the RoboMaster motion controller. |
prefix | string | rm | Prefix for frame ids. Useful when using multiple RoboMasters. |
base_frame | string | base_footprint | Name of the base frame. Used for the odom header.frame_id. |
odom_frame | string | odom | Name of the odometry frame. Used for the odom child_frame_id. |
tf_wheel | bool | false | Publish wheel transformations. Useful when no robot state publisher is used. |
tf_odom | bool | false | Publish odometry transformation. |
odom_imu | bool | false | Use IMU for orientation instead of odometry. |
pushup | bool | false | Activate to push up the command velocity for small values to get the RoboMaster moving. |
cmd_vel_dji | bool | false | Pass command velocity directly to RoboMaster's motion controller instead of calculating the command velocity to wheel speed from the node. (Parameter depending on the RoboMaster DJI App). |
velocity_linear_max | double | -1.0 | Limit for maximum linear velocity. Value <= 0.0 for no limitation. |
velocity_angular_max | double | -1.0 | Limit for maximum angular velocity. Value <= 0.0 for no limitation. |
acceleration_linear_max | double | -1.0 | Limit for maximum linear acceleration. Value <= 0.0 to deactivate acceleration limitation. |
acceleration_angular_max | double | -1.0 | Limit for maximum angular acceleration. Value <= 0.0 to deactivate acceleration limitation. |
enable_timeout | int | 5 | Timeout in seconds to disable the robot if no command is received. Zero or negative value disables the timeout. |
servo1_range | array | [] | Angle range for servo 1 [min_angle, max_angle] (RoboMaster EP servos). |
servo2_range | array | [] | Angle range for servo 2 [min_angle, max_angle] (RoboMaster EP servos). |
servo3_range | array | [] | Angle range for servo 3 [min_angle, max_angle] (RoboMaster EP servos). |
cov_imu_orientation | array | [0.0, 0.0, 0.0] | Covariance for IMU orientation (diagonal matrix order). |
cov_imu_angular_velocity | array | [0.0, 0.0, 0.0] | Covariance for IMU angular velocity (diagonal matrix order). |
cov_imu_linear_acceleration | array | [0.0, 0.0, 0.0] | Covariance for IMU linear acceleration (diagonal matrix order). |
cov_odom_pose | array | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | Covariance for odometry pose (diagonal matrix order). |
cov_odom_twist | array | [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] | Covariance for odometry twist (diagonal matrix order). |
| Topic Name | Type | Description |
|---|---|---|
/cmd_vel | geometry_msgs/msg/Twist | Subscribes to command velocity. |
/cmd_wheel_speed | sensor_msgs/msg/JointState | Subscribes to command wheel speed. Needs to set all joint names and velocities e.g., names ["fr", "fl", "rl", "rr"] and velocity [0.0, 0.0, 0.0, 0.0]. |
/led | std_msgs/msg/ColorRGBA | Subscribes to LED color command. |
/imu | sensor_msgs/msg/Imu | Publishes IMU data. |
/battery | sensor_msgs/msg/BatteryState | Publishes battery state. |
/odom | nav_msgs/msg/Odometry | Publishes odometry data. |
/joint_states | sensor_msgs/msg/JointState | Publishes joint states of the RoboMaster. |
/servo1 | std_msgs/msg/Float64 | Subscribes to control the angle for servo 1. |
/servo2 | std_msgs/msg/Float64 | Subscribes to control the angle for servo 2. |
/servo3 | std_msgs/msg/Float64 | Subscribes to control the angle for servo 3. |
| Service Name | Type | Description |
|---|---|---|
/reset_odom | std_srvs/srv/Empty | Resets the odometry to zero. |
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.