Can't stay in offboard mode

I use a Raspberry Pi connect PIXHAWK by Telem2 . When I run a ROS node to switch the flight mode to OFFBOARD, the flight controller immediately exits to ALTITUDE mode. I really do not know why and can not resolv it for a week. Thanks!

ubuntu 16.04
px4 1.9.0

Hello @gliehu,

This typically happens when either the localization or your set point stream is not proper. You will need to debug it taking one step at a time. First check if the localization is firm and not diverging or resetting to zero. Secondly, you need to send 100 data points before switching to offboard. Also, try to arm using radio or switch mode from radio.

Regards,
Kashish Dhal

Thanks for your help. Kashish Dhal,

I am using the MAVROS Offboard control example MAVROS Offboard control example. it can switch to the OFFBOARD mode and arm by this program, but it can’t fly and change mode to Altitude at once. It always seems have no power and the rotor speed is too low to take off. This is also happened outdoors.
By the way, I used a GPS module but I should fly indoor sometimes.Must GPS be used in OFFBOARD mode? Is there any way to throw it away?

Regards,
gliehu

I have only flown inside so don’t know much about GPS. But it is not using GPS indoors. I have to use GPS to press safety switch to arm it.
On the console of offbnode it will say OFFboard
mode enabled. If it does say that then maybe others can help as I don’t know more about it. In my case it does take off after it is enabled.