No datalink and mavros offboard mode

Hello,

Trying to run the px4 SITL with Gazebo as per the instructions here: https://dev.px4.io/en/simulation/gazebo.html. Running

make posix_sitl_default gazebo

starts the Gazebo and the px4 fine. In adddition, I have MAVROS running and connected to the px4.However, running

commander takeoff

Ouputs a Failsafe enabled: no datalink warning and the drone lands at home. I understand that you need some form of communication link but I thought having MAVROS connected and running would take care of this. Incidentally, this may or may not be related but I get a timeout if I try to set the controller in offboard mode by using

rosrun mavros mavsys mode -c offboard

MAVROS returns Unexpected command 176, result 1. Does anybody know what could be wrong? B.t.w. if I start the simulator with the optical flow model i.e.

make posix gazebo_iris_opt_flow

I can take off and hover, but still cannot set the controller to offboard mode.

1 Like

Ok, running qgroundcontrol takes care of creating a datalink, while streaming values prior to changing to offboard mode fixes that as well. My bad for not reading the code example about running in offboard mode with mavros in the doc attentively enough. However, I’m wondering if there’s a way do this without having to run qgroundcontrol. Also,I think the fact that the optical flow model can takeoff without a datalink is a bug, will report it as such.

1 Like

I have the same issue, and I did not totally understand how did you fix it?
Are there additional requirements before running the simulation?
Thank you in advance!

Disable this two parameters, it should work
param set NAV_RCL_ACT 0
param set NAV_DLL_ACT 0