Can't change to OFFBOARD mode when using mavros/setpoint_raw/global

Hello there!

I’m in the process of setting up a Gazebo simulation for a rather complex multi-UAV project. To control the drones, I would like to use mavros’ setpoint_raw plugin, since it allows me to switch smoothly from position control (for normal operation) to velocity control (e.g. for dynamic obstacle avoidance) with a single publisher.

Setup

  • PX4 v1.8.2
  • ROS1 Melodic
  • Ubuntu 18.04
  • mavros 1.1.0

Problem

setpoint_raw/local works fine (thanks for the example!), but has the disadvantage that the “local” frame seems to be fixed to the drone’s starting position. For multiple drones it would be easier to use a common, non-drifting “map” frame without having to “manually” transform between the frames all the time.

This is what setpoint_raw/global is for, but I can’t get it to work. I’m publishing the messages at a 20Hz rate, have set all the relevant fields set (including stamp, coordinate_frame and type_mask), but PX4 refuses to go into OFFBOARD mode. After the call to mavros/set_mode it failsafes into AUTO.LOITER.

I’ve found issue 728 on the mavros github from 3 years ago with the same problem. There it was said that this functionality was simply not implemented yet. So my question is: Has anyone managed to get it working after that?

In case the problem lies within my older PX4 version: I’ve also tried to update to v1.9.2. It installs just fine, but I’ve failed to connect mavros with it. Think it’s related to the ports used, but after 2 days of fiddling around I decided to go back to v1.8.2 so I can continue working on other tasks. If my issue can be resolved with updating to 1.9 I will try that again and open a new question here if required.

Thanks in advance!