How to get rover to move via mavros ? Which topics to publish to ? What mode?


I need help getting MAVROS control going for my rover.
I plan to use ardurover 3.2 rc1 - as sugguested here

I have followed the tutorials listed here

and am able to view topics like IMU data being published.

I now want to make the robot move via ROSnode.

What steps do I need to take in order to do this ?
What mode do I need to set the ardurover (Guided mode ? ) and how do I do this through mavros?

How do I send waypoint commands & Velocity commands to the ardurover?
Which topics do I publish to?

The mavros tutorials are great so far but I wish it could be extended to explain my questions above.



I’m looking into your problem and going to answer as soon as possible.


Thankyou ! Are you able to provide me with an estimate on when I can hear back from you?

Currently working on a project so some idea about timeline would be great :slight_smile:


I hope that by the end of the week I’ll write a small tutorial or something like this to elaborate on your question :wink:

Hi Kirill,

Any updates on this ?


Hi @kirill.kobylyanskiy

How is it all going ?


There are mainly three options of making rover to move. First, you can control motors and servos connected to rc outputs directly. Have a look at our examples.

Second, you can manipulate waypoints and send it to APM or send another commands using mavcmd and mavwp.

For manipulating mission use mavwp with the following arguments:

show - Show waypoints
load - load waypoints from file
pull - pull waypoints from FCU
dump - dump waypoints to file
clear - clear waypoints on device
setcur - set current waypoints on device

To send commands use:
rosrun mavros mavcmd {argument}, where argument can be on of these:


long - Send any command (COMMAND_LONG)
int - Send any command (COMMAND_INT)
sethome - Request change home position
takeoff - Request takeoff
land - Request land
takeoffcur - Request takeoff from current GPS coordinates
landcur - Request land on current GPS coordinates
trigger_control - Control onboard camera trigerring system (PX4)

Alternatively, you can write and build your own ros publisher that will send Waypoint msgs to the topic mavros/mission/waypoints

Look at our tutorial to get familiar with the creating of your own packages, publishers and subscribers in ros. Then we’ll write our own publisher in C++.

  1. In the ‘src’ directory of your package create file named send_waypoint.cpp
  2. Past there the following code:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "mavros_msgs/Waypoint.h"
#include <sstream>

int main(int argc, char **argv){
    ros::init(argc, argv, "talker");
    ros::NodeHandle n;
    ros::Publisher chatter_pub = n.advertise<mavros_msgs::Waypoint>("/mavros/mission/waypoints", 1000);
    ros::Rate loop_rate(10);
    int count = 0;
    while (ros::ok()){
        mavros_msgs::Waypoint waypoint;
    return 0;
  1. Add the following lines to the CMakeLists.txt:
    add_executable(send_wp src/send_waypoint.cpp)
    target_link_libraries(send_wp ${catlin_LIBRARIES})

  2. Build everything with catkin_make

In your build directory you’ll see send_wp executable file. Run it and check with
rostopic echo mavros/mission/waypoints
if any waypoints are appeared. You can initialize waypoint object with your own data to get it published.

Hope it’ll help you :slight_smile:

1 Like

HI @kirill.kobylyanskiy

Thank you for this . Is there a way I can send a velocity command to the APMRover flight stack as opposed to waypoints via mavros?

I have seen your examples to control rc outputs directly but am more interesed in using a ros node to talk to the APMRover stack in order to send velocity and turn rates.

I want to take full advantage of the feedback machanisms in the APM software

Yes, of course you can send a velocity command. Take a look at Twist message documentation and /mavros/setpoint_velocity/cmd_vel topic.

This topic was automatically closed after 100 days. New replies are no longer allowed.