-
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
[WIP]: Rate control: introduce torque_setpoint, angular_accel_setpoint, and inertia matrix #13219
Conversation
One possibility I'm going to consider (if we ever manage to kill off DriverFramework - #12783) is moving the filtering to vehicle_angular_velocity and vehicle_acceleration rather than in each driver (we only need it for the primaries). Newer drivers using FIFOs (arrays of 4 or 8 raw samples) can publish that data to process downstream (#13103). I mention this now because it might be worth considering using that raw data to compute angular acceleration. Related comment from @priseborough - PX4/PX4-ECL#621
|
ca12fbb
to
4627455
Compare
4627455
to
7b76dc6
Compare
7b76dc6
to
ed1b270
Compare
This may be useful for a satellite but seems not to be very necessary for the micro air vehicle. The reason is two-fold: how to measure the accurate inertia matrix; how to adapt this concept for multiple kinds of frames. I think this point is more worthy of consideration when a system identification is taken into account. By then the inertia matrix can be approximately obtained. |
Hi @zarathustr, thanks for the comments. I do not agree that this is useless for small UAVs. There were numerous requests for proper units in the controller outputs. Also, there are systems with varying mass and inertia, like delivery drones, that are now being tested or even used in production and that could benefit from an inertia model. Regarding the system identification, I gave a simplified example, but there are much more advanced and accurate techniques available. Finally, you should not worry if you do not want/need or know the inertia of your robot because this is opt-in: the default inertia matrix is identity and thus has no impact. |
6e0e577
to
09bac11
Compare
I cherry-picked commits from #13351 Let's try to get this in before it rots. @RomanBapst can you check that the toque_sp and thrust_sp publication in FW and MC controllers is the same as what you have tested this morning? |
5938070
to
c05d0f4
Compare
50b1bb1
to
2f392db
Compare
fmu-v2's flash overflows by 3437 bytes after a rebase to master :-( There is not much left to remove on fmu-v2. I removed px4flow and pwm_out_sim, which is not great. |
2f392db
to
22902da
Compare
…tem identification
d35d853
to
e85fdb7
Compare
Holding this off for now, until work has progressed in #13351 |
I'm closing this as stale - please open a new rebased PR. Thanks! |
This is a first step towards more unit-aware controllers.
As of now, the output of the rate controller does not have unit (this is a normalized torque setpoint). Although this makes things simple and has always worked like it, this has a few limitations:
I introduced several new things in this PR. I would like to hear your opinion on a few additions. (Note that with the default parameters, it should not break anything.)
@dagar I did this in the sensor module although it is not a real sensor because I think this can be useful for more things than the MC controller, it is disabled by default.
@MaEtUgR we may use this data for the D term in the rate controller instead of computing the derivative inside the controller. This may save some computation in VTOLs because both the MC and the FW controller compute rate derivatives.
vehicle_angular_acceleration_setpoint
,vehicle_thrust_setpoint
,vehicle_torque_setpoint
topics, with proper units.Eventually this could be moved into a separate module. Either MC or FW or VTOL controller would publish an angular acceleration setpoint and a feedforward torque setpoint. The new module would subscribe to these topics and then compute a torque setpoint based on its model of the vehicle.
I use the P and D term to generate an angular acceleration setpoint, which is later mapped to torque via the inertia matrix. The integral and feed-forward terms are directly generating torque values (called torque_feedforward).
If the I term was used to generate acceleration setpoints, you would have -- for an unbalanced system in equilibrium -- a steady-state angular acceleration setpoint, which does not make sense.
From there, I multiplied the P and D rate gains by 120 (roll), 120 (pitch) and 35 (yaw), and divided the inertia by the same amount.
This way the behaviour is not changed, but units are now OK (see on the graphs below how the angular acceleration somewhat matches the angular acceleration setpoint). I obtain this during steps on roll, pitch and yaw:
The values of 120 and 35 were not chosen arbitrarily, we can in fact estimate them.
From a gazebo log, we can compute the time derivative of the vehicle angular acceleration and of the torque setpoint:
A quick eye fit gave me the inertia matrix
Let me know your opinion, shoot!