Author: Masoud Iranmehr
Github Page: github.com/masoudir/mavros_tutorial
Please follow steps mentioned in this link
You can send your commands directly from your terminal provided by MAVProxy or SITL. For this just type this command:
arm throttle
- Arms the robot
disarm
- Disarms the robot
At first you need to add two plugin from rqt:
Plugins -> Topics -> Topic Monitor
Plugins -> Services -> Service Caller
Then in “Topic Monitor” side, you have to tick the topic of “/mavros/state” to view its contents, so that you can get the vehicle mode and also some other parameters such as “arm status” and “Guided status”.
Then in “Service Caller” side, you have to select “/mavros/cmd/arming” and then in the field of “value”, you can set your arm status as a bool type variable (False/ True). Then click on “call” button to send this message. The result should be as follow:
If you want to view the general status of your ardupilot robot in MAVROS, you have to know all the topics created by MAVROS:
rostopic list
- Returns all topics availableThen you can see that every part of your robot has been mapped to a specific topic. In order to show robot arming status, you must use “/mavros/state” topic:
rostopic echo /mavros/state
- Returns all contents of /mavros/state topic periodicallyThe results should be as similar as this:
---
header:
stamp: 09
secs: 1595198641
nsecs: 651358095
frame_id: ''
connected: True
guided: False
manual_input: True
mode: "MANUAL"
system_status: 4
---
The command “rostopic echo
Just follow these commands:
rosservice call /mavros/cmd/arming True
- Send Arm command to robot
rosservice call /mavros/cmd/arming False
- Send Disarm command to robot
Another method is to use “rosrun” command:
rosrun mavros mavsafety arm
- Send Arm command to robot
rosrun mavros mavsafety disarm
- Send Disarm command to robot