Servers by jDrones

Sending commands via /mavros/setpoint_velocity/cmd_vel in guided mode

Hi, I’m trying to drive an hexacopter through mavros. My setup is Pixhawk 1 with arducopter 3.5, raspberry pi3 b+ with ubuntu, ros kinetic and mavros (an old version, I think). I connect wirelesy with my laptop. I run ROS core in my laptop, configure ROS_IP and ROS_MASTER_URI on pi. I roslaunch mavros apm.launch and confirm that I can read mavros topics in my laptop. I takeoff manually, change to positionhold flight mode and positioning the hexa. Then, in my laptop I publish to /mavros/setpoint_velocity/cmd_vel at a rate of 30 Hz. Then I change flight mode with my RC Tx to guided. /mavros/state reflect the change, mode field change to GUIDED, but the hexa doesn’t move.
Am I missing something? Is there a way to confirm GUIDED mode other than /mavros/state? I have telemetry radio, I could connect a qgroundcontrol if it help for debug the problem.


Is GPS received? Basically, guided mode cannot fly if GPS is not received.

yes, GPS is received, I could flight in POSHOLD fligth mode.
The question is, when I change to GUIDED, if there is a problem then how to know what it is, because /mavros/state->mode confirm I’m in GUIDED mode, but it seems that the arducopter reject the flight mode change.


What is the system id of mavros? It needs to match the SYSID_MYGCS parameter on your controller. . I set mavros to match my controller when launching: roslaunch mavros apm.launch fcu_url:=‘udp://,240’ where the 255 matches the Pixhawk SYSID_MYGCS setting. Unless these two match, the Pixhawk will ignore all commands

I have 2 vheicles in the network, one with sysid = 1 and the other with sysid 2. But in roslsunch I set tgt_system parameter and fcu_url is serial device.
I think I solved the problem, a bad configuration on /etc/hosts on the pi’s. I will report after testing.

@elgarbe do you have any solution? i have the same problem

The problem was in /etc/hosts each hostname and ip address needs to be in the file on each raspberry/pc

maybe my problem is different:
I started building an hexacopter (flame f550) using a raspberry 4 and the orange cube with optical flow and a leddar One. I have installed mavros. I’m trying to get the raspberry to communicate with the cube. I can see the topics and read what they publish. But I have these problems:

  1. At the beginning i couldn 't see the eco of the topics so i use this line “rosservice call /mavros/set_stream_rate 0 10 1”( is it correct?)
    but i can’t see the eco of local_position/pose. Do you know why or how i could solve this problem?
  2. my second problem is that the copter could not take off. I switched the mode in guided and arm the copter then I tried to publish a velocity with “mavros/setpoint_velocity/cmd_vel_unstamped” but the copter didn’t listen to me. So i tried to use “mavros/setpoint_position/local” but nothing. i think that for now i can’t use setpoint_position because i don’t have an echo from local position.
    My question is :
    what am I doing wrong? is the same problem @elgarbe?
Servers by jDrones