S = PieceWiseAffineSystem(S_list, D_list)
# controller parameters
N = 20
# terminal set and cost
P, K = S2.solve_dare(Q, R)
X_N = S2.mcais(K, D2)
# hybrid MPC controller
controller = HybridModelPredictiveController(S, N, Q, R, P, X_N)
for i in range(50):
# ww is my own simulation of the hybrid system; we get similar results when simulating on S
u = controller.feedback(ww.x - ww.goal())
ww.step(u)
But the end result is something really weird:
It just ping pongs around the boundary of the modes. Is any part of my formulation wrong?
Hi Tobia,
I'm trying to use your pympc to solve a toy 2D problem:
Where there are 2 modes; red is the initial state and green is the goal state:
The dynamics inside each mode are very similar:
The A and B are the same even though we want
x -> x_r
because we can make the substitutionz = x - x_r
:The domains need to be shifted to this error space where the origin is when our state is at the goal. So I'm defining this by:
I set up the controller as shown in the example:
But the end result is something really weird:
It just ping pongs around the boundary of the modes. Is any part of my formulation wrong?