4 sys
.path
.insert(0, os
.getcwd())
5 prefix
= os
.path
.join(sys
.path
[0], "build")
6 if not os
.path
.exists(prefix
):
11 import matplotlib
.pyplot
as plt
12 except Exception as e
:
16 traj
= a
.traptraj(10, 2, 2, -2)
17 data
= np
.arange(0, traj
.t
, 0.01)
18 plt
.figure("trapezoidal velocity profile trajectory")
21 plt
.title("trapezoidal velocity profile trajectory")
22 plt
.ylabel("Position")
23 plt
.plot(data
, traj
.pos(data
), "r-", label
="q")
27 plt
.ylabel("Velocity")
28 plt
.plot(data
, traj
.vel(data
), "b-", label
="v")
32 plt
.ylabel("Acceleration")
33 plt
.plot(data
, traj
.acc(data
), "g-", label
="a")
37 plt
.savefig(os
.path
.join(prefix
, "trapezoidal_trajectory.png"))