I'm using KinematicTrajecotyOptimization
. I want to update the coefficients for some constraints and then resolve the problem. Some of the constraints can be updated because they are LinearConstraint
, but others can't be updated because they are Constraint
which does not have API like UpdateCoefficients
. For example the constraints 1 and 2 in the following code:
trajopt = KinematicTrajectoryOptimization(...)
goal_constraint = PositionConstraint(...)
trajopt.AddPathPositionConstraint(goal_constraint, 1) # constraint 1
dq_constraint = LinearConstraint(...)
trajopt.AddVelocityConstraintAtNormalizedTime(dq_constraint, 0) # constraint 2
It seems updating coefficients of goal_constraint
is not effective.
You're right. The PathConstraint
in use here makes a copy of the bounds of the wrapped Constraint
, so any further updates to the wrapped constraint's bounds will be ignored.
If this is in Python, possibly you can figure out a way to identify the PathConstraint
in the list of trajopt.get_mutable_prog().generic_constraints()
and call set_bounds
on that object.