Instead of plotting the states obtained from the optimization solution directly, we use ode45 to simulate the states given the control input solution.
This is a sanity check, making sure that our system can be made to track the state trajectory, given the control input solution.
A and B matrices of the dynamics linearization are computed in two separate files inside the dynamics/cartpole directory.
The control input is given as is (Piecewise linear) till it approaches the end configuration. Here, we switch to an LQR controller to ensure stability.
Instead of plotting the states obtained from the optimization solution directly, we use ode45 to simulate the states given the control input solution.
This is a sanity check, making sure that our system can be made to track the state trajectory, given the control input solution.
A and B matrices of the dynamics linearization are computed in two separate files inside the dynamics/cartpole directory.
The control input is given as is (Piecewise linear) till it approaches the end configuration. Here, we switch to an LQR controller to ensure stability.
The cartpole solves and simulates perfectly.