python from sympy import symbols from sympy.physics.mechanics import dynamicsymbols from pydy.models import n_link_pendulum_on_cart q1, q2 = dynamicsymbols('q1 q2') u1, u2 = dynamicsymbols('u1 u2') q = [q1, q2] u = [u1, u2] l, m1, m2, g = symbols('l m1 m2 g') parameters = {l: 1.0, m1: 1.0, m2: 1.0, g: 9.81} pendulum = n_link_pendulum_on_cart(2, parameters, 0, 0, q, u) pendulum.coordinates = [q1.diff(), q2.diff()] pendulum.speeds = [u1.diff(), u2.diff()] pendulum.kanes_equations() pendulum.compute_conserved_quantities() pendulum.generate_ode_function(generator='cython') pendulum.integrate_symbolic() pendulum.plot_coordinates() pendulum.plot_frames()


上一篇:
下一篇:
切换中文