-
Notifications
You must be signed in to change notification settings - Fork 407
/
Copy pathplot_velocity.py
executable file
·53 lines (39 loc) · 1.8 KB
/
plot_velocity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
adata = np.genfromtxt('NTUN.txt', skip_header=1,
skip_footer=1, names=['time', 'time2', 'empty1', 'empty2', 'empty3', 'empty4', 'empty5', 'airspeed', 'empty6'], autostrip=True, filling_values=0)
data = np.genfromtxt('EulDataOut.txt', delimiter=' ', skip_header=1,
skip_footer=1, names=['time', 'roll', 'roll_onb', 'pitch', 'pitch_onb', 'yaw', 'yaw_onb', 'empty1', 'empty2'])
vdata = np.genfromtxt('ValidationOut.txt', delimiter=' ', skip_header=1,
skip_footer=1, names=['time', 'roll_int', 'pitch_int', 'yaw_int', 'north', 'east', 'down'])
fig = plt.figure()
ax1 = fig.add_subplot(311)
ax1.set_title("Airspeed / Pitch Estimated / Pitch Onboard")
ax1.set_xlabel('time (s)')
ax1.set_ylabel('Airspeed (m/s)')
# ax1.set_ylim([-0.0025,0.0025])
ax1.plot(adata['time'], adata['airspeed'], color='r', label='airspeed')
ax2 = fig.add_subplot(312)
ax2.set_xlabel('time (s)')
ax2.set_ylabel('Pitch estimated (deg)')
# ax2.set_ylim([-0.0025,0.0025])
ax2.plot(data['time'], data['pitch'], color='g', label='pitch')
ax2.plot(data['time'], data['pitch_onb'], color='r', label='pitch_onb')
ax3 = fig.add_subplot(313)
ax3.set_xlabel('time (s)')
ax3.set_ylabel('Pitch onboard (deg)')
# ax3.set_ylim([-0.0025,0.0025])
#ax3.plot(data['time'], data['pitch'], color='g', label='pitch')
#ax3.plot(data['time'], data['pitch_onb'], color='b', label='pitch_onb')
ax3.plot(vdata['time'], vdata['pitch_int'], color='r', label='pitch integral')
handles, labels = ax1.get_legend_handles_labels()
ax1.legend(handles, labels, loc=2)
handles, labels = ax2.get_legend_handles_labels()
ax2.legend(handles, labels, loc=2)
handles, labels = ax3.get_legend_handles_labels()
ax3.legend(handles, labels, loc=2)
plt.show()