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

Need ObjectiveFcn.MAYER.TRACK_CONTACT_FORCES #791

Closed
Alpha2Shahiri opened this issue Nov 3, 2023 · 4 comments
Closed

Need ObjectiveFcn.MAYER.TRACK_CONTACT_FORCES #791

Alpha2Shahiri opened this issue Nov 3, 2023 · 4 comments

Comments

@Alpha2Shahiri
Copy link
Contributor

I'm currently working on a specific phase and require to track the values of the forces. I noticed that ObjectiveFcn.Lagrange.TRACK_CONTACT_FORCES exists. However, for my project's needs, I require ObjectiveFcn.MAYER.TRACK_CONTACT_FORCES. Can this functionality be added or is there an alternative approach I should consider?

@pariterre
Copy link
Member

Dear @Alpha2Shahiri,
By virtue of the fact that Forces are node parameters, the integration performed for the Lagrange objectives is only different from the Mayer objectives by a constant factor. Meaning they are effectively equivalent for the forces if the weight is adjusted.

Also, a force without integration does not really make sense as the only effect of a force is solely reflected on the q and qdot state parameters. What are you trying to accomplish by needing a Mayer objective?

@Alpha2Shahiri
Copy link
Contributor Author

Thanks for your answer. I would like to track specific force profile in a phase (pianist key reaction force profile). I used Lagrange and seems the contact forces are tracking that values. To clarify, the Lagrange Objective Function accumulates costs throughout the entire duration, while Mayer addresses costs at distinct times. Given I'm working with a specific profile, it seems Mayer is the appropriate choice and I will make the changes.

@pariterre
Copy link
Member

Again, assuming you are solving using the Ipopt solver, if you are tracking forces accross all the phase, then Mayer and Lagrange are strictly equivalent near to a factor (corresponding to the delta time). The be more precise, the way Mayer is implemented is actually the same than Lagrange but assumes a delta time equals to 1. In that sense Lagrange does not accumulate the objectives, it is separately computed at each shooting node. So declaring Mayer objective at each shooting node or using a Lagrange is almost the same.

Please note that using a Mayer to declare a value at the last node does not make sense for the forces.

@pariterre
Copy link
Member

#797

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

No branches or pull requests

2 participants