SITL doesn't switch to OFFBOARD

Hi guys,

After days of testing and searching, I couldn’t find the solution of my problem. Basically I’m trying to write a VERY simple takeoff script to get familiar with MAVROS and other concepts.
My problem is that everytime I try switch the flight mode to OFFBOARD I got this message: “FCU: Failsafe enabled: no RC and no offboard”.
I’ve read the documentation and follow this tutorial: https://dev.px4.io/en/ros/mavros_offboard.html
Few things that I did. and you should know.

  • I’m publishing points (100) before switching to OFFBOARD mode.
  • I’ve changed the rate from 10 to 20 (even tried with 30)
  • I tried to publish both local_position/local and global_position/global.
  • QGroundControl is open, otherwise I would have a “datalink missing” error.
  • Also the header.stamp is corrected set.
  • tried to switch to OFFBOARD via QGroundcontrol, didn’t work
  • Tried to switch via command line, didn’t work (make sens if you have to publish a point within 0.5 sec)

The code flow: change the rate → publish 100 points → change mode to offboard → arm → publish again.
It get the failsafe error and RTL mode is being enabled.

Thanks for reading.

@huhu1030 You need to be continuously streaming the setpoints to px4 within the time out. If the stream stops, you are unable to switch to offboard mode.

Can’t believe it was that stupid. I didn’t see the loop on the example code.
Thank you very much @Jaeyoung-Lim !