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

Chat: reliability enhancements #1289

Merged
merged 5 commits into from
Dec 27, 2023

Conversation

rmackay9
Copy link
Contributor

This improves the reliability in a few ways:

  1. COMMAND_ACK messages are used to tell the assistant if the command was successful or not.
  2. Assistant instructions are updated in a few ways:
    • Emphasize that it must check the vehicle type to protect against using the wrong vehicle's flight-mode-number when changing modes
    • Tell it to use CONDITION_YAW to change the vehicle's yaw
    • Emphasize takeoffs commands should only be sent after the vehicle is confirmed to be in Guided mode and armed

I could squash down the assistant instructions to a single commit if this is preferred.

I've tested this and it certain improves reliability. Below is a typical test where the user asked it to takeoff before the arming checks cleared and it still managed to do it.

image

image

image

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really only fussed by that sleeping.

MAVProxy/modules/mavproxy_chat/__init__.py Outdated Show resolved Hide resolved
@@ -26,6 +28,11 @@ def __init__(self, mpstate):
# keep reference to mpstate
self.mpstate = mpstate

# a dictionary of command_ack mavcmds we are waiting for
# key is the mavcmd, value is -1 or the MAV_RESULT (e.g. 0 to 9)
# we assume we will never be waiting for two of the same mavcmds at the same time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't dis-ambiguate the results anyway! I've pushed for the addition of an "opaque ID" supplied in the COMMAND_INT message and returned in a COMMAND_ACK to fix that problem, but didn't ever get traction on it...

You can ensure you never send a second command of a specific type while one is outstanding based on your dictionary, 'though. You would then need a timeout as the ACK may get lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thanks. The way the chat module works at the moment, the commands are only sent one-by-one and after sending it immediately waits for the ACK so there's actually no way for it to be waiting for two command_acks. It could still pickup the wrong ACK though if that ACK is in response to a similar command from some other sender... and your proposed change would help with that so I'm all for it.

BTW I could have simplified the dictionary down to just a single name-value pair but in python a dictionary is so easy to use I went with it.

MAVProxy/modules/mavproxy_chat/__init__.py Show resolved Hide resolved
MAVProxy/modules/mavproxy_chat/__init__.py Show resolved Hide resolved
@rmackay9 rmackay9 force-pushed the chat-reliability-enhancements branch from 8365e5b to 316be97 Compare December 27, 2023 03:37
@rmackay9 rmackay9 dismissed peterbarker’s stale review December 27, 2023 05:22

I think I've addressed PeterB's requests.

@peterbarker peterbarker merged commit 075af57 into ArduPilot:master Dec 27, 2023
1 check passed
@peterbarker
Copy link
Contributor

Merged, thanks!

@rmackay9
Copy link
Contributor Author

Thanks!!

@rmackay9 rmackay9 deleted the chat-reliability-enhancements branch December 28, 2023 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants