Skip to content
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: Vehicle model estimator (onboard mass & inertia estimation) #13585

Closed
wants to merge 15 commits into from

Conversation

jlecoeur
Copy link
Contributor

(This PR is based on #13219)

It implements the estimation of the vehicle mass and inertia matrix.

To estimate the vehicle inertia, the estimator low-pass filters and computes the time derivative of the vehicle angular acceleration and of the vehicle torque setpoint, then applies a least-mean-square.
Similarly, to estimate the vehicle mass, the estimator low-pass filters and computes the time derivative of the vehicle acceleration and of the vehicle thrust setpoint, then applies a least-mean-square.

This module can be used to estimate the vehicle parameters offline. I would not use its estimate in the controller, at least for now.

FYI @bresch

@mhkabir
Copy link
Member

mhkabir commented Nov 24, 2019

Is it not easier to just weigh a vehicle accurately offline (instead of estimating mass online)?

@jlecoeur
Copy link
Contributor Author

@mhkabir yes for sure, yet I see a few reasons to do it online:

  • if the mixer/allocator is not tuned properly (which is definitely not the case today with the normalized mixers), then vehicle_torque_setpoint and vehicle_thrust_setpoint will not be in the correct units. The mass you measure offline on a scale will not be equal to the mass estimated online.
  • inertia is much more complex to measure offline than mass. If we already estimate inertia, it is relatively cheap to also estimate the mass
  • if this is reliable enough, you can use the mass estimate in the velocity controller and the inertia estimate in the rate controller, thus have a self-tuning drone
  • even if the estimate is not directly fed into the the controllers, you can check its value in a log and refine the tuning manually

@CarlOlsson
Copy link
Contributor

Just curious, if you estimate the inertia based on a torque setpoint and measured angular acceleration, then you assume that the applied torque equals the torque setpoint right? Do you get this from a model of the drivetrain and vehicle dimensions etc?

@dagar dagar self-requested a review November 25, 2019 15:00
@jlecoeur
Copy link
Contributor Author

@CarlOlsson that is the idea yes.
The drivetrain and geometry models exist since #8063. They are used to generate the multirotor mixers. Unfortunately, the actuator_controls did not have units, so the mixers are normalized. I am now trying to get proper units in the torque and thrust setpoints with #13219 and #13351.
Even without proper units the estimation of inertia and mass will be useful to tune the controller. Let's say the normalized torque is in unit U instead of N.m, then the estimated inertia will be expressed in U/(rad.s^-2) instead of N.m/(rad.s^-2) (=kg.m^2). Similarly, let's say the normalized thrust is in unit V instead of N, then the estimated mass will be expressed in V/(m.s^-2) instead of N/(m.s^-2) (=kg).

@stale stale bot added the stale label Feb 23, 2020
@stale stale bot added the stale label May 23, 2020
@PX4 PX4 deleted a comment from stale bot Oct 15, 2020
@stale stale bot removed the stale label Oct 15, 2020
@PX4 PX4 deleted a comment from stale bot Oct 15, 2020
@jlecoeur
Copy link
Contributor Author

This PR has been open for a long while without activity. I am closing now.

@jlecoeur jlecoeur closed this Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants