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

MissionRotation LUA - Load one of up to 10 mission files #28789

Closed
wants to merge 11 commits into from

Conversation

robustini
Copy link
Contributor

@robustini robustini commented Dec 1, 2024

This LUA script is an evolution on the MissionSelector.LUA.
Allows you to select up to 10 missions, either while arming or in the unarmed state.
Requires that an RCx_OPTION be set to 24 (Mission Reset).
The scripts should be installed in the SCRIPTS folder on the MicroSD, and the mission files in the root.
The mission file called mission0.txt (the default mission) must exist and is loaded at boot, if the script does not find it it stops working.
To load to the next mission file just bring AUX switch from low to high for no more than three seconds, each switch loads the next mission file in numerical order.
If the next mission file numerically does not exist load the next one, at the end of the rotation it returns to load mission0.txt.
If AUX is held at high state for more than three seconds the script will restart by loading mission0.txt.
If a mission switch is attempted in AUTO flight mode, a warning “Could not clear current mission” will be shown and no operation will be performed
Provides for sending messages under any condition, load or error.

Classic example of use, i.e. how do i use this rotation:

  • mission0.txt is my automatic takeoff mission with home setting at a different point from arming followed by RTL, this way after manually launching my fpv plane I can put on my goggles, exit RTL and execute my flight
  • mission1.txt is a full circuit mission for automatic landing, I load it if I want Ardupilot to perform an automated landing from the R side of the runway. This comes in handy, for example, if video transmission is interrupted and visibility on the ground is not optimal
  • mission2.txt is like mission1.txt but executes the circuit for landing runway L
  • the other mission files I use to perform specific automated flights

In my case if any failsafe intervenes the chosen mission is then executed.
In this way by pre scheduling the appropriate missions for the location where I fly I can afford to handle any emergencies without using GCS, simply choosing with the script the most appropriate mission, and in case changing it on the fly.

… switch state

This LUA script is an evolution on the MissionSelector.LUA.
Allows you to select up to 10 missions, either while arming or in the unarmed state.
Requires that an RC_xFUNCTION be set to 24 (Mission Reset).
The scripts should be installed in the SCRIPTS folder on the MicroSD, and the mission files in the root.
The mission file called mission0.txt (the default mission) must exist and is loaded at boot, if the script does not find it it stops working.
To load to the next mission file just bring AUX switch from low to high, each switch loads the next mission file in numerical order.
If the next mission file numerically does not exist load the next one, at the end of the rotation it returns to load mission0.txt.
Provides for sending messages under any condition, load or error.
Changed the operating logic:

- always loads mission0.txt at startup, cycles missions to AUX high if held for less than 3 seconds
- resets mission0.txt if AUX is high for more than 3 seconds
Updated operating logic
- removal of last_sw_pos
- removed all comments except the initial ones
Inhibited the ability to change mission if flight mode is AUTO, with associated warning message
If a mission switch is attempted in AUTO flight mode, a warning “Could not clear current mission” will be shown and no operation will be performed.
Fixed issue that sent duplicate mission change messages.
Second attempt: fixed duplicate message sending problem in mission loading.
@robustini
Copy link
Contributor Author

Need better debug.

@robustini robustini closed this Dec 2, 2024
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.

1 participant