Skip to content

MPC Example throwing ValueError #1

@AravindakshanGA

Description

@AravindakshanGA

Greetings.

I tried to work with various control flow techniques and happen to find your repository was a better place to learn. But on trying the mpc_discrete.py example, we had encountered with some ValueErrors.

On digging in further, I found the error is due to the following trace.

Running mpc.py as a standalone code and the stacktrace is as follows.

Traceback (most recent call last):
File "..\libs_control-main\libs_control-main\LibsControl\libs_common\mpc.py", line 153, in
u_new = mpc.forward(xr, x, u_prev)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "..\libs_control-main\libs_control-main\LibsControl\libs_common\mpc.py", line 114, in forward
self.xr_aug[ofs:ofs + self.n_states, :] = xr[n, :]
~~^^^^^^
IndexError: index 4 is out of bounds for axis 0 with size 4

Thanks and Regards
ARAVINDAKSHAN G A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions