-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Autostart: load all airframes IDs with priority ROMFS -> SD card #23332
Conversation
if [ ${VEHICLE_TYPE} == none ] | ||
then | ||
echo "ERROR [init] No airframe file found for SYS_AUTOSTART value" | ||
param set SYS_AUTOSTART 0 |
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.
Does resetting SYS_AUTOSTART to 0 actually accomplish anything or should we just leave it alone to keep things simple (development workflows, avoiding unnecessary resets jumping between versions, etc)?
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.
Resetting it to zero flags that the autostart wasn't loaded. When I talked to @bkueng he was stressing that this should be retained for the case someone updates but the airframe he used is gone from the new version. I remember I was once glad that I saw the ID go to zero in one of my tests. Not sure if that couldn't be solved even more user friendly e.g. by messageing the user that there's no airframe with the ID but not changing the parameter.
For reference this was introduced here: https://github.com/PX4/PX4-Autopilot/pull/13772/files#diff-c0c83e328e28cbd2f7c7ad46bbb6369024ed63daa3f9dc8cf89ac79125183e1dR82
I did not change it but am open to discussion. I feel it's more accessible to change now.
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'm okay with the change to always check both ROMFS and SD card, cannot think of a workflow that would break with it. And I like that we remove the >1000000 condition, that seems to me an unnecessary complication based on a random threshold.
479c452
to
90bb4d9
Compare
Thanks for reviewing! The only thing I changed is adding this comment to clarify the step in the |
Solved Problem
When updating a vehicle configuration I had the requirement to not change the startup ID (
SYS_AUTOSTART
) but want to move the airframe file from the SD card to ROMFS.Of course I can just remove the logic to load any airframe from the SD card from that vehicle but that would make that part custom. While going through what prevents the current logic from achieving the goal I stumbled across the number partitioning of external airframes needing to have numbers > 1'000'000 which was already talked about here: #18459 (comment) I talked with @ThomasDebrunner about why there's no fallback for looking for airframes in the currently available two locations ROMFS and SD card except for when the SD card is completely missing.
Solution
My proposal is to look for airframes first in ROMFS and then on the SD card independent of their numbering. The error handling for the case where no airframe was found is moved outside of the generated
rc.autostart
.Changelog Entry
Alternatives
We could also swap the priorities to look first on the SD card and then in the ROMFS. I'm not a fan of this because:
Test coverage
I tested this on a vehicle with fmu-v5x. Like expected if the corresponding airframe is available in ROMFS it's loaded with priority
with the message
Loading airframe: /etc/init.d/airframes/000_XXX
, if it isn't part ofrc.autostart
in ROMFS it's loaded from the SD card with only the message that's part of the SD card autostart file. And if there is no matching airframe you get the errorERROR [init] No airframe file found for SYS_AUTOSTART value
andSYS_AUTOSTART
is reset to the value 0.