-
Notifications
You must be signed in to change notification settings - Fork 70
/
run_telemetry.py
46 lines (33 loc) · 886 Bytes
/
run_telemetry.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 20:31:07 2020
@author: miguel-asd
"""
import pandas as pd
from itertools import count
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
plt.style.use('dark_background')
index = count()
def animate(i):
data = pd.read_csv('telemetry/data.csv')
x = data['t']
y1 = data['roll']
y2 = data['pitch']
xlim = x.values[-1]
plt.clf()
plt.subplot(121)
plt.plot(x, y1, label='roll')
plt.xlim(xlim-30,xlim)
plt.title('Body orientation.')
plt.legend(loc='upper left')
plt.subplot(122)
plt.plot(x, y2, label='pitch')
plt.xlim(xlim-30,xlim)
plt.title('Body orientation.')
plt.legend(loc='upper left')
plt.tight_layout()
ani1 = FuncAnimation(plt.gcf(), animate, interval=25)
plt.tight_layout()
plt.show()