Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: add MAV_CMD_DO_UPGRADE command #1382

Merged
merged 4 commits into from
May 28, 2020

Conversation

TSC21
Copy link
Member

@TSC21 TSC21 commented May 20, 2020

Context

Today's UAS usually come with several different components with which one is able to interact, program and configure. Most of today's system also have a onboard/companion computer capable of executing different tasks. One of these tasks is the ability of upgrading the other system components with the execution of appropriate scripting routines. Although this can be controlled by direct access to the computer (ex: using SSH), the ability of doing the same using the ground station exponentially increases the user experience.

Approach

In order to be able to start, cancel or even restart an upgrade process in a UAS sub-system, MAV_CMD_DO_UPGRADE was added. This command uses 3 params to direct usage plus a WIP param field. First param basically uses the MAV_COMPONENT enumeration in order to be able to identify which system component is target for the upgrade. Second param identifies the action. Third param is used to set if the component is to be rebooted or not after the action is executed. Finally, the WIP param is used to set the rate of the COMMAND_ACK with MAV_RESULT_IN_PROGRESS set, together with the progress percentage.

@TSC21
Copy link
Member Author

TSC21 commented May 20, 2020

@julianoes @DanielePettenuzzo @cmic0 FYI.

@TSC21 TSC21 force-pushed the pr-add_do_upgrade_command branch from 9b4b8f6 to edadc90 Compare May 20, 2020 11:06
@hamishwillee
Copy link
Collaborator

@auturgy FYI

@TSC21 TSC21 force-pushed the pr-add_do_upgrade_command branch from edadc90 to 9bafde3 Compare May 22, 2020 09:06
@auturgy
Copy link
Collaborator

auturgy commented May 22, 2020 via email

@hamishwillee
Copy link
Collaborator

hamishwillee commented May 26, 2020

Thanks @auturgy

Good questions. As is, yes this can only update something with a component ID (unless we trigger an update for "everything").

My two bits

  • I think it is reasonable you might want to update something that is non-mavlink. Either way should be made clear.
  • Component IDs are already a slight concern because they aren't guaranteed to be "as they are assigned". I say slight, because as this is designed the receiving "updater" can know everything about the system
  • This design that assumes we want to trigger an update by sending a message to an updating system that has other mechanisms for knowing how to go about doing an update. I.e you could really call this "do something" and feed in a number for that something.
  • Yes, if we stick with this approach we should comment that it is independent of other component management systems.

@TSC21 I know this is a simple design initially designed just to allow companion to update flight controller and it serves that purpose. It might be just what we need. I agree with James we should at least do the due diligence of seeing if it can be made more flexible to avoid having to redesigned in future. Any chance you can attend the mavlink meeting tomorrow so we can sort out any details in person?

So brainstorming .... the COMPONENT_INFORMATION system allows us to query for metadata. So we could query individual components about what updates they support and where updates are stored. Or more likely we could use it only for "updator components". They could then list the updateable components and IDs used to update them (even if they are not mavlink), along with urls for checking update status and downloading new update packages etc. We'd still trigger the update via a command.

@hamishwillee
Copy link
Collaborator

Hi @TSC21

Dev call had a chat; we have no concrete suggestions that should block this going through; but it is WIP, so that might change :-)

Looking at this I think the only problem is the cancel and restart sequence - IMO the cancel should result in an accepted response - you're accepting the command to cancel not failing the original command.
Similarly the restart command would be followed by the normal "first time" in progress COMMAND_ACK sequence.

So perhaps reword description as:

Request a target system to start, cancel, or restart upgrade of a component (or components). For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence (COMMAND_ACK regularly sent with result=MAV_RESULT_IN_PROGRESS, followed by a final result of MAV_RESULT_ACCEPTED or MAV_RESULT_FAILED). The operation can be cancelled, in which case the updating system would send COMMAND_ACK with MAV_RESULT_ACCEPTED. The operation can be restarted, in which case the updating system should respond with progress updates (as though it had a new message).

Hope that makes sense. If it doesn't do what you need, then let me know.

@TSC21
Copy link
Member Author

TSC21 commented May 27, 2020

Hi @TSC21

Dev call had a chat; we have no concrete suggestions that should block this going through; but it is WIP, so that might change :-)

Looking at this I think the only problem is the cancel and restart sequence - IMO the cancel should result in an accepted response - you're accepting the command to cancel not failing the original command.
Similarly the restart command would be followed by the normal "first time" in progress COMMAND_ACK sequence.

So perhaps reword description as:

Request a target system to start, cancel, or restart upgrade of a component (or components). For example, the command might be sent to a companion computer to cause it to upgrade a connected flight controller. The system doing the upgrade will report progress using the normal command protocol sequence (COMMAND_ACK regularly sent with result=MAV_RESULT_IN_PROGRESS, followed by a final result of MAV_RESULT_ACCEPTED or MAV_RESULT_FAILED). The operation can be cancelled, in which case the updating system would send COMMAND_ACK with MAV_RESULT_ACCEPTED. The operation can be restarted, in which case the updating system should respond with progress updates (as though it had a new message).

Hope that makes sense. If it doesn't do what you need, then let me know.

Does make sense! Thanks!

@hamishwillee
Copy link
Collaborator

@TSC21 I've improved the description, and will now merge.

Note that param 7 will need to be updated before WIP tag is removed on command - to add label and to remove the WIP message. FWIW I hope you remove this altogether - I feel that progress update rates should be managed by the system emitting them and more be defined by MAVLink itself.

@hamishwillee hamishwillee merged commit 33ed65b into mavlink:master May 28, 2020
@TSC21 TSC21 deleted the pr-add_do_upgrade_command branch June 18, 2020 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants