mavros_tutorial

How to Get/Set parameters of Ardupilot-SITL Rover

Author: Masoud Iranmehr

Github Page: github.com/masoudir/mavros_tutorial

Initialize

Please follow steps mentioned in this link

Get/Set MAVROS Parameters

Get/Set MAVROS Parameters using MAVProxy or Ardupilot-SITL

If you want to set a parameter, you can just use this command:

And if you want to set a parameter, you can just use this command:

Or

For example, if you want to consider “CRUISE_SPEED” as your parameter, you can use these commands to get or set it:

Or

Get/Set MAVROS Parameters using ROS rqt:

At first you need to add two plugin from rqt:

Plugins -> Services -> Service Caller

If you want to set a parameter, then in “Service Caller” side, you have to select “/mavros/param/set” and then in the field of “param_id”, you can enter your name of parameter and then in the field of “integer” or “real” you can set a new value for that parameter. Then click on “call” button to send this message. The example result for parameter “CRUISE_SPEED” should be as follow:

Screenshot

As you can see the output constitutes a “success” field which is in bool type (False/True) and indicates that this process was successfully done or not. Also the new value of this parameter will be shown on this screen as you see.

It is noted that there is not any differences between “integer” and “real” when your value is in integer format.

If you want to set a parameter, then in “Service Caller” side, you have to select “/mavros/param/get” and then in the field of “param_id”, you can enter your name of parameter and then in the field of “integer” or “real” you can set a new value for that parameter. Then click on “call” button to send this message. The example result for parameter “CRUISE_SPEED” should be as follow:

Screenshot

As you can see the output constitutes a “success” field which is in bool type (False/True) and indicates that this process was successfully done or not. Also the new value of this parameter will be shown on this screen as you see.

Change vehicle mode using ROS command lines

If you want to set a parameter value you need to call a ros service in order to do that. Just follow these commands:

This command gives you this result:

Node: /mavros
URI: rosrpc://ubuntu:58491
Type: mavros_msgs/ParamSet
Args: param_id value

“mavros_msgs/ParamSet” is the type of this service srv file and “Args” are our input arguments, but we have to know their types, so that we type this command:

This will result as below:

string param_id
mavros_msgs/ParamValue value
  int64 integer
  float64 real
---
bool success
mavros_msgs/ParamValue value
  int64 integer
  float64 real

In this case, “param_id” is the name of parameter needs to being configured and its type is “string”. Also “integer” and “real” are the fields describing the value of this parameter.

For setting the parameter with the new value, you can rus this command:

For example for the parameter of “CRUISE_SPEED”:

And if you want to get the value of a parameter:

For example for the parameter of “CRUISE_SPEED”:

Change vehicle mode using rosun commands