-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Costs Analogous to, e.g., MinimumDistanceLowerBoundConstraint #21989
Comments
Does it? As far as I can tell, it is only a constraint |
I may be misunderstanding the documentation of what the penalty function is doing -- I assumed that this described how the cost is affected when the constraint is almost active. But whether or not this constraint also adds a cost, I would like to be able to add a cost based on the minimum distance to an obstacle. |
Sounds good. I should also broadcast the current work-around suggestion from slack: use the |
Assigning @hongkai-dai per platform reviewer checklist. |
@cohnt What is the mathematical formulation of your cost? Let's say it is a function of the minimal distance |
@cohnt could you try this code snippet? min_distance_constraint = multibody.MinimumDistanceLowerBoundConstraint(plant, plant_context, bound=0)
# min_distance_constraint.Eval() computes ϕ(d/d_influence − 1)/ϕ(−1), where d is the minimal distance, and ϕ() is the penalty function.
# To maximize the distance, we want to minimize ϕ(d/d_influence − 1)/ϕ(−1), because ϕ() is monotonically decreasing.
prog.AddCost(lambda q: min_distance_constraint.Eval(q), q) You might need to play with the |
MinimumDistanceLowerBoundConstraint adds a constraint that requires the distance between pairs of geometries be at least a certain quantity, but it also adds an objective cost that penalizes being close to that quantity. It would be useful to me if I could just add the associated cost, but not the constraint. That way, I can bias trajectories or IK problems to avoid obstacles, without adding nonconvex constraints.
cc @shrutigarg914
The text was updated successfully, but these errors were encountered: