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

AP_Scripting: Applets: MissionSelector: fix error on file open and checker errors #28520

Merged

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Nov 4, 2024

Ages ago file open would always succeed, we fixed the other scripts and missed this one. Now file can be nil so we need to check for that. This fixes the script so we can run the static checkers.

@@ -64,7 +61,6 @@ local function read_mission(file_name)
end
index = index + 1
end
file:close()
Copy link
Member Author

Choose a reason for hiding this comment

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

This is unreachable.

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

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

thanks...while we are at it could you add:
gcs:send_text(5,"Loaded MissionSelector.lua")
before the last line....I think a notification at boot of what scripts actually are running is worthwhile and have been asking submitters to add this when I catch it....

@IamPete1 IamPete1 force-pushed the scripting_mission_selector_fixup branch from f5985a4 to 5fdbf29 Compare November 5, 2024 08:50
@IamPete1
Copy link
Member Author

IamPete1 commented Nov 5, 2024

thanks...while we are at it could you add: gcs:send_text(5,"Loaded MissionSelector.lua") before the last line....I think a notification at boot of what scripts actually are running is worthwhile and have been asking submitters to add this when I catch it....

Done.

@timtuxworth
Copy link
Contributor

Why do you wait till armed to load the mission? Surely this could happen (on Plane):

  1. user selects AUTO
  2. user arms the vehicle
  3. vehicle tries to run the mission (there is none)
  4. script loads the mission

resulting in the vehicle just sitting on the ground, instead of taking off to fly the selected mission. No?

@Hwurzburg
Copy link
Collaborator

if there is no mission and you are in AUTO, you cant arm.....if there is, the existing mission wont be cleared(because its actually in progress when you switched mode to AUTO, even disarmed), it will run normally, and the script will send GCS text warnings to inform the user....one would first arm in some other mode, like FBWA(loading the desired mission....or not if there is no file), then switch to AUTO to run auto missions

@timtuxworth
Copy link
Contributor

The comments at the top of the file say this
it will function normally when armed or disarmed
but as far as I can see, it will not function while disarmed. I'm thinking it would be better if the comment was correct, I'd want to be able to switch missions while disarmed and verify I have the correct one while still on the ground before arming.

@Hwurzburg
Copy link
Collaborator

the first senteence applies to the Mission Reset switch....it indeed functions normally as Mission Reset whether armed or disarrmed

@peterbarker peterbarker merged commit 2ba7516 into ArduPilot:master Nov 6, 2024
100 checks passed
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.

4 participants