PX4 control with move_base ROS - Is this possible?

Dear all

I would like to use the ROS standard move_base ROS Node which is a major component of the ROS navigation stack. I am hoping to use it with the (soon to be available) PX4 Rover implementation and practice with some of the ROS SLAM tools in the process.

In the meantime I’m using SITL with multicopters and OFFBOARD control. I have installed the MAVROS package and successfully run the examples on MAVROS Offboard Example · PX4 Developer Guide and the example https://pixhawk.org/dev/ros/ground_rover (although this required some modifications to the file as some of the message names have changed)

move_base publishes cmd_vel topics, and MAVROS provides a couple of topics with cmd_vel such as:

$ rostopic info /mavros/setpoint_attitude/cmd_vel 
Type: geometry_msgs/TwistStamped
$ rostopic info /mavros/setpoint_velocity/cmd_vel 
Type: geometry_msgs/TwistStamped

However the message type is TwistStamped as opposed to simply Twist which is what move_base expects.

This mismatch makes me suspect that using move_base and hence cmd_vel topic might not be one of the implemented and tested ways of controlling PX4 from ROS?

As I test I did a takeoff, sent cmd_vel messages and then set OFFBOARD to see what happened, and it sort of worked, the drone increased it’s height but then becomes unstable and crashes… so obviously I’m missing something here…

 rostopic pub  -r 10 /mavros/setpoint_velocity/cmd_vel geometry_msgs/TwistStamped '{stamp: now, frame_id: fcu}'   '[[0, 0, 2.0],[0.0, 0.0, 0]]'

Am I barking up the wrong tree trying to control PX4 with cmd_vel topics?

I see from other examples /mavros/setpoint_position/local is used, can this be used with ROS navigation tools? Can anyone share an example or pointers?

I’m climbing up the learning curve with ROS so any info helpful.



If you can compile the lastest mavros you will have a new listener on /mavros/setpoint_velocity/cmd_vel_unstamped that take cmd_vel as Twist msg !

Sounds great, I’ll give it a go.

Do you think I can expect to be able to control the multicopter (in simulation) with cmd_vel then ? Ie will I be able to command a given speed and angular rotation without the MC loosing stability? Have you tried it yourself per chance?

Is there anything I need to do apart from taking off and setting the MC in OFFBOARD mode ?


I am sorry, I don’t use PX4 … On ardupilot side, it works on copter and rover. I assume that PX4 also accept setpoint_velocity so it should work.

Ah, I see.
Well I have an Ardupilot rover myself, so maybe I could try that, at least it will help me clarify some concepts.

So when you use /mavros/setpoint_velocity/cmd_vel are you successfully controlling both the linear and angular velocities then?

And cmd_vel topics referenced to the map or to the rover body itself?
ie is x East or Straight ahead ?

If you used the Stamped message, what do you specify as frame_id ?


Hey Eduardo,

I am trying to implement something similar to yours, did you manage to link the cmd_vel from ROS to setpoint_velocity/cmd_vel? If so can you teach me how to do the same?

I am having some difficulties/doubts in making it work as I am new to ROS, so I could use some help while I am still getting the hang of it.