def __main__(): time = 0.01 P = PendulumOnCart(g = 9.82, m_c = 1, m = 0.5, l = 1, \ init_angle = radians(0.1), init_angle_speed = 0, init_x = 0, init_x_speed = 0, \ noise = np.array( [ [0.], [0.], [0.], [0.] ]), timestep = time) C = PendulumOnCartController(P, np.array([[0.],[0.],[0.],[0.]]), outmax = 20, outmin = -20) G = StatePlotter(timestep = time) Drawer = DrawPendulumOnCart(P, C, G, frameskip = 1 ) Drawer.startAnimation(speedup = 5) G.plotData("state.png", "phase.png")
def __main__(): time = 0.01 P = SimplePendulum(g = 9.82, b = 0.0, m = 1, l = 1, timestep = time, \ init_angle = radians(20), init_angle_speed = 0.001, noise = np.array([[0], [0]])) C = SimplePendulumController(P, K_LQR = np.array([ [200, 30] ]),K_SU = 3000, \ setpoint = np.array([[np.radians(180)], [0]]), \ outmax = 1, outmin = -1, SwingupLimit = radians(1)) G = StatePlotter(timestep = time) Plotter = DrawPendulum(P, C, G, frameskip = 4) Plotter.startAnimation(speedup = 0.5) G.plotData("state.png", "phase.png")
def __main__(): time = 0.01 P = SimplePendulum(g = 9.82, b = 0.0, m = 1, l = 1, timestep = time, \ init_angle = radians(20), init_angle_speed = 0.001, noise = np.array([[0], [0]])) C = SimplePendulumController(P, K_LQR = np.array([ [200, 30] ]),K_SU = 3000, \ setpoint = np.array([[np.radians(180)], [0]]), \ outmax = 1, outmin = -1, SwingupLimit = radians(1)) G = StatePlotter(timestep=time) Plotter = DrawPendulum(P, C, G, frameskip=4) Plotter.startAnimation(speedup=0.5) G.plotData("state.png", "phase.png")
def __main__(): time = 0.005 P = DoublePendulumOnCart(m= 0.5, \ m1 = 0.8, \ m2 = 0.15, \ L1 = 1, \ L2 = 1, \ init_angle1 = -radians(181), \ init_angle2 = radians(181), \ timestep = time, \ init_angle1_speed = 0, \ init_angle2_speed = 0, \ init_x = 0, init_x_speed = 0, g = 9.82) C = DoublePendulumOnCartController(P, setpoint = np.array([[0.],[0.],[0.],[0.], [0.], [0.]]), \ K_LQR = np.array([ [2.23607, 10.07, -98.05, 11.97, 196.82, 53.34] ]), outmax = 20, outmin = -20) G = StatePlotter(timestep = time) Drawer = DrawDoublePendulumOnCart(P, C, G, frameskip = 1) Drawer.startAnimation(speedup = 1) G.plotData("state.png", "phase.png")