1 import matplotlib.pyplot
as plt
3 from scipy.linalg
import norm
11 return np.array([np.arctan2(2.0 * (w * x + y * z), 1. - 2. * (x * x + y * y)),
12 np.arcsin(2.0 * (w * y - z * x)),
13 np.arctan2(2.0 * (w * z + x * y), 1. - 2. * (y * y + z * z))])
15 est = np.fromfile(
"/tmp/rosflight_post_process/estimate.bin", dtype=np.float64)
16 est = np.reshape(est, (-1, 8))
18 cmd = np.fromfile(
"/tmp/rosflight_post_process/cmd.bin", dtype=np.float64)
19 cmd = np.reshape(cmd, (-1, 5))
21 truth = np.fromfile(
"/tmp/rosflight_post_process/truth.bin", dtype=np.float64)
22 truth = np.reshape(truth, (-1, 5))
26 R = np.array([[0, -1, 0],
29 truth[:,2:] = truth[:,2:].dot(R)
31 imu_filt = np.fromfile(
"/tmp/rosflight_post_process/imu_filt.bin", dtype=np.float64)
32 imu_filt = np.reshape(imu_filt, (-1, 7))
34 imu = np.fromfile(
"/tmp/rosflight_post_process/imu.bin", dtype=np.float64)
35 imu = np.reshape(imu, (-1, 7))
37 est_labels=[
't',
'qw',
'qx',
'qy',
'qz',
'bx',
'by',
'bz']
38 truth_labels=[
't',
'qw',
'qx',
'qy',
'qz']
39 imu_filt_labels=[
't',
'accx',
'accy',
'accz',
'gyrox',
'gyroy',
'gyroz']
42 true_euler[2,:] -= true_euler[2,0]
48 for i
in range(1,5,1):
49 plt.suptitle(
'quaternion')
51 plt.ylabel(est_labels[i])
52 plt.plot(est[:,0], est[:,i], label=
"est")
53 plt.plot(truth[:,0], truth[:,i], label=
"truth")
57 for i
in range(5,8,1):
58 plt.suptitle(
'biases')
60 plt.ylabel(est_labels[i])
61 plt.plot(est[:,0], est[:,i])
92 ax = plt.subplot(3,1,i+1, sharex = ax)
93 plt.plot(truth[:,0], true_euler[i,:], label=
"truth")
94 plt.plot(est[:,0], est_euler[i,:], label=
"est")
95 plt.plot(cmd[:,0], cmd[:,i+1], label=
"cmd")