-
Notifications
You must be signed in to change notification settings - Fork 691
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: improve flight mode reliability #1291
Chat: improve flight mode reliability #1291
Conversation
{ | ||
"type": "function", | ||
"function": { | ||
"name": "get_mode_mapping", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't help but wonder if it would be nicer to generate all of this from comments in the Python code rather than explicit documentation like this.
Advantages to human programmers in that. Especially when your editor is smart enough to use those comments to prompt in the user interface. Additional advantage that this documentation won't get out-of-date with the code, then.
Still, carry on :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that would be cool. The json files are slightly difficult to get right the first time you make them but after that it gets easier. What's odd about them is that you only need to include the list of arguments that the assistant must fill in. The return values can be whatever you want.. somehow the assistant just deals with whatever it gets.
@@ -327,6 +379,49 @@ def get_vehicle_type(self): | |||
"vehicle_type": vehicle_type_str | |||
} | |||
|
|||
# get mode mapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment could be better... I exepct the "as a json string" is implied in here somehow.
This PR is built on #1290 and greatly improves the reliability of the chat modules ability to change modes by adding a get_mode_mapping() function that uses MAVProxy's existing list of flight mode names and numbers.
This has been tested in the simulator on Copters and Rovers and so far I have not seen it set the mode incorrectly.
BTW, the previous method relied on the Assistant referring to four text files (one for each vehicle) which included the mapping from flight mode name to number. Unfortunately OpenAI's assistant seems to have a bug which leads to it sometimes being unable to access the reference files (see this discussion). Without the correct mapping the results could be catastrophic (e.g. how do you feel about flying in Drift or AutoTune when you wanted RTL?)