Switching to OFFBOARD from AUTO.MISSION mode

I am using ROS with onboard Intel NUC and want to execute the following sequence of commands (using the older firmware i.e. without avoidance feature):
mission mode -> offboard -> mission mode(continue from last waypoint)

I am using set_mode mavros service to switch modes from OFFBOARD to AUTO.MISSION and the other way.

While switching from AUTO.MISSION to OFFBOARD, the copter goes back to the planned home location before completely switching to offboard mode while the state shows offboard mode?
Any ideas to prevent this and why this is happening?

@Pence Which setpoint are you sending? What do you mean by completely switching to offboard mode while the status shows offboard mode?

In offboard mode it should hold its current position and irrespective of what the offboard setpoint is, it flies back to home position leaving the mission . As soon as set_mode OFFBOARD service is called, the /mavros/state shows OFFBOARD mode but still it is flying back to home position.


It sounds like you are sending 0, 0, 0 as a position setpoint Which rate are you sending the offboard setpoint?

@Jaeyoung-Lim Thanks for the reply, I figured out the issue it was with my external model predictive controller and is now sorted.