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

Momentum regressor #2411

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open

Momentum regressor #2411

wants to merge 4 commits into from

Conversation

lvjonok
Copy link
Contributor

@lvjonok lvjonok commented Sep 9, 2024

Hello Pinocchio Team!

I have previously contributed kinetic and potential energy regressors, which are useful for system identification and adaptation. Now, it is time to extend this with momentum regressors.

Derivation Overview

Below is a quick derivation to support my code:

  1. The mass inertia matrix in regressor form can be expressed as:

$$ M(q)\dot{v} = Y(q, 0, \dot{v})\pi - Y(q, 0, 0)\pi $$

  1. The momentum of the system in regressor form can be written as:

$$ p = M(q) v = \frac{\partial L}{\partial v} = Y(q, 0, v)\pi - Y(q, 0, 0)\pi = Y_p(q, v) \pi $$

Next, we consider the derivative of the momentum:

$$ \dot{p} = \frac{d}{dt} \left( \frac{\partial L}{\partial v} \right) = \frac{\partial L}{\partial q} + Q $$

For system identification, we can construct the following equation:

$$ (Y_p(q_2, v_1) - Y_p(q_1, v_1)) \pi = \int_{t_1}^{t_2} \left( \frac{\partial L}{\partial q}\frac{\partial q}{\partial \theta} \pi + Q \right) dt $$

Changes Introduced in the PR

In my PR, I have augmented the data structure with two members: data.momentumRegressor and data.dpartial_lagrangian_q. These fields will be populated after the call to computeMomentumRegressor.

I am looking forward to your review and am open to any questions or comments!

Additionally, I am excited to gain experience writing C++ code. If there are any changes needed, I would prefer to make them myself rather than having you do it, as it would be a great learning opportunity for me. 😊

@hrp2-14
Copy link

hrp2-14 commented Sep 9, 2024

Hi ! This project doesn't usually accept pull requests on the main branch.
If this wasn't intentionnal, you can change the base branch of this PR to devel
(No need to close it for that). Best, a bot.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi,
This is a reminder message to assign an extra build label to this Pull Request if needed.
By default, this PR will be build with minimal build options (URDF support and Python bindings)
The possible extra labels are:

  • build_collision (build Pinocchio with coal support)
  • build_casadi (build Pinocchio with CasADi support)
  • build_autodiff (build Pinocchio with CppAD support)
  • build_codegen (build Pinocchio with CppADCodeGen support)
  • build_extra (build Pinocchio with extra algorithms)
  • build_mpfr (build Pinocchio with Boost.Multiprecision support)
  • build_sdf (build Pinocchio with SDF parser)
  • build_accelerate (build Pinocchio with APPLE Accelerate framework support)
  • build_all (build Pinocchio with ALL the options stated above)

Thanks.
The Pinocchio development team.

@lvjonok lvjonok changed the base branch from master to devel September 9, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants