Start offboard mode in flight


I am using MAVSDK/Python to start the offboard mode in flight after the drone has arrived at some destination point.
When activating offboard mode, the drone makes a strong movement a couple of meters sidewards and down, like if its trying to correct its position.

I set a first setpoint before I enable offboard mode:

myPosition=PositionNedYaw(0.00, 0.00, alt, yaw)

with alt and yaw being the current altitude and yaw as set in the
drone.action.goto_location() command before.

then call

await drone.offboard.set_position_ned(myPosition)

this is where the drone moves at full pace a couple of meters sidewards and down. From there on, I can make regular offboard moves with no problems.

All works fine in the simulator.

Thanks for adviceā€¦

I also have the same case. Did you solve your problem?

I changed to VelocityNedYaw(0.0, 0.0, 0.0, yaw). This gives a smooth transition to offboard mode in flight.
Sometimes, the command is not executed so call it twice and wait a second inbetween.