Target following digression during automated survey mission

Hi, apologies if this is the wrong place to post this!

I’ve set up a Tarot 650 quad with a Pixhawk 1 and arducopter fw and a telemetry radio to Mission Planner - that all works great (thanks by the way!). My next task is to automate a search, identify and track system for the quad using onboard computer vision. For testing, this is simply find a red R/C car in a field, then follow it.

To do this I’ve placed a raspberry Pi 3 with webcam & gimbal on the quad (again just for testing, also have some Tegra boards & Point Grey cameras ready for this task), and interfaced the Pi to the pixhawk via telem2. I’ve also written my own set of Mavlink drivers which can request messages, decode incoming data, upload missions, etc,etc. The Pi has its own telemetry link back to a separate ground station (also custom) for mission planning and monitoring. So far this all works fine, and I’ve basically replicated automated survey missions (grid searching) as available from mission planner, but via a supervisory control layer on the UAV. The CV side is also coming along nicely.

What I can’t get working is how to pause a mission while it is running (i.e. after MAV_CMD_MISSION_START), start following something of interest, and after some event (e.g. a timeout or user override), return to the previous mission from where it left off. I’ve tried Mavlink commands 192 (MAV_CMD_DO_REPOSITION) and 193 (MAV_CMD_DO_PAUSE_CONTINUE) but its not working (seems to ignore them). Is there a particular order of commands I should follow in order to get this functionality working?

Many thanks!
Jonathan