Condition and DO commands in Auto Mode

I am working on obstacle avoidance using Fuzzy logic and using MATLAB Fuzzy toolbox for the development of FIS. For my mission planning and flying setup, i am using ArduCopter and Mission Planner.
I am successful in creating a udp link between Mavlink and Simulink and decodingthe messages for required calculations.

My query is related about sending the commands back to Mavlink when some obstacle is detected by Fuzzy System. I have to change speed, altitude and heading. I have found the required commands

    My quadcopter is flying in an automode and i have to override the NAV CMD using these messages.
    Can anyone help me in finding the right steps to send back this messages. As right now nothing changes and mission is keep on flying on the planned route.
    Any guidance and help is appreciated. Looking forward for response.

Do not use auto mode. Use guided instead.

Thank you so much for the reply. I understand that guided mode will respond back to these messages but i am trying to implement navigation through a planned path. So for that purpose the quadcopter must follow a mission.
Is it possible to change the mode to guided send MAV_CMD_DO_CHANGE_SPEED command and then change back the mode back to auto.

Also i have been reading the documentation, and find this:
In Auto mode the copter will follow a pre-programmed mission script stored in the autopilot which is made up of navigation commands (i.e. waypoints) and “do” commands (i.e. commands that do not affect the location of the copter including triggering a camera shutter). This page provides an overview of Auto mode.

This confused me as MAV_CMD_DO_CHANGE_SPEED falls in a “do” command strategy. Can you explain the difference or is there anything i am missing here?

It is easier to “Change your mind” while operating in GUIDED that it is to do it on AUTO.

AUTO mode is for predefined flight paths, some people in the past have tried to change the AUTO mission on-the-fly, but AFAIK it never worked.


Thank you for the idea. I can see that Guided Mode can help me if i keep giving commands “guided LAT LNG ALT” one by one to make it a guided mission. I am flying the copter in guided mode and trying to give commands through Mission Planner Change Speed and Change Alt buttons in the Action Tab. But still no updates on the Altitude and Speed of the Copter. As it ignore the command and keep going to the guided location. May be i am missing something. Can you please help me and mention the steps to change the Altitude/Speed of the Copter while flying in Guided Mode.

Yes, you are missing something. Everybody is using GUIDED with pymavlink or dronekit-python and it works.
To use GUIDED in MP you need to ask in the MP section of this forum.

Old thread but I am also in the similar situation. So amending the mission waypoints in automode is not possible?

I have never tried it on an actual craft but you can upload a Mission with new added Waypoints while it’s flying a Mission in SITL and it works.