In nudge obstacles topic,i want set a variable constraints to match the obstacles edges. could you tell me how to set a variable constraints?
thank you very much!
could you help me?
thanks
have you looked into parameters? https://discourse.acados.org/t/how-to-set-weights-of-costs-according-to-the-time-interval-in-mpc-prediction-horizon/1001/3 Does this match your problem?
ok,thanks for your reply!
but my quesetion is “how to set a variable constrains for one x”
for example:
in first shoot, the constrain for x[0] is [-3, 3],
in secend shoot, the constrain for x[0] is [-2,2].
could you tell how to set it ?
thanks!
Am I right that you want to set variable constraints (different for each shooting node) for a part of your state vector x?
You can do this with the .set() method of the ocp-solver object whilst working with parameters as constraint variables.
Heres a quick example:
# set constraints in init phase
p_lb = cs.SX.sym('p_lb')
p_ub = cs.SX.sym('p_ub')
ocp.constraints.lb = [1, 1, p_lb, 1]
ocp.constraints.ub = [5, 5, p_ub, 5]
ocp.model.parameter = cs.vertcat([p_lb, p_ub])
...
# set parameter p_lb and p_ub in control cycle
param_values = [ [1, 1], [2, 2], [3, 3], ..., [n, n]]
# set parameter values (which define constraints for x2) for each node
for n in range(N):
ocp_solver.set(n, 'p', param_values[n])
this is just a short example that should suit your needs. You have to dive deeper into how to formulate those parameters of course ![]()
yeah!
Thank you very much. This has solved my problem!
and I have found a new problem. Would it be convenient for you to reply