leggedrobotics / ocs2

Optimal Control for Switched Systems
https://leggedrobotics.github.io/ocs2
BSD 3-Clause "New" or "Revised" License
874 stars 225 forks source link

friction cone rotation matrix #88

Closed graiola closed 10 months ago

graiola commented 11 months ago

Hi, first I would like to thank you for this amazing framework. I have a question, is it possible to change the rotation matrix in the friction cone constraint? I have been trying to change the matrix online but it looks like I can not access the constraint object inside the solver. Thank you in advance.

IoannisDadiotis commented 11 months ago

Hi Gennaro,

As a user of the library I would say one possible way to go can be similar to NormalVelocityConstraintCppAd in the legged robot example. You can take a look in the lines below: https://github.com/leggedrobotics/ocs2/blob/164c26b46bed5d24cd03d90588db8980d03a4951/ocs2_robotic_examples/ocs2_legged_robot/src/constraint/NormalVelocityConstraintCppAd.cpp#L68-L69 This constraint is configured by accessing member variables of the LeggedRobotPreComputation object, which are updated in LeggedRobotPreComputation::request. Maybe you could do something similar for the friction cone constraint.

graiola commented 10 months ago

The solution is a bit convoluted but it works! Thank you @IoannisDadiotis :)