Closed sm3304love closed 5 months ago
I see you set in_con(index++) = 0 - slack; // 0 <= slack
, which should force the slack to be positive, but then in_con(index++) = -min_distance + 0.1 + slack;
. If the slack is forced to be always positive, this does not make the constraint softer; it's forcing the robot to stay farthest from the obstacles.
Given such a soft constraint, I expect the slack variable to reduce the 0.1 safety margin, but as you state the problem, it's working exactly in the opposite direction.
I found out what I did wrong. thank you
I have another question about Slack variables.
The argument type of the Slack variable in the callback function is double. What if I want to use slack variables in more than one inequality constraint?
You can use it, but it’s value will result in a trade off to make your problem feasible among multiple constraints.
hello. I'm trying to implement soft inequality constraints using slack variables. Using inequality constraints, the slack variable will always be set greater than 0, but if an obstacle approaches the robot within the safety margin distance, the slack variable within the
setIneqConFunction
function will be negative.Below are the
setIneqConFunction
function andsetObjectiveFunction
function that use slack variable.How can I solve this problem?