Package Summary

Tags No category tags.
Version 0.1.1
License BSD
Build type CATKIN

Repository Summary

Checkout URI
VCS Type git
VCS Version master
Last Updated 2021-11-22
CI status No Continuous Integration
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

RoboMaster standard robot Gimbal controller

Additional Links

No additional links.


  • Qiayuan Liao


  • Qiayuan Liao



The rm_gimbal_controllers has three states: RATE, TRACK, and DIRECT. It performs PID control on the yaw joint and pitch joint according to commands. It can also perform moving average filtering based on detection data and calculate, predict and track targets based on the ballistic model.

Keywords: ROS, Robomaster, gimbal, bullet solver, moving average filter


The source code is released under a BSD 3-Clause license.

Author: DynamicX
Affiliation: DynamicX
Maintainer: DynamicX

The package has been tested under ROS Indigo, Melodic and Noetic on respectively Ubuntu 18.04 and 20.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.

Hardware interface type

  • JointStateInterface Used to get the speed and position of gimbal joint.
  • EffortJointInterface Used to send effort command to gimbal joint .
  • RoboStateInterface Used to get the current and historical transform between gimbal and the world coordinate system and the transform between visual target and the world coordinate system.


Installation from Packages

To install all packages from the this repository as Debian packages use

sudo apt-get install ros-noetic-rm-gimbal-controllers

Or better, use rosdep:

sudo rosdep install --from-paths src

Building from Source


  • roscpp
  • roslint
  • rm_msgs
  • rm_common
  • pluginlib
  • hardware_interface
  • controller_interface
  • forward_command_controller
  • realtime_tools
  • control_toolbox
  • effort_controllers
  • tf2
  • tf2_geometry_msgs
  • angles
  • visualization_msgs
  • dynamic_reconfigure


To build from source, clone the latest version from this repository into your catkin workspace and compile the package using

cd catkin_workspace/src
git clone
cd ../
rosdep install --from-paths . --ignore-src
catkin build


Run the controller with mon launch:

  mon launch rm_gimbal_controller load_controllers.launch

Launch files

  • load_controllers.launch: Load the parameters in config files and load tf and robot_state_controller, joint_state_controller, gimbal_controller.


Subscribed Topics

  • command (rm_msgs/GimbalCmd)

Set gimbal mode, pitch and yaw axis rotation speed, tracking target, pointing target and coordinate system.

  • /detection (rm_msgs/TargetDetectionArray)

Receive visual recognition data.

  • /<camera_name>/camera_info (CameraInfo)

Make sure that the detection node receives a new frame of image and sends the prediction data to the detection node.

Published Topics

  • error (rm_msgs/GimbalDesError) The error calculated by the ballistic model to shoot at the current gimbal angle to the target.

  • track (rm_msgs/TrackDataArray) The predicted data used for detection node to decide the ROI.

    Bullet solver
  • model_desire ( visualization_msgs/Marker ) Used to visualize the desired bullet trajectory.

  • model_real ( visualization_msgs/Marker ) Used to visualize the trajectory that caculated by ballistic model in the current gimbal angle.


  • detection_topic (string, default: "/detection")

The name of the topic where detection node gets predicted data.

  • detection_frame (string, default: "detection")

The name of the frame of detection.

  • camera_topic (string, default: "/galaxy_camera/camera_info")

The name of the topic that is determined that the detection node receives a new frame of image and sends the prediction data to the detection node.

  • publish_rate (double)

Frequency (in Hz) of publishing gimbal error.

  • chassis_angular_data_num (double)

The number of angle data of chassis.Used for chassis angular average filter.

  • time_compensation (double)

Time(in s) of image transmission delay(in s).Used to compensate for the effects of images transimission delay

Bullet solver

Bullet solver is used to get the bullet drop point * resistance_coff_qd_10, resistance_coff_qd_15, resistance_coff_qd_16, resistance_coff_qd_18, resistance_coff_qd_30 ( double )

The air resistance coefficient used for bullet solver when bullet speed is 10 m/s, 15 m/s, 16 m/s, 18 m/s and 30 m/s.

  • g (double)

Acceleration of gravity.

  • delay (double)

Shooting delay time(in s) after shooter get the shooting command.Used to compensate for the effects of launch delay.

  • timeout (double)

Timeout time((in s)) of bullet solver.Used to judge whether bullet solver can caculate the bullet drop point.

Moving average filter

Moving average filter is used for filter the target armor center when target is spin. * is_debug ( bool, default: true )

The debug status.When it is true, debug data will be pulished on the filter topic.

  • pos_data_num (double, default: 20)

The number of armor position data.

  • vel_data_num (double, default: 30)

The number of armor linear velocity data.

  • gyro_data_num (double, default: 100)

The number of target rotation speed data.

  • center_data_num (double, default: 50)

The number of target rotation center position data.

  • center_offset_z (double)

Offset(in meter) on the z axis.Used to compensate for the error of filter result on z axis.

Controller configuration examples

    type: rm_gimbal_controllers/Controller
    time_compensation: 0.03
    publish_rate: 100
    chassis_angular_data_num: 20
    camera_topic: "/galaxy_camera/camera_info"
      joint: "yaw_joint"
      pid: { p: 8, i: 0, d: 0.4, i_clamp_max: 0.0, i_clamp_min: -0.0, antiwindup: true, publish_state: true }
      joint: "pitch_joint"
      pid: { p: 10, i: 50, d: 0.3, i_clamp_max: 0.4, i_clamp_min: -0.4, antiwindup: true, publish_state: true }
      resistance_coff_qd_10: 0.45
      resistance_coff_qd_15: 0.1
      resistance_coff_qd_16: 0.7
      resistance_coff_qd_18: 0.55
      resistance_coff_qd_30: 3.0
      g: 9.81
      delay: 0.1
      dt: 0.001
      timeout: 0.001
      publish_rate: 50
      is_debug: true
      center_offset_z: 0.05
      pos_data_num: 20
      vel_data_num: 30
      center_data_num: 50
      gyro_data_num: 100

Bugs & Feature Requests

Please report bugs and request features using the Issue Tracker.


Changelog for package rm_gimbal_controllers

0.1.1 (2021-08-12)

  • Set all version to the same
  • Add license to rm_chassis_controllers and rm_gimbal_controllers source files
  • Add add_dependencies(\${PROJECT_NAME} \${PROJECT_NAME}_gencfg)
  • Merge remote-tracking branch \'alias_memory/metapackage\'
  • Move all files to rm_gimbal_controllers/rm_gimbal_controllers, prepare for merge
  • Contributors: qiayuan

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

  • launch/load_controllers.launch
      • robot_type [default: $(env ROBOT_TYPE)] — Robot type [standard, hero, engineer]
      • base_link_tf [default: false] — Set true when not imu and chassis controllers loaded
      • odom_tf [default: false] — Set true when not chassis but imu and orientation controllers loaded


No message files found.


No service files found

Recent questions tagged rm_gimbal_controllers at