-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[autopilot] compiling generated AP for fixedwing #2055
Conversation
@gautierhattenberger so does the generated code works the same way as the static autopilot? Or is this more like a partial PR with full functionality coming later? Looks like most of the PR is about renaming the autopilot modes and some refactoring, which looks good. |
I couldn't test it in real flight yet, but this description of FW autopilot should exactly match the behavior of the static version. Maybe the refactoring can be improved, but the general idea is here. |
I think Also some airframe files probably need to be updated for this change of name (when Question is if we want to make backward compatible defines for that or announce it on the mailing list.. Otherwise it looks good to me, although I have no time to test right now... |
all this guidance code should really be better factorized
I need a bit more time to finish tests with real aircraft, but it should be ready soon. Better do some more things even if it shouldn't break the standard configuration. |
@gautierhattenberger A few use-case comments: If I add to my airframe config:
and
the build will fail with:
in both AP and NPS targets. I have to have
but it is cumbersome because Tested with Minion Lia (fixedwing) and works fine in simulation, as well as in HITL. It doesn't compile for rotocraft (tested with Ark_Quad under AggieAir conf), fails with:
which I believe is something from the flight plan. And again, I have to both specify
and
|
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.
See my comment above.
I fixed the rotorcraft autopilot who was not using correctly the new autopilot API. |
@gautierhattenberger just to clarify - the confusing case is that if I want to use the generated autopilot, I have to specify both I would prefer if either I had to always define
or
where static would be the default option in case |
As for rotorcraft autopilot- I tested it in NPS and for some reason the generated autopilot cannot get off the ground. I am using I end up in |
Now, the generated autopilot is used when an autopilot is defined in the airframe file. The simulation for rotorcraft should work again as well. |
Indeed it works now! One comment - I noticed that for rotorcraft I have to change Otherwise the only missing thing is the documentation. Do you want to merge as is and do the docs/wiki page later, or should we wait till it is a whole package? |
The reason it fails is because your airframe file is most likely defining Regarding the documentation, I would prefer to split the two things. I'm very busy so I won't have much time to do it soon, and when things last for too long, solving merge conflicts is endless. |
Extra practical question: at the moment, the |
I think it makes most sense to have the autopilot selection as a part of firmware - so you can choose only one type of autopilot per firmware. Having lower granularity (e.g. one autopilot per target imho doesn't make sense). And having one autopilot per airfame probably is probably too much - because if you have a test firmware, it doesn't need to know about the autopilot you want to use. But I am happy with it as is, so it is up to you. |
The autopilot can be specific to one of the firmware, or one of the target. At the moment, it will fail at runtime if more than one autopilot in the same airframe since server don't know which target is in use.
Finally, I made the autopilot node available at all level, but for now, only one per airframe is allowed, otherwise it will fail at runtime. Solving this is possible but needs some work and can be done later. |
* [autopilot] compiling generated AP for fixedwing * update some old variable names for autopilot mode * prevent oscillation on the ground with real aircraft * add guidance loop to 'new' control all this guidance code should really be better factorized * fix rotorcraft autopilot for new API * read guidance RC if needed * use generated autopilot as soon as an autopilot file is defined * autopilot node at airframe, firmware or target level The autopilot can be specific to one of the firmware, or one of the target. At the moment, it will fail at runtime if more than one autopilot in the same airframe since server don't know which target is in use.
Config file is updated to compile and is tested in simulation. At the moment, the same mode names are used and it may not behave correctly otherwise due to some hard-coded tests. Adding new modes might works thought.
One of the main changes is the modification of the AP mode name to match the rotorcraft firmware. It makes the code generation easier.