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

Add the possibility to pass a reference DCM trajectory to the DCMPlanner #208

Merged
merged 8 commits into from
Feb 25, 2021

Conversation

GiulioRomualdi
Copy link
Member

@GiulioRomualdi GiulioRomualdi commented Feb 24, 2021

With this PR it will be possible to pass a desired reference DCM trajectory to the DCMPlanner. The trajectory will be used as a regularization term.

In details it introduces the optional parameter use_external_dcm_reference. If set to true the user should call setDCMReference() to set the desired DCM reference.

The python bindings have been updated and they already implement this new feature.

I checked the output of the planner with the already existing code and this is the planned trajectory

dcm

cc @paolo-viceconte @diegoferigo

Copy link
Collaborator

@prashanthr05 prashanthr05 left a comment

Choose a reason for hiding this comment

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

Minor comments. In general, looks good to me.
But it's better to get an opinion from a Casadi user as well.

Comment on lines 394 to 402
this->opti.subject_to(
vrp(2, k) - 9.81 / (casadi::MX::pow(omega(Sl(), k), 2) - omegaDot(Sl(), k))
== contactPhaseListIt->activeContacts.begin()->second->pose.translation()[2]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we define a placeholder for -9.81?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we define a constant somewhere, let's use the internationally agreed standard CODATA2018 of 9.80665 https://physics.nist.gov/cgi-bin/cuu/Value?gn

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmmh ok where?

Copy link
Member

Choose a reason for hiding this comment

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

I would expose this value in some way. Often when debugging I personally use and simulate with -10.0 and it would be great at this point if this parameter can be exposed to the user. Note that the initial omega included in the initial state and passed to setInitialState is typically computed by the users using their value of g. If, then, internally another value is hardcoded, it could get funky results.

As a matter of facts, I remember in the past changing the value to something different than 9.81 and the optimization was failing. I didn't delve into further details at that time. I'm not saying it was related to it, but it rang a bell in my memory.

Copy link
Collaborator

@traversaro traversaro Feb 25, 2021

Choose a reason for hiding this comment

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

Yes, those are two different aspects:

Copy link
Collaborator

@prashanthr05 prashanthr05 Feb 25, 2021

Choose a reason for hiding this comment

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

As a matter of facts, I remember in the past changing the value to something different than 9.81 and the optimization was failing. I didn't delve into further details at that time. I'm not saying it was related to it, but it rang a bell in my memory.

In my experience, I have faced such issues as well. While integrating system with 9.80665 in one place and using 9.81 in another place, by choosing a big value for sampling time introduces errors easily into the estimator/controller.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ops I've just noticed #208 (comment) I created a new component. Now I ever the changes to follow what @traversaro suggested in #208 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think also what you did is perfect, no need to change to do exactly what I said.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I opened an issue #210 to propagate the use of gravity constant in the rest of the codebase. No need to do it in this PR tough.

Copy link
Member Author

@GiulioRomualdi GiulioRomualdi Feb 25, 2021

Choose a reason for hiding this comment

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

Here I am! I introduced BipedalLocomotion::Math::StandardAccelerationOfGravitation a4af4be I exposed it in python 94e84fc

I finally introduced the gravity parameter in TimeVaryingDCMPlanner a24da91. It's optional and if the user does not set it BipedalLocomotion::Math::StandardAccelerationOfGravitation is used

src/Planners/src/TimeVaryingDCMPlanner.cpp Outdated Show resolved Hide resolved
@GiulioRomualdi GiulioRomualdi force-pushed the dcm_planner/additional_input branch 2 times, most recently from 7570ccf to 995b5c3 Compare February 25, 2021 10:22
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.

4 participants