plot_estimator_test.py
Go to the documentation of this file.
1 import numpy as np
2 import matplotlib.pyplot as plt
3 
4 stateType = np.dtype([
5  ('t', np.float64),
6  ('q', (np.float64,4)),
7  ('qhat', (np.float64,4)),
8  ('err', (np.float64,3)),
9  ('eulerErr', (np.float64,3)),
10  ('bias', (np.float32,3))
11 ])
12 
13 def plotResults(filename):
14  data = np.fromfile("../test/build/"+filename, dtype=stateType)
15 
16  plt.figure(figsize=[12,9])
17  plt.suptitle(filename)
18  for i in range(4):
19  plt.subplot(4, 3, 3*i+1)
20  plt.plot(data['t'], data['q'][:,i], label="q")
21  plt.plot(data['t'], data['qhat'][:,i], label="qhat")
22  if i == 0:
23  plt.legend()
24 
25  for i in range(3):
26  plt.subplot(4,3,3*i+2)
27  plt.plot(data['t'], data['err'][:,i])
28  plt.subplot(4,3,11)
29  err_norm = np.sqrt(np.sum(np.square(data['err']),axis=1))
30  plt.plot(data['t'], err_norm)
31 
32  for i in range(3):
33  plt.subplot(4,3,3*i+3)
34  plt.plot(data['t'], data['bias'][:,i])
35 
36 
37  print("{} max error: {}".format(filename, np.max(err_norm)))
38 
39 
40 if __name__ == '__main__':
41  plotResults("linearGyro.bin")
42  plotResults("quadGyro.bin")
43  plotResults("expInt.bin")
44  plotResults("expQuadInt.bin")
45  plotResults("acc.bin")
46  plotResults("estState.bin")
47  plotResults("estBias.bin")
48  plotResults("estStateExtAtt.bin")
49  plotResults("movingExtAtt.bin")
50 
51  plt.show()


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:47