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.
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.