ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Added re-initialization for guided_change_x commands

Open EyesWider opened this issue 1 year ago • 3 comments

Currently ArduPilot supports MAV_CMD_DO_REPOSITION for latitude/longitude and altitude control in Guided mode, and MAV_CMD_DO_CHANGE_SPEED can be used to control the aircraft's speed. These messages together allow aircraft "Waypoint" control.

MAV_CMD_GUIDED_CHANGE_SPEED, MAV_CMD_GUIDED_CHANGE_ALTITUDE, and MAV_CMD_GUIDED_CHANGE_HEADING can also be used in Guided mode, and support slewing the aircraft to align to the respective Heading, Speed, Altitude (HSA) commands. However, currently there is no logic implemented to stop listening to these commands while in Guided for any reason, with the result that any MAV_CMD_DO_REPOSITION or MAV_CMD_DO_CHANGE_SPEED commands sent after conflicting HSA commands are Accepted but functionally ignored. The result is that for a companion computer to transition back to Waypoint commands after sending HSA commands, the only way to do this is for the computer or the pilot to command out of Guided and then back in.

These updates perform the same re-initialization of the HSA-related variables that currently happens when entering Guided, but does it whenever a DO_REPOSITION or DO_CHANGE_SPEED command is Accepted. There may be additional messages where it would also make sense to do this re-initialization, or in a different location - I am not sure.

EyesWider avatar Jun 04 '24 18:06 EyesWider

Hi @EyesWider,

Thanks very much for this. A bit of admin, could you rebase on master to remove the merge commits? Also we like to have all our commits prefixed with the directory (or subsystem) that is affected because it makes backporting easier. .. so could you rename the commit title (not to be confused with the PR title) so that it starts with "Plane: "

rmackay9 avatar Jun 07 '24 12:06 rmackay9

Ping @timtuxworth - you've been working in here. Your thoughts?

@EyesWider sorry, conflicting on Tim's work. Could you rebase, please?

peterbarker avatar Sep 10 '24 09:09 peterbarker

Ping @timtuxworth - you've been working in here. Your thoughts?

@EyesWider sorry, conflicting on Tim's work. Could you rebase, please?

Thanks Peter, yes I have seen exactly this and documented it in this (unfinished) Wiki PR. https://github.com/ArduPilot/ardupilot_wiki/pull/6096

I have a different fix for the same issue in my PR #27137 at GCS_Mavlink.cpp:858 but this looks like a cleaner and more complete solution than mine.

timtuxworth avatar Sep 10 '24 15:09 timtuxworth

My PR #27921 has been merged @EyesWider - it would be great if you could rebase and update this, I'd really like to see it merged.

timtuxworth avatar Sep 24 '24 14:09 timtuxworth