Пример #1
0
plt.title("Z Velocity Not-Bounded")
plt.subplot(337)
plt.plot(t, x_pos)
plt.title("X Position Not-Bounded")
plt.ylabel("Amplitude (m/s^2)")
plt.xlabel("Time (sec)")
plt.subplot(338)
plt.plot(t, y_pos)
plt.title("Y Position Not-Bounded")
plt.xlabel("Time (sec)")
plt.subplot(339)
plt.plot(t, z_pos)
plt.title("Z Position Not-Bounded")
plt.xlabel("Time (sec)")

mpu.applyBounding()

Ax, Ay, Az = mpu.getAcceleration()

x_vel = [sum(Ax[:i]) * -dt for i in range(len(Ax))]
x_pos = [sum(x_vel[:i]) * dt for i in range(len(x_vel))]

y_vel = [sum(Ay[:i]) * dt for i in range(len(Ay))]
y_pos = [sum(y_vel[:i]) * dt for i in range(len(y_vel))]

z_vel = [sum(Az[:i]) * -dt for i in range(len(Az))]
z_pos = [sum(z_vel[:i]) * dt for i in range(len(z_vel))]

plt.figure(2)
plt.subplot(331)
plt.plot(t, Ax)