Drone losing position / crashing in Offboard mode

Hello everyone,

I am trying to run GPS denied navigation using VIO with the help of a tracking camera and a companion computer. My hardware setup is

Flight Controller: CubeOrange
PX4 version: v1.14.3 (Stable)
Companion Computer: RB5 Development Kit

I am trying to use offbaord mode and do navigation using MAVSDK, but the problem I am facing is, whenever I switch to offboard, the drone crashes, and it is always in only one direction. It always tilts to the rear left of the drone and falls down.

Initially I used an optical flow sensor for position hold, later I tried position hold only with external vision and position hold is very good, I can navigate seamlessly around using RC in position hold only with external vision, I tried fusing both EV and OF, position hold was good, but the offboard problem is there even with both EV and OF fused together.

I have attached the logs below for your reference.

https://review.px4.io/plot_app?log=e4c9f0f3-df81-4d49-94f0-a9d5b06037c1

I have switched to offboard mode twice, one is near 6:54:00 and another time is around 7:11:00 for the above log.

https://review.px4.io/plot_app?log=52346209-bb6a-46c0-9eb4-426c1c93c620

For this log, I have switched to offboard at 1:30:00

I also checked the logs in Flightplot, and here is the estimator attitude and the vehicle attitude.

@rroche @JulianOes Can you please help me with this? Thank you.

I see that the position setting of xyz is set to 0 in offboard mode.Except drone has the opportunity to change the attitude, it will not cause a big problem for the xy direction. But Z direction 0 means ground/crash.
Check your computer program to make sure it doesn’t send wrong/unexpected position settings.

Thank you for the response @xdwgood . The xyz should not be zero once the algorithm starts running right? It should be changing with respect to the drones position, so xyz changes, and in offboard it should stay there. Is that correct?

Another thing, now I have not given any setpoints yet, I am just sending position estimates to see if it’s hovering in offboard mode.

Hi there,
There are sudden changes on your position estimate of z axis, first log check 7.10 really clear there.
look at the following tables : local_z, actuator conrols. On local z you will see the change, and on actuator_controls you will see the sudden thrust change, which causes the altitude lose. also you have similar problems on other axis
.

The other log that you switch to offboard, you are giving (0,0,0) position setpoint as @xdwgood stated, you can check them from local_x,y and z. And you cannot switch to offboard without giving setpoint. you need to feed setpoint to the autopilot minimum at 2 hz.

How you can solve this issue,
check your position estimates before the flight, move your drone arount at your hand, make tests and be sure that you have good outputs, try to find what causes position jumps. maybe you can put a basic filter before feeding your position estimates to the autopilot.

best luck

Thank you @Halil , I’ll check and get back to you.