5 norm = np.linalg.norm(v)
18 for i
in range(0, len(self.
p)):
19 x = x * t + self.
p[len(self.
p) - 1 - i]
24 return Polynomial([(i+1) * self.
p[i+1]
for i
in range(0, len(self.
p) - 1)])
38 def __init__(self, duration, px, py, pz, pyaw):
49 self.px.derivative().p,
50 self.py.derivative().p,
51 self.pz.derivative().p,
52 self.pyaw.derivative().p)
57 result.pos = np.array([self.px.eval(t), self.py.eval(t), self.pz.eval(t)])
58 result.yaw = self.pyaw.eval(t)
62 result.vel = np.array([derivative.px.eval(t), derivative.py.eval(t), derivative.pz.eval(t)])
63 dyaw = derivative.pyaw.eval(t)
66 derivative2 = derivative.derivative()
67 result.acc = np.array([derivative2.px.eval(t), derivative2.py.eval(t), derivative2.pz.eval(t)])
70 derivative3 = derivative2.derivative()
71 jerk = np.array([derivative3.px.eval(t), derivative3.py.eval(t), derivative3.pz.eval(t)])
73 thrust = result.acc + np.array([0, 0, 9.81])
76 x_world = np.array([np.cos(result.yaw), np.sin(result.yaw), 0])
77 y_body =
normalize(np.cross(z_body, x_world))
78 x_body = np.cross(y_body, z_body)
80 jerk_orth_zbody = jerk - (np.dot(jerk, z_body) * z_body)
81 h_w = jerk_orth_zbody / np.linalg.norm(thrust)
83 result.omega = np.array([-np.dot(h_w, y_body), np.dot(h_w, x_body), z_body[2] * dyaw])
93 data = np.loadtxt(filename, delimiter=
",", skiprows=1, usecols=range(33))
103 if t < current_t + p.duration:
104 return p.eval(t - current_t)
105 current_t = current_t + p.duration
def loadcsv(self, filename)
def __init__(self, duration, px, py, pz, pyaw)