-
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 generated integration #1975
Conversation
By default the original static autopilot is used. A config flag can enable the use of the generated AP code. A basic autopilot description is provided (4 modes + failsafe modes). The server is capable of using the list of generated mode to properly display mode names. Tested in NAV and GUIDED mode in sim, and direct attitude control on real aircraft.
@gautierhattenberger in the case of autopilot generated modes, will there be a mechanism for finding mode/behavior indexes/offsets? For example, in the current static definition, 13 decimal is NAV and 19 decimal is GUIDED. Given that they are currently static, I use those values when binding behavior via the Flying Robot Commander. What's the plan for obtaining dynamic mode information for binding purposes? |
For now, you have to get the xml file (from the airframe file) to know the list of modes. This is how I get them for the server. For you FRC, one solution is to do the same, or if you only need a limited number of extra functionalities, we could consider adding them to the system, like changing a mode based on its name rather than its index. |
#include "subsystems/commands.h" | ||
|
||
/** Set descent speed in failsafe mode */ | ||
#ifndef FAILSAFE_DESCENT_SPEED |
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.
This should either be set here or in the C files, not on both locations...
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.
done
@@ -127,4 +145,25 @@ extern bool guidance_v_set_guided_th(float th); | |||
guidance_v_z_sum_err = 0; \ | |||
} | |||
|
|||
#define GuidanceVSetRef(_pos, _speed, _accel) { \ |
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.
Is this really needed in the header?
I would rather put this and guidance_v_z_enter
in the c file...
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.
yep, old stuff I forgot there
Regarding the syntax of the autopilot xml file:
|
<control freq="32"> | ||
<mode name="NAV" start="guidance_h_nav_enter()|stabilization_attitude_enter()|guidance_v_z_enter()"> | ||
<select cond="RCMode2() && DLModeNav()" exception="HOME"/> | ||
<control freq="NAV_FREQ"> | ||
<call fun="nav_periodic_task()"/> |
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.
So in the generated version nav_periodic_task
is now only called in NAV mode, whereas in the static version it is always called (except if you are in HOME mode).
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 was just lazy, I can add it again, as long as guidance is not set from nav it's fine
For the I don't mind changing |
Not sure what a good name would be here, but I don't like that we use the same keyword as in the flight plan, but with different behavior. |
Also maybe rename |
@gautierhattenberger with respect to getting a limited modes set from all modes in an autopilot, the ability to get mode by name seems like a nice feature. We just have to manage the mode name space and keep it consistent for modes across all autopilots. That seems reasonable. |
…nterface It can makes it easier to handle generated autopilot. Names are not matching exactly, but this can be improved in the future. An example is provided with gb2ivy program.
@hooperfly I have added a function to fill the value index based on the 'values' list of a setting. It can makes it a bit easier to access modes. This could be improved in the future by choosing the same name and case for static and generated autopilots. |
Do you think this is fine to merge ? It should not change anything for regular users at the moment. |
Except for the different semantics of |
Maybe the problem is FP naming after all ( Otherwise I'm suggesting for autopilots:
|
Yeah, naming is hard... e.g. |
I think the best here is |
support generated autopilot, based on rotorcraft firmware
Some extra features:
--norc
option to NPS simulator