Acados MPC control input not bounded to the set constraints

Hello everybody :wave:

I am currently developing a quadrotor MPC, for now just the outer loop (position control) while the inner loop is managed by a PID controller.

I set the constraints like so in the OCP formulation:

        # Control constraints
        ocp.constraints.lbu = np.array([-1, -1, - Tmax / m])
        ocp.constraints.ubu = np.array([1, 1, Tmin / m])
        ocp.constraints.idxbu = np.array([0, 1, 2])

They are repeated when I launch the ROS2 node which uses the solver. The control input is the acceleration in the NED frame (I am working with PX4 autopilot).

        lbu = np.array([-1, -1, - Tmax / m])
        ubu = np.array([1, 1, Tmin / m])

        self.solver.constraints_set(0, 'lbu', lbu)
        self.solver.constraints_set(0, 'ubu', ubu)

The problem is that, especially the constraints related to X an Y, are not respected by the MPC. I am able to see the output of the solver since I have to convert it to thrust and reference quaternion, and it sometimes keeps giving 20 m/s^2 instead of 1 m/s^2. Instead from the testing, the constraints on a_z seem to be respected.

If anybody can please help me out, thank you
Riccardo

Hi Riccardo,

could you provide the output of ocp_solver.print_statistics() as well as the solver status?

Best, Katrin

Hi everybody thanks also to @kaethe.
In the end I solved my problem. It was related with how I generated my downstream (lower level) references after the NMPC. Since I had an error in constructing the quaternion I ended up moving far away from my reference which resulted in the MPC trying to overcome a larger control input.

Riccardo

1 Like