Esempio n. 1
0
sys.constants = {
    m: mass_of_rod,
    M: mass_of_plate,
    g: 9.81,
    H: workspace_width,
    a: plate_width,
    b: plate_height,
    c: cable_c,
    c_rod: rod_c,
    k_rod: rod_k,
    Izz: inertia_of_plate,
    Izz_rod: inertia_of_rod,
}
sys.initial_conditions = {x: x_init, y: y_init, beta: beta_init, e: -rod_init}
sys.specifieds = {
    L1: lambda x, t: s_curve(t, L1_init_s, L1_end_s, RiseTime, StartTime),
    L2: lambda x, t: s_curve(t, L2_init_s, L2_end_s, RiseTime, StartTime)
}
sys.times = np.linspace(0.0, Simulation_Time, 1000)
sys.generate_ode_function(generator='cython')

y = sys.integrate()

sim_time = np.linspace(0.0, Simulation_Time, 1000)
fig = plt.figure(figsize=(18, 4))

# fig = plt.figure(0)
fig.add_subplot(141)
plt.plot(sim_time, y[:, 0], label='Unshaped')
# plt.ylim(25,0)
plt.title(r'X Motion')
        motor_omega[2]: 0.,
        motor_omega[3]: 0.,
        blade_omega[0]: 0.,
        blade_omega[1]: 0.,
        blade_omega[2]: 0.,
        blade_omega[3]: 0.,
        blade_omega[4]: 0.,
        blade_omega[5]: 0.,
        blade_omega[6]: 0.,
        blade_omega[7]: 0.,
    }


bb_sys.specifieds = {
    motor_voltage[0]: v_1,
    motor_voltage[1]: v_2,
    motor_voltage[2]: v_3,
    motor_voltage[3]: v_4,
}

bb_sys.specifieds.update(dict(zip(thrust_func,get_blade_thrust)))
bb_sys.specifieds.update(dict(zip(torque_func,get_blade_torque)))

bb_sys.generate_ode_function()

dyn = bb_sys.evaluate_ode_function
x0 = bb_sys._initial_conditions_padded_with_defaults()
x0 = [x0[k] for k in bb_sys.states]


print("derivations finished")