forked from dfki-ric-underactuated-lab/double_pendulum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfree_fall.py
More file actions
42 lines (33 loc) · 1.27 KB
/
free_fall.py
File metadata and controls
42 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import numpy as np
from double_pendulum.model.symbolic_plant import SymbolicDoublePendulum
from double_pendulum.simulation.simulation import Simulator
from double_pendulum.utils.plotting import plot_timeseries
mass = [0.608, 0.630]
length = [0.3, 0.2]
com = [0.275, 0.166]
damping = [0.081, 0.0]
cfric = [0.093, 0.186]
gravity = 9.81
inertia = [0.05472, 0.02522]
torque_limit = [0.0, 3.0]
dt = 0.01
t_final = 7.0
x0 = [np.pi/2., -np.pi/2, 0., 0.]
plant = SymbolicDoublePendulum(mass=mass,
length=length,
com=com,
damping=damping,
gravity=gravity,
coulomb_fric=cfric,
inertia=inertia,
torque_limit=torque_limit)
sim = Simulator(plant=plant)
controller = None
T, X, U = sim.simulate_and_animate(t0=0.0, x0=x0,
tf=t_final, dt=dt, controller=controller,
integrator="runge_kutta",
plot_forecast=False)
plot_timeseries(T, X, U, None,
plot_energy=False,
pos_y_lines=[0.0, np.pi],
tau_y_lines=[-torque_limit[1], torque_limit[1]])