-
Notifications
You must be signed in to change notification settings - Fork 401
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
base: devel
Are you sure you want to change the base?
Momentum regressor #2411
Conversation
Hi ! This project doesn't usually accept pull requests on the main branch. |
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.
👋 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.
Hi, @lvjonok, I am very interested in your work! May I ask a few questions here?
I appreciate your response in advance! |
Hello @Cfather, unfortunately some of your equations didn't display properly, but I will try to address your questions!
I think I better rename this variable.
Thanks for your interest! Hope I have answered the questions! |
Hi, @lvjonok Thanks a lot for your quick response! Could I ask a few follow-up questions:
Again, I appreciate your help in advance! |
If you are interested in system identification and adaptation algorithms development and research, I think we can get in touch and discuss more! I am open for collaboration! |
Hi, @lvjonok , I have tried to generate a unit test for
Please let me know if there're any issues in this unit test. I appreciate your review in advance! |
Thanks! I will look into this in a couple of days! |
Nice work here, guys! I wanted to offer a quick comment regarding how you might broaden the use cases for these algorithms. I understand that the motivation for this algorithm comes from the fact that, when working with generalized coordinates, the generalized momentum satisfies: However, you can show with a little work that: In this regard, the generalized momentum evolves as: This expression for In this respect, I think it could broaden the use cases if you instead provide the regressor |
Thanks for this comment! I really appreciate you explaining the concept from this perspective. My initial motivation was that derivation of |
I am still in the process of investigation, but one thing I have figured out is However even with this changes I was not able to successfully fix your proposed test. I have reached something like:
Which is closer, but I will look more. |
I want to thank @pwensing for a great suggestion about implementation of indirect regressors rather my proposed approach. It really makes sense and I was able to successfully transfer the implementation to my PR. I have struggled for some time and you can see it by comments where I was discovering the correspondence between notation in spatial_v2 and pinocchio, but unittests are passing! As the next step, I will provide python bindings and a small example with system identification to showcase how regressors can be used! |
const Eigen::MatrixBase<ConfigVectorType> & q, | ||
const Eigen::MatrixBase<TangentVectorType> & v); | ||
|
||
template< |
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.
Hi, could you please add a comment to explain the mathematical meaning of computeIndirectRegressors?
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 think there is no mathematical meaning behind. It is just that the function in Wensing's implementation had this comment:
function [Y_Hqd, Y_CTqd, Y_Hqd_rot, Y_CTqd_rot] = Regressor_HqdandCTqd( model, q , qd)
% Indirect regressors term YHqd a = H qd and YCTqd = C^T qd
/// of momentum and transposed coriolis matrix times velocity. | ||
/// | ||
/// These regressors are such that: | ||
/// \f$ p = Y_Hqd(q, v) \pi$ and \f$ C^T v = Y_CTqd(q, v) \pi \f$ |
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.
Just a very small nitpicking: does this include the gravity vector?
Like, should this be \f$ C^T v - g = Y_CTqd(q, v) \pi \f$
?
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.
No, it does not include gravity. In sysid example I provide a complete comparison and matching of these terms: https://github.com/stack-of-tasks/pinocchio/pull/2411/files#diff-de29e11f15faef229b4e025cc6c9f09af5d32c5268973e47484fc0b08afa6d77R154-R165
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:
Next, we consider the derivative of the momentum:
For system identification, we can construct the following equation:
Changes Introduced in the PR
In my PR, I have augmented the
data
structure with two members:data.momentumRegressor
anddata.dpartial_lagrangian_q
. These fields will be populated after the call tocomputeMomentumRegressor
.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. 😊