def get_cart_pendulum(m=1, M=3, L=0.5, g=9.81, pedant=False):
N = 4
sys = LTISystem(
np.c_[ # A
[0, 0, 0, 0],
[1, 0, 0, 0],
[0, m*g/M, 0, (-1)**(pedant)*(m+M)*g/(M*L)],
[0, 0, 1, 0]
],
np.r_[0, 1/M, 0, 1/(M*L)], # B
# np.r_[1, 0, 1, 0] # C
)
sys.initial_condition = np.r_[0, 0, np.pi/3, 0]
def ref_func(*args):
if len(args) == 1:
x = np.zeros(N)
else:
x = args[1]
return np.zeros(N)-x
ref = SystemFromCallable(ref_func, N, N)
return sys, ref
评论列表
文章目录