-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Separate out FlightTasks from position control module #14665
Conversation
008fa29
to
bae937d
Compare
@dagar So far, so good. First focus was to get it working in general. I know
|
ac5eeb7
to
fe2ccc8
Compare
fe2ccc8
to
1e56540
Compare
4c43c48
to
3214dd7
Compare
I rebased on master now. Let's finish this and push it through before getting huge conflicts. |
|
3214dd7
to
d6db09c
Compare
@dagar @MaEtUgR I've been looking at adding the first simple fixed wing flighttask into this architecture. Tasks like LOITER and ORBIT are relatively simple to introduce but would already help cleaning up a lot in navigator. Imagine the entire reposition crap vanish. Now, in the current flighttask architecture the interface from a flighttask to the controller is the trajectory_setpoint_message which is of type (vehicle_local_position_setpoint_s). This message was clearly designed for use by the multicopter position controller and not the fixed wing position controller. The fixed wing L1 controller currently has the following API:
While the setpoint is given in global WGS84 coordinates, internally the controller calculates local planar vectors, which are 2D vectors in a local frame. Thoughts? |
@RomanBapst Sounds great, thanks for your input and work on fixed wing support!
Create a new one if necessary. We should not repurpose existing messages anymore like triplet and position setpoint. I'm happy to discuss the best content.
I would use local coordinates for the controller and deal with global frame(s) in the setpoint generation to make the controller lean, understandable and modular with a clear interface. |
@MaEtUgR Cool, thanks for your input. I think we are aligned. |
d6db09c
to
d8dc27d
Compare
@MaEtUgR @dagar I rebased on top of master and tested in SITL both quad and vtol. I did not see any issues which don't occur on master. |
to separate out setpoint generation from controllers
I had to do an extra subscription to the vehicle attitude. I don't know how to test this.
This information could also be used for yaw and integral resets of the lower level controllers.
Signed-off-by: RomanBapst <bapstroman@gmail.com>
d8dc27d
to
9e2e096
Compare
Rebased on master (now with enough flash!). |
} | ||
|
||
_old_landing_gear_position = landing_gear.landing_gear; | ||
|
||
} else { | ||
// reset the numerical derivatives to not generate d term spikes when coming from non-position controlled operation | ||
_vel_x_deriv.reset(); |
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 looks wrong (resetting if trajectory_setpoint
didn't update). Given the module is scheduled on vehicle_local_position
publications we should probably be resetting it if the module itself hasn't run for a while and you might as well check vehicle_local_position.v_xy_valid
as well.
I'd still like to consider filtering and publishing the control data externally so that we always have exactly what was being used.
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.
Yes, the intention was to not change too many things which gets non-rebasable/-reviewable. Originally this wasn't wrong since the position controller ran when a flight task ran and therefore the derivative had to start again when the position controller ran the next time. With this pr the assumption stays but it's certainly not the best way anymore to probe for the case and also the possible cases may change in the future.
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.
It should be fine for now if the current expectation is that a flight task will publish a trajectory_setpoint
for every single consumed vehicle_local_position
and both flight_task_manager
and mc_pos_control
are running at the same limited rate.
Describe problem solved by this pull request
The FlightTasks library was designed to separate the core multicopter position control from the position, velocity, acceleration setpoint generation to fulfill various tasks. The separation hepled a lot in terms of modularity and debuggabilty and the main data flow is through generated message structs like
vehicle_local_position_setpoint
(,vehicle constraints
,landing_gear
) but the two pieces are not completely separate. The FlightTasks library is technically still inside the position control module. Also there are certain dependencies e.g. for landing takeoff limiting and similar cases that still lead to unexpected problems every now and then.Describe your solution
I strated seprating out the FlightTasks library to live in a separate module that I called
flight_mode_manager
with the plan of the Navigator Architecture planning in mind that we aim towards having flight mode classes like flight tasks for all setpoint generation in the future. It's unfinished and I'm trying to separate certain dependencies in a good way to be able to cut a clear line between the modules.The main pain points so far are:
EDIT: This has to be solved in a idfferent pr but I made sure it's no blocker anymore here.
EDIT: This has to be solved in a idfferent pr but I made sure it's no blocker anymore here.
EDIT: This has to be solved in a idfferent pr but I made sure it's no blocker anymore here.
Test data / coverage
SITL flies no. Testing for correct takeoff ramp and so on still pending.
Additional context
Discussed starting point from https://docs.google.com/document/d/1N59JHFqL_E9X4b-U0CzxW_eydqXUHZMxAH_FTD30ilk/
Bigger picture tracked in https://github.com/PX4/Firmware/projects/34