Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding timestamps to parsing #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions solidRocketParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
import binascii
import csv

import datetime
order = 'big'
class AvionicsData:
def __init__(self):
Expand All @@ -16,17 +16,17 @@ def __init__(self):

def __str__(self):
phases = ["NA!", "PRELAUNCH", "BURN", "COAST", "DROGUE_DESCENT", "MAIN_DESCENT", "ABORT"]

ts = datetime.utcnow()
string="IMU - ACCEL:\t"+ str(self.imu[0:3])+"\n"
string+="IMU - GYRO:\t"+ str(self.imu[3:6])+"\n"
string+="BAR - PRESS:\t"+ str(self.bar[0]) +"\n"
string+="BAR - TEMP:\t"+ str(self.bar[1])+"\n"
# string+="PHS - PHASE:\t"+ str(phases[self.phs + 1])+"\n"

print('The UTC time is : ' ,ts)
with open('fligthData.csv', 'a') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow([str(self.imu[0]), str(self.imu[1]), str(self.imu[2]), str(self.imu[3]), str(self.imu[4]), str(self.imu[5]), str(self.bar[0]), str(self.bar[1])])

spamwriter.writerow(ts)
return string

def arm(ser):
Expand Down