From 8b629e92b325ce1bac1c793244b403e287bbe926 Mon Sep 17 00:00:00 2001 From: njank268 Date: Mon, 20 Jun 2016 13:57:20 -0400 Subject: [PATCH 1/3] Updated temp, extTemp, pressure_kPa, accel, and all of their sd card counterparts to write any errors out to separate error files. All made the code more readable and organized --- accel.py | 42 ++++++++++++++--------- accel_card.py | 42 ++++++++++++++--------- extTemp.py | 67 ++++++++++++++++++++----------------- extTemp_card.py | 71 +++++++++++++++++++++------------------ pressure_kPa.py | 31 +++++++++-------- pressure_kPa_card.py | 31 +++++++++-------- temp.py | 79 +++++++++++++++++++++----------------------- temp_card.py | 79 +++++++++++++++++++++----------------------- 8 files changed, 236 insertions(+), 206 deletions(-) diff --git a/accel.py b/accel.py index 7b3cf76..3f25eff 100644 --- a/accel.py +++ b/accel.py @@ -19,19 +19,21 @@ # Make sure the out file is opened properly while 1: - try: - f1 = open('acceleration.csv','a') - # raise IOError - if not f1.closed: - print "Successfully opened", f1.name - f1.write("Month,Day,Hour,Minute,Second,Xraw,Yraw,Zraw,X,Y,Z,Norm\n") - break - except Exception as err: - print 'Error:', err - time.sleep(1) + try: + f1 = open('acceleration.csv','a') + f2 = open('acceleration_errors.csv','a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,Xraw,Yraw,Zraw,X,Y,Z,Norm\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) # Get accelerometer values and write them to file -while 1 : +while 1: + try: now = datetime.datetime.now() rawX = ADC.read("P9_36") rawY = ADC.read("P9_38") @@ -45,11 +47,19 @@ # raw input is multiplied by 3.6 because it has to be multiplied by 1.8 to get voltage and since it is hooked up to a voltage # divider it also needs to be multiplied by 2 to get the original voltage - #print 'X =', str(Xvalue), 'Y =', str(Yvalue), 'Z =', str(Zvalue) + print 'X: ' + str(Xvalue) + print 'Y: ' + str(Yvalue) + print 'Z: ' + str(Zvalue) a = np.array([Xvalue, Yvalue, Zvalue]) - #print 'Norm =', str(np.linalg.norm(a)) - #print 'Xraw =', str(rawX * 3.6), 'Yraw =', str(rawY * 3.6), 'Zraw =', str(rawZ * 3.6) + print 'Norm: ' + str(np.linalg.norm(a)) + print 'Xraw: ' + str(rawX * 3.6) + print 'Yraw: ' + str(rawY * 3.6) + print 'Zraw: ' + str(rawZ * 3.6) f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(rawX)+','+str(rawY)+','+str(rawZ)+','+str(Xvalue)+','+str(Yvalue)+','+str(Zvalue)+','+str(np.linalg.norm(a))+'\n') - time.sleep(1) + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) -f1.close() \ No newline at end of file +f1.close() +f2.close() \ No newline at end of file diff --git a/accel_card.py b/accel_card.py index 0d06f4d..3a321d5 100644 --- a/accel_card.py +++ b/accel_card.py @@ -19,19 +19,21 @@ # Make sure the out file is opened properly while 1: - try: - f1 = open('/media/CARD/acceleration2.csv','a') - # raise IOError - if not f1.closed: - print "Successfully opened", f1.name - f1.write("Month,Day,Hour,Minute,Second,Xraw,Yraw,Zraw,X,Y,Z,Norm\n") - break - except Exception as err: - print 'Error:', err - time.sleep(1) + try: + f1 = open('/media/CARD/acceleration2.csv','a') + f2 = open('/media/CARD/acceleration_errors2.csv','a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,Xraw,Yraw,Zraw,X,Y,Z,Norm\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) # Get accelerometer values and write them to file -while 1 : +while 1: + try: now = datetime.datetime.now() rawX = ADC.read("P9_36") rawY = ADC.read("P9_38") @@ -45,11 +47,19 @@ # raw input is multiplied by 3.6 because it has to be multiplied by 1.8 to get voltage and since it is hooked up to a voltage # divider it also needs to be multiplied by 2 to get the original voltage - #print 'X =', str(Xvalue), 'Y =', str(Yvalue), 'Z =', str(Zvalue) + print 'X: ' + str(Xvalue) + print 'Y: ' + str(Yvalue) + print 'Z: ' + str(Zvalue) a = np.array([Xvalue, Yvalue, Zvalue]) - #print 'Norm =', str(np.linalg.norm(a)) - #print 'Xraw =', str(rawX * 3.6), 'Yraw =', str(rawY * 3.6), 'Zraw =', str(rawZ * 3.6) + print 'Norm: ' + str(np.linalg.norm(a)) + print 'Xraw: ' + str(rawX * 3.6) + print 'Yraw: ' + str(rawY * 3.6) + print 'Zraw: ' + str(rawZ * 3.6) f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(rawX)+','+str(rawY)+','+str(rawZ)+','+str(Xvalue)+','+str(Yvalue)+','+str(Zvalue)+','+str(np.linalg.norm(a))+'\n') - time.sleep(1) + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) -f1.close() \ No newline at end of file +f1.close() +f2.close() \ No newline at end of file diff --git a/extTemp.py b/extTemp.py index 6f9368b..97011db 100644 --- a/extTemp.py +++ b/extTemp.py @@ -8,40 +8,45 @@ #See June 4 comment on http://ealmberg.blogspot.com/2015/06/4-june-15.html -Bvalue = 3348 #Beta -Ro = 1000 #Resistance at 25 C -To = 298.15 #Room temperature in Kelvin +Bvalue = 3348 #Beta +Ro = 1000 #Resistance at 25 C +To = 298.15 #Room temperature in Kelvin # Make sure the out file is opened properly while 1: - try: - outfile = open('externalTemp.csv','a') - #raise IOError - if not outfile.closed: - print "Successfully opened", outfile.name - outfile.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") - break - except Exception as err: - print 'Error:', err - time.sleep(1) + try: + f1 = open('externalTemp.csv','a') + f2 = open('externalTemp_errors.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) # Get thermistor values and write them to file while 1: - try: - now = datetime.datetime.now() - - adcValue = ADC.read("P9_35") - R = Ro/((1/adcValue) - 1) #Get measured resistance - kelvin = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address - kelvin = 1.0/kelvin - celsius = kelvin - 273.15 - fahrenheit = celsius*(9/5.0) + 32.0 - - outfile.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(kelvin)+','+str(celsius)+','+str(fahrenheit)+'\n') - print str(kelvin) + 'K', str(celsius) + ' C', str(fahrenheit) + ' F' - except Exception as err: - print 'Error:', err - - time.sleep(1) - -outfile.close() \ No newline at end of file + try: + now = datetime.datetime.now() + + adcValue = ADC.read("P9_35") + R = Ro/((1/adcValue) - 1) #Get measured resistance + T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address + + t_k = 1.0/T #Temperature in Kelvin + print str(t_k) + 'K' + t_c = 1.0/T - 273.15 #Convert to celsius + print str(t_c) + 'C' + t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit + print str(t_f) + 'F' + + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) + +f1.close() +f2.close() diff --git a/extTemp_card.py b/extTemp_card.py index f3f04cd..6c76edc 100644 --- a/extTemp_card.py +++ b/extTemp_card.py @@ -8,40 +8,45 @@ #See June 4 comment on http://ealmberg.blogspot.com/2015/06/4-june-15.html -Bvalue = 3348 #Beta -Ro = 1000 #Resistance at 25 C -To = 298.15 #Room temperature in Kelvin +Bvalue = 3348 #Beta +Ro = 1000 #Resistance at 25 C +To = 298.15 #Room temperature in Kelvin # Make sure the out file is opened properly while 1: - try: - outfile = open('/media/CARD/externalTemp2.csv','a') - #raise IOError - if not outfile.closed: - print "Successfully opened", outfile.name - outfile.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") - break - except Exception as err: - print 'Error:', err - time.sleep(1) - -# Get thermisotr values and write them to file + try: + f1 = open('/media/CARD/externalTemp2.csv','a') + f2 = open('/media/CARD/externalTemp_errors2.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) + +# Get thermistor values and write them to file while 1: - try: - now = datetime.datetime.now() - - adcValue = ADC.read("P9_35") - R = Ro/((1/adcValue) - 1) #Get measured resistance - kelvin = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address - kelvin = 1.0/kelvin - celsius = kelvin - 273.15 - fahrenheit = celsius*(9/5.0) + 32.0 - - outfile.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(kelvin)+','+str(celsius)+','+str(fahrenheit)+'\n') - print str(kelvin) + 'K', str(celsius) + ' C', str(fahrenheit) + ' F' - except Exception as err: - print 'Error:', err - - time.sleep(1) - -outfile.close() \ No newline at end of file + try: + now = datetime.datetime.now() + + adcValue = ADC.read("P9_35") + R = Ro/((1/adcValue) - 1) #Get measured resistance + T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address + + t_k = 1.0/T #Temperature in Kelvin + print str(t_k) + 'K' + t_c = 1.0/T - 273.15 #Convert to celsius + print str(t_c) + 'C' + t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit + print str(t_f) + 'F' + + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) + +f1.close() +f2.close() diff --git a/pressure_kPa.py b/pressure_kPa.py index 0771def..36512a9 100755 --- a/pressure_kPa.py +++ b/pressure_kPa.py @@ -8,27 +8,30 @@ while 1: try: f1 = open('pressure.csv', 'a') - if not f1.closed: - f1.write("Month,Day,Hour,Minute,Second,p,rawP\n") - break + f2 = open('pressure_errors.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,p,rawP\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break except Exception as error1: print 'Error ' + str(error1) time.sleep(1) while 1: - now = datetime.datetime.now() - rawP = ADC.read("P9_39") - p = ((rawP * 1.8 * 2 -.33)/1.65)*100 - print str(rawP) + ' ' + str(p) try: + now = datetime.datetime.now() + + rawP = ADC.read("P9_39") + print 'Raw Pressure: ' + str(rawP) + p = ((rawP * 1.8 * 2 -.33)/1.65)*100 + print 'Pressure: ' + str(p) + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(p)+','+str(rawP)+'\n') - time.sleep(1) except Exception as error2: print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) -try: - f1.close() - if f1.closed: - pass -except Exception as error3: - print 'Error ' + str(error3) +f1.close() +f2.close() diff --git a/pressure_kPa_card.py b/pressure_kPa_card.py index 49ffeb9..f19b8cb 100644 --- a/pressure_kPa_card.py +++ b/pressure_kPa_card.py @@ -8,27 +8,30 @@ while 1: try: f1 = open('/media/CARD/pressure2.csv', 'a') - if not f1.closed: - f1.write("Month,Day,Hour,Minute,Second,p,rawP\n") - break + f2 = open('/media/CARD/pressure_errors2.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,p,rawP\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break except Exception as error1: print 'Error ' + str(error1) time.sleep(1) while 1: - now = datetime.datetime.now() - rawP = ADC.read("P9_39") - p = ((rawP * 1.8 * 2 -.33)/1.65)*100 - print str(rawP) + ' ' + str(p) try: + now = datetime.datetime.now() + + rawP = ADC.read("P9_39") + print 'Raw Pressure: ' + str(rawP) + p = ((rawP * 1.8 * 2 -.33)/1.65)*100 + print 'Pressure: ' + str(p) + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(p)+','+str(rawP)+'\n') - time.sleep(1) except Exception as error2: print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) -try: - f1.close() - if f1.closed: - pass -except Exception as error3: - print 'Error ' + str(error3) \ No newline at end of file +f1.close() +f2.close() diff --git a/temp.py b/temp.py index 7dba8ec..2e01904 100644 --- a/temp.py +++ b/temp.py @@ -9,47 +9,44 @@ #See June 4 comment on http://ealmberg.blogspot.com/2015/06/4-june-15.html Bvalue = 3348 #Beta -Ro = 1000 #Resistance at 25 C - room temperature -To = 298.15 #Room temperature Kelvin +Ro = 1000 #Resistance at 25 C +To = 298.15 #Room temperature in Kelvin -while 1 +# Make sure the out file is opened properly +while 1: try: - f1 = open('temp.csv', 'a') - #raise IOError - if not f1.closed: - print "Successfully opened", f1.name - f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") - break - except Exception as error1: - print 'Error ' + str(error1) - time.sleep(1) - + f1 = open('temp.csv', 'a') + f2 = open('temp_errors.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) + +# Get thermistor values and write them to file while 1: - try: - now = datetime.datetime.now() - - adcValue = ADC.read("P9_37") - R = Ro/((1/adcValue) - 1) #Get measured resistance - T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address - - t_k = 1.0/T #Temperature in Kelvin - print str(t_k) + 'K' - t_c = 1.0/T - 273.15 #Convert to celsius - print str(t_c) + 'C' - t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit - print str(t_f) + 'F' - #print str(adcValue) +', ' + str(1/adcValue) + ', ' + str(1/adcValue - 1) + ', ' + str(R) - #print unichr(176) - #print u"\u00B0" - f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); - except Exception as error2: - print 'Error ' + str(error2) - - time.sleep(1) - -try: - f1.close() - if f1.closed: - pass -except Exception as error3: - print 'Error ' + str(error3) + try: + now = datetime.datetime.now() + + adcValue = ADC.read("P9_37") + R = Ro/((1/adcValue) - 1) #Get measured resistance + T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address + + t_k = 1.0/T #Temperature in Kelvin + print str(t_k) + 'K' + t_c = 1.0/T - 273.15 #Convert to celsius + print str(t_c) + 'C' + t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit + print str(t_f) + 'F' + + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) + +f1.close() +f2.close() diff --git a/temp_card.py b/temp_card.py index 543ec80..0170e81 100644 --- a/temp_card.py +++ b/temp_card.py @@ -9,47 +9,44 @@ #See June 4 comment on http://ealmberg.blogspot.com/2015/06/4-june-15.html Bvalue = 3348 #Beta -Ro = 1000 #Resistance at 25 C - room temperature -To = 298.15 #Room temperature Kelvin +Ro = 1000 #Resistance at 25 C +To = 298.15 #Room temperature in Kelvin -while 1 +# Make sure the out file is opened properly +while 1: try: - f1 = open('/media/CARD/temp2.csv', 'a') - #raise IOError - if not f1.closed: - print "Successfully opened", f1.name - f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") - break - except Exception as error1: - print 'Error ' + str(error1) - time.sleep(1) - + f1 = open('/media/CARD/temp2.csv', 'a') + f2 = open('/media/CARD/temp_errors2.csv', 'a') + print "Successfully opened", f1.name + print "Successfully opened", f2.name + f1.write("Month,Day,Hour,Minute,Second,ADC,Resistance,Kelvin,Celsius,Fahrenheit\n") + f2.write("Month,Day,Hour,Minute,Second,Error\n") + break + except Exception as error1: + print 'Error ' + str(error1) + time.sleep(1) + +# Get thermistor values and write them to file while 1: - try: - now = datetime.datetime.now() - - adcValue = ADC.read("P9_37") - R = Ro/((1/adcValue) - 1) #Get measured resistance - T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address - - t_k = 1.0/T #Temperature in Kelvin - print str(t_k) + 'K' - t_c = 1.0/T - 273.15 #Convert to celsius - print str(t_c) + 'C' - t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit - print str(t_f) + 'F' - #print str(adcValue) +', ' + str(1/adcValue) + ', ' + str(1/adcValue - 1) + ', ' + str(R) - #print unichr(176) - #print u"\u00B0" - f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); - except Exception as error2: - print 'Error ' + str(error2) - - time.sleep(1) - -try: - f1.close() - if f1.closed: - pass -except Exception as error3: - print 'Error ' + str(error3) + try: + now = datetime.datetime.now() + + adcValue = ADC.read("P9_37") + R = Ro/((1/adcValue) - 1) #Get measured resistance + T = 1.0/To + (1.0/Bvalue)*mt.log(R/Ro) #Formula from above blogspot address + + t_k = 1.0/T #Temperature in Kelvin + print str(t_k) + 'K' + t_c = 1.0/T - 273.15 #Convert to celsius + print str(t_c) + 'C' + t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit + print str(t_f) + 'F' + + f1.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(adcValue)+','+str(R)+','+str(t_k)+','+str(t_c)+','+str(t_f)+'\n'); + except Exception as error2: + print 'Error ' + str(error2) + f2.write(str(now.month)+','+str(now.day)+','+str(now.hour)+','+str(now.minute)+','+str(now.second)+','+str(error2)+'\n'); + time.sleep(1) + +f1.close() +f2.close() \ No newline at end of file From 73d04292a83336503972234276d12d0b64685e79 Mon Sep 17 00:00:00 2001 From: njank268 Date: Mon, 27 Jun 2016 11:58:23 -0400 Subject: [PATCH 2/3] No updates were made, needed to commit because of undoing merges --- gps_exception.py | 97 ++++++++++++++++++++++------------------- gps_parse.py | 108 ++++++++++++++++++++++++++++++++++++++++++++++ gps_raw.py | 110 +++++++++++++++++++++++++++++++++++++++++++++++ gps_read_file.py | 45 +++++++++++++++++++ 4 files changed, 315 insertions(+), 45 deletions(-) create mode 100644 gps_parse.py create mode 100644 gps_raw.py create mode 100644 gps_read_file.py diff --git a/gps_exception.py b/gps_exception.py index c71a3d6..44ebd8c 100644 --- a/gps_exception.py +++ b/gps_exception.py @@ -17,62 +17,69 @@ while 1: try : gps = ser.readline() - print gps + #print gps except OSError: print(err) if(gps.startswith('$GPRMC')): gprmc = nmea.GPRMC() gprmc.parse(gps) + if(gps.startswith('$GPGGA')): + gpgga = nmea.GPGGA() + gpgga.parse(gps) #print gps - f1.write(gps) + #f1.write(gps) #f1.write('\n') - try: - print "Timestamp: " + gprmc.timestamp - # print datetime.datetime.fromtimestamp(float(gprmc.timestamp)).strftime('%Y-%m-%d %H:%M:%S') - # f1.write(gprmc) - - # f1.write(datetime.datetime.fromtimestamp(float(gprmc.timestamp)).strftime('%H:%M:%S')) - except Exception as err: - print(err) - try: - print "Datestamp: " + gprmc.datestamp - except Exception as err: - print("Datestamp Error: " + err) - try: - print "Latitude: " + gprmc.latitude - except Exception as err: - print("Latitude Error: "+err) - try: - print "Latitude Direction: " + gprmc.lat_direction - except Exception as err: - print("Latitude Direction Error: "+err) - try: - print "Longitude: " + gprmc.longitude - except Exception as err: - print("Longitude Error: "+err) - try: - print "longitude Direction: " + gprmc.lon_direction - except Exception as err: - print("Longitude Direction Error: "+err) - try: - print "Speed over ground: " + gprmc.spd_over_grnd - except Exception as err: - print("Speed over ground error: "+err) - try: - print "True Course: " + gprmc.true_course - except Exception as err: - print("True Course Error: " + err) + try: + print "Timestamp: " + gprmc.timestamp + # print datetime.datetime.fromtimestamp(float(gprmc.timestamp)).strftime('%Y-%m-%d %H:%M:%S') + # f1.write(gprmc) + + # f1.write(datetime.datetime.fromtimestamp(float(gprmc.timestamp)).strftime('%H:%M:%S')) + except Exception as err: + print(err) + try: + print "Datestamp: " + gprmc.datestamp + except Exception as err: + print "Datestamp Error: " + str(err) + try: + print "Latitude: " + gprmc.lat + except Exception as err: + print "Latitude Error: "+ str(err) + try: + print "Latitude Direction: " + gprmc.lat_dir + except Exception as err: + print "Latitude Direction Error: " + str(err) + try: + print "Longitude: " + gprmc.lon + except Exception as err: + print "Longitude Error: " + str(err) + try: + print "longitude Direction: " + gprmc.lon_dir + except Exception as err: + print "Longitude Direction Error: " + str(err) + try: + print "Speed over ground: " + gprmc.spd_over_grnd + except Exception as err: + print "Speed over ground error: "+ str(err) + try: + print "True Course: " + gprmc.true_course + except Exception as err: + print "True Course Error: " + str(err) + try: + print "Altitude above sea level: " + gpgga.antenna_altitude + ' ' + gpgga.altitude_units +'\n' + except Exception as err: + print(err) # f1.write('\n') # f1.write(datetime.datetime.fromtimestamp(float(gprmc.datestamp)).strftime('%Y-%m-%d')) # f1.write('\n') - #print time.time(gprmc.timestamp) + #print time.time(gprmc.timestamp) # d = datetime.timedelta(gprmc.timestamp) # print "Datestamp: " + gprmc.datestamp - - try: - print "Date: " + datetime.datetime.fromtimestamp(float(gprmc.datestamp)).strftime('%Y-%m-%d') - except Exception as err: - print(err) + + try: + print "Time: " + datetime.datetime.fromtimestamp(float(gprmc.timestamp)).strftime('%H:%M:%S:%f') + except Exception as err: + print("Time error: " + str(err)) #print "Latitude: " + gprmc.lat + gprmc.lat_dir #print "Longitude: " + gprmc.lon +gprmc.lon_dir @@ -84,7 +91,7 @@ # f1.write(time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())) # f1.write('\n') - time.sleep(1) + time.sleep(1) # if(gps.startswith('$GPGGA')): # gpgga = nmea.GPGGA() diff --git a/gps_parse.py b/gps_parse.py new file mode 100644 index 0000000..3fca278 --- /dev/null +++ b/gps_parse.py @@ -0,0 +1,108 @@ +""""Description: + Collects information from the raw GPS data and writes them out to several files: + - 2 .csv files for GPS data + - googleEarth.kml for opening in Google Earth + - googleMyMaps.csv for importing to Google My Maps + - 1 .txt file as an error log +""" + +from pynmea import nmea +import datetime + +start_time = datetime.datetime.now() + +""" NOTE: + The pynmea library creates NMEASentence classes whose attributes are parts of an nmea sentence. + Since, at the time of this file being written, there is no documentation providing the attribute names, + the next best place to look for these names would be in nmea.py from the pynmea library. + Each child class assigns a two-dimensional tuple to parse_map. Within the outer tuple, each inner tuple + contains two values: 1) a description of the attribute and 2) the attribute name + + Reference for nmea sentences: http://www.catb.org/gpsd/NMEA.html + + Using Python 2.7.10 +""" + +# Convert raw coordinates from degrees decimal minutes format to decimal degrees format. Return the result +# For reference, see http://bergenballoon.blogspot.com/2016/06/week-three-june-6-2016.html +def getDecimalDegrees(coordinate, direction): + if not coordinate: + return '' + coor = float(coordinate) + whole = float(int(coor/100)) + fraction = (coor-whole*100)/60 + coor = whole + fraction + if direction == 'W' or direction == 'S': + return str(-1.0 * coor) + else: + return str(coor) + +# Return raw date and/or time that follows the string format +def getDateOrTime(format, timestamp, datestamp=None): + time_num = float(timestamp) + hour = int(time_num)/10000 + minute = (int(time_num) - hour*10000)/100 + second = int(time_num) - hour*10000 - minute*100 + microsecond = int((time_num - int(time_num))*1000000) + microsecond = int(round(float(microsecond)/10)*10) # corrects microsecond (i.e. 399999 is corrected to 400000). + + if datestamp is None: + dt = datetime.time(hour, minute, second, microsecond) + else: + date_num = int(datestamp) + day = date_num/10000 + month = (date_num - day*10000)/100 + year = (date_num - day*10000 - month*100) + 2000 + # print '%i/%i/%i' % (month, day, year), + dt = datetime.datetime(year, month, day, hour, minute, second, microsecond) + # print '%i:%i:%i.%i' % (hour,minute,second,microsecond) + return dt.strftime(format) + +# Write out data to files +with open('gps_raw_test.csv') as infile, open('gps_gga.csv', 'w') as outGGA, open('gps_rmc.csv', 'w') as outRMC, open('googleEarth.kml', 'w') as gEarth, open('googleMyMaps.csv', 'w') as myMaps, open('gps_errors.txt', 'w') as errors: + outGGA.write('BeagleBone Black Date and Time UTC, Satellite Timestamp UTC,DDM Latitude,Latitude Direction,DDM Longitude,Longitude Direction,Altitude Above Sea Level (meters),GPS Quality,Satellites in View\n') + outRMC.write('BeagleBone Black Date and Time UTC,Satellite Date and Time UTC,DDM Latitude,Latitude Direction,DDM Longitude,Longitude Direction,Raw Ground Speed (knots), Converted Ground Speed (mph),True Course\n') + gEarth.write('\n\n\n\n\n#yellowPoly\n\n1\n1\nabsolute\n\n') + myMaps.write('BeagleBone Black Date and Time UTC,Satellite Timestamp UTC,DD Latitude,DD Longitude,Altitude Above Sea Level (meters)\n') + + error_count = 0 + for line in infile: + try: + # work on dt = datetime.datetime.strptime( line[:line.rfind('2016-')+26], '%Y-%m-%d %H:%M:%S.%f') + dt = datetime.datetime.strptime( line[:line.find(',')], '%Y-%m-%d %H:%M:%S.%f') + local_datetime = dt.strftime('%m/%d/%Y %H:%M:%S.%f') + + # If there is a second nmea sentence that cuts into the first (which happens frequently), use the second one + # Assume that every nmea sentence has a '$' character + gps = line[line.rfind('$'):] + + if gps.startswith('$GPGGA'): + gga = nmea.GPGGA() + gga.parse(gps) + #print local_datetime + ',' + gps, + outGGA.write(local_datetime + ',' + getDateOrTime('%H:%M:%S.%f', gga.timestamp) + ',' + gga.latitude + ',' + gga.lat_direction + ',' + gga.longitude + ',' + gga.lon_direction + ',' + gga.antenna_altitude + ',' + gga.gps_qual + ',' + gga.num_sats + '\n') + + if gga.latitude and gga.longitude and gga.antenna_altitude: + gEarth.write('\t' + getDecimalDegrees(gga.longitude, gga.lon_direction) + ',' + getDecimalDegrees(gga.latitude, gga.lat_direction) + ',' + gga.antenna_altitude + '\n') + myMaps.write(local_datetime + ',' + getDateOrTime('%H:%M:%S.%f', gga.timestamp) + ',' + getDecimalDegrees(gga.latitude, gga.lat_direction) + ',' + getDecimalDegrees(gga.longitude, gga.lon_direction) + ',' + gga.antenna_altitude + '\n') + + if gps.startswith('$GPRMC'): + rmc = nmea.GPRMC() + rmc.parse(gps) + #print local_datetime + ',' + gps, + outRMC.write(local_datetime + ',' + getDateOrTime('%m/%d/%Y %H:%M:%S.%f', rmc.timestamp, rmc.datestamp) + ',' + rmc.lat + ',' + rmc.lat_dir + ',' + rmc.lon + ',' + rmc.lon_dir + ',' + rmc.spd_over_grnd + ',' + str(float(rmc.spd_over_grnd)/0.868976) + ',' + rmc.true_course + '\n') + + # Should the rmc data be included to googleMyMaps.csv? + #if rmc.lat and rmc.lon: + #myMaps.write(local_datetime + ',' + getDateOrTime('%H:%M:%S.%f', rmc.timestamp) + ',' + getDecimalDegrees(rmc.lat, rmc.lat_dir) + ',' + getDecimalDegrees(rmc.lon, rmc.lon_dir) + '\n') + + except Exception as err: + error_msg = 'Error occurred while reading: ' + line + '\tError: ' + str(err) + '\n' + print error_msg + errors.write(error_msg) + error_count += 1 + gEarth.write('\n\n\n\n') + +print 'Number of faulty nmea sentences:', error_count +print 'Completed writing to files' +print 'Time elapsed:', (datetime.datetime.now() - start_time) \ No newline at end of file diff --git a/gps_raw.py b/gps_raw.py new file mode 100644 index 0000000..afa89d5 --- /dev/null +++ b/gps_raw.py @@ -0,0 +1,110 @@ +import Adafruit_BBIO.UART as UART +import serial +import time +import datetime +from pynmea import nmea + +""" NOTES: + + -- The pynmea library creates NMEASentence classes whose attributes are parts of an nmea sentence. + Since, at the time of this file being written, there is no documentation providing the attribute names, + the next best place to look for these names would be in nmea.py from the pynmea library. + Each child class assigns a two-dimensional tuple to parse_map. Within the outer tuple, each inner tuple + contains two values: 1) a description of the attribute and 2) the attribute name. + Reference for nmea sentences: http://www.catb.org/gpsd/NMEA.html + + -- Unlike every other program, this one opens two files out of concern for the serial bus. If there were two programs + running at the same time and making use of UART2, the serial might become overloaded, causing the programs to fail + in reading the nmea sentences off the gps + + -- This program will only work when two conditions are met: 1) the microSD card is mounted onto the beaglebone, + and 2) the microSD card IS NOT set to read only. If the microSD card is locked you MUST unlock it by + using the SD card adapter. + To unlock the card, see this post: http://bergenballoon.blogspot.com/2016/06/week-three-june-9-2016.html + +""" + +# Make sure the out file is opened properly +while 1: + try: + f1 = open('gps_raw.csv','a') # open() can cause an IOError + print "Successfully opened", f1.name + break + except Exception as err: + print 'Error:', err + time.sleep(1) + +while 1: + try: + f2 = open('/media/CARD/gps_raw2.csv','a') # open() --> IOError + print "Successfully opened", f2.name + break + except Exception as err: + print 'Error:', err + time.sleep(1) + +while 1: + try: + UART.setup("UART2") + ser = serial.Serial(port = "/dev/ttyO2", baudrate=57600) # serial.Serial() --> ValueError, SerialException + break + except Exception as err: + print 'Error:', err + time.sleep(1) + +ser.close() +ser.open() + +# Get nmea sentences from the gps and write them to file +if ser.isOpen(): + print "Serial is open!" + time.sleep(1) + while 1: + try: + gps = ser.readline() + f1.write(str(datetime.datetime.now())+','+gps) + f2.write(str(datetime.datetime.now())+','+gps) + + # If there is a second nmea sentence that cuts into the first (which happens frequently), use the second one + if gps.find('$') != -1: + dollar_signs = [i for i in range(len(gps)) if gps[i] == '$'] + gps = gps[dollar_signs[-1]:] + + if gps.startswith('$GPGGA'): + gga = nmea.GPGGA() + gga.parse(gps) + print '\n---------- GPGGA ----------' + print gps, # Each gps line ends with '\n' + print "Timestamp (hhmmss.sss): " + gga.timestamp + print "Latitude: " + gga.latitude + ' ' + gga.lat_direction + print "Longitude: " + gga.longitude + ' ' + gga.lon_direction + print "Altitude above sea level: " + gga.antenna_altitude + ' ' + gga.altitude_units + print "GPS Quality: " + gga.gps_qual + print "Satellites in view: " + gga.num_sats + print '---------------------------' + + if gps.startswith('$GPRMC'): + gprmc = nmea.GPRMC() + gprmc.parse(gps) + print '\n---------- GPRMC ----------' + print gps, # Each gps line ends with '\n' + print "Datestamp (ddmmyy): " + gprmc.datestamp + #print "Date: " + datetime.datetime.fromtimestamp(float(gprmc.datestamp)).strftime('%Y-%m-%d') + print "Timestamp (hhmmss.sss): " + gprmc.timestamp + print "Latitude: " + gprmc.lat + ' ' + gprmc.lat_dir + print "Longitude: " + gprmc.lon+ ' ' + gprmc.lon_dir + print "Ground speed: " + gprmc.spd_over_grnd + ' knots', float(gprmc.spd_over_grnd)/0.868976, 'mph' + print "True Course: " + gprmc.true_course + print '---------------------------' + + # Print the time in reference to daylight savings + local_time = time.time() - 14400 #Add 3600 when DST changes + # print "Timestamp(adjusted): " + gprmc.timestamp + print "Date and time: " + time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(local_time)) + ' DST' + + except Exception as err: + print "Error: " + str(err) + + time.sleep(1) +f1.close() +f2.close() \ No newline at end of file diff --git a/gps_read_file.py b/gps_read_file.py new file mode 100644 index 0000000..4207a82 --- /dev/null +++ b/gps_read_file.py @@ -0,0 +1,45 @@ +from pynmea import nmea + +f1 = open('gps.csv','r') +f2 = open('gps_derived.csv', 'w') +count = 0 +count_GPGGA = 0 +count_GPRMC = 0 +for gps_line in f1: + count += 1 + if "$GPGGA" in gps_line: + count_GPGGA += 1 + continue + if(gps_line.startswith('$GPRMC')): + gprmc = nmea.GPRMC() + gprmc.parse(gps_line) + try: + if gprmc.data_validity != 'A': + continue + s_d = str(gprmc.datestamp) + if '06' not in s_d: + continue + d = s_d[0:2]+'/'+s_d[2:4]+'/20'+s_d[4:6] + s_t = str(gprmc.timestamp) + t = s_t[0:2]+':'+s_t[2:4]+':'+s_t[4:6]+':'+s_t[7:10] + ' UTC' + latitude = str(gprmc.lat) + longitude = str(gprmc.lon) + lat_dir = str(gprmc.lat_dir) + lon_dir = str(gprmc.lon_dir) + speed = str(gprmc.spd_over_grnd) + true_course = str(gprmc.true_course) + except Exception as err: + print(err) + try: + write_line = d + ',' + t + ',' + latitude + ',' + lat_dir + ',' + longitude + ',' + lon_dir + ',' + speed + ',' + true_course +'\n' + f2.write(write_line) + count_GPRMC += 1 + except Exception as err: + print(err) + + +print "GPGGA lines: " +str(count_GPGGA) +print "GPRMC lines: " + str(count_GPRMC) +print "Loop count: " + str(count) +f1.close() +f2.close() From bca9258810045f7155207cb14d118479c5a13c55 Mon Sep 17 00:00:00 2001 From: plehrer Date: Tue, 28 Jun 2016 11:03:26 -0400 Subject: [PATCH 3/3] Made shell scripts executable as root --- check_experiments.sh | 3 +- main.py | 139 ------------------------------ start_experiments_with_comp.sh | 0 start_experiments_without_comp.sh | 0 4 files changed, 2 insertions(+), 140 deletions(-) mode change 100644 => 100755 check_experiments.sh delete mode 100644 main.py mode change 100644 => 100755 start_experiments_with_comp.sh mode change 100644 => 100755 start_experiments_without_comp.sh diff --git a/check_experiments.sh b/check_experiments.sh old mode 100644 new mode 100755 index 98de03e..5e78609 --- a/check_experiments.sh +++ b/check_experiments.sh @@ -9,4 +9,5 @@ ps aux | grep temp_card ps aux | grep extTemp ps aux | grep extTemp_card ps aux | grep accel -ps aux | grep accel_card \ No newline at end of file +ps aux | grep accel_card + diff --git a/main.py b/main.py deleted file mode 100644 index 8b028b4..0000000 --- a/main.py +++ /dev/null @@ -1,139 +0,0 @@ -import Adafruit_BBIO.ADC as ADC -import Adafruit_BBIO.UART as UART -import time -import datetime -import numpy as np -import serial -from pynmea import nmea -from Adafruit_I2C import Adafruit_I2C - -# Addresses for reading x,y,z axes of the magnotomer. They are stored in registers and read as most significant bits (msb) and least $ -# See page 11: -#http://www51.honeywell.com/aero/common/documents/myaerospacecatalog-documents/Defense_Brochures-documents/HMC5883L_3-Axis_Digital_Co$ - -gprmc = nmea.GPRMC() -mag_addr = 0x1E -config_register = 0x01 -X_msb = 0x03 -X_lsb = 0x04 -Z_msb = 0x05 -Z_lsb = 0x06 -Y_msb = 0x07 -Y_lsb = 0x08 - -i2c = Adafruit_I2C(mag_addr) - -UART.setup("UART2") - -ser = serial.Serial(port = "/dev/ttyO2", baudrate=9600) -ser.close() -ser.open() - -ADC.setup() - -# Based on observation of high and low raw readings of the accelerometer X 3.6 V. Then took the average of each. -zeroOffsetZ = 1.672 -zeroOffsetX = 1.595 -zeroOffsetY = 1.614 - -#The sensitivity or conversion factor is the average for each axis of the accelerometer minus low raw reading. -conversionFactorZ = 0.322 -conversionFactorY = 0.325 -conversionFactorX = 0.319 - -# Values off of the datasheet for Thermistor, to calculate temp -Bvalue = 3348 #Beta -Ro = 1000 #Resistance at 25 C -To = 298.15 #Room temperature Kelvin - -#create files and headers that we will save our data too -f1 = open('Data.csv','a') -f2 = open('rawData.csv','a'); -f1.write("Datestamp,Timestamp,Latitude,Longitude,Speed,Course,Accel Z,Accel Y,Accel X,Accel Norm,Mag Z,Mag Y,Mag X,Mag Norm,Int Temp,Ext Temp,Pressure,Sound,\n") -f2.write("Datestamp,Timestamp,Latitude,Longitude,Speed,Course,Accel Z,Accel Y,Accel X,Mag Z,May Y,Mag X,Int Temp,Ext Temp,Pressure,Sound\n") - -while 1 : - -# get gps data - gps = ser.readline() - while(not gps.startswith('$GPRMC')): - gps = ser.readline() - gprmc.parse(gps) - -# I2C code for reading the magnetometer - counter = 0 - for counter in xrange(0,10): #send the commands several times to ensure Magnetometer receives the command - Adafruit_I2C.write8(i2c, 0x00, 0x18) # 1 Average, 15 Hz, normal measurement - Adafruit_I2C.write8(i2c, 0x01, 0x20) # Set Gain - Adafruit_I2C.write8(i2c, 0x02, 0x00) # Continuous measurement - counter += 1 - z_l = Adafruit_I2C.readU8(i2c, Z_lsb) #Data is stored in 2 registers on the chip, the Least significant and the - z_m = Adafruit_I2C.readS8(i2c, Z_msb) #most significant. Both must be read and the two combined into the actual number - Zmag_raw = z_m << 8 | z_l - Zmag = Zmag_raw/2048.0 * 1.3 #Calculate Gauss value from the raw 12 bit number - - y_l = Adafruit_I2C.readU8(i2c, Y_lsb) #rinse and repeat for each axis - y_m = Adafruit_I2C.readS8(i2c, Y_msb) - Ymag_raw = y_m << 8 | y_l - Ymag = Ymag_raw/2048.0 * 1.3 - - x_l = Adafruit_I2C.readU8(i2c, X_lsb) - x_m = Adafruit_I2C.readS8(i2c, X_msb) - Xmag_raw = x_m << 8 | x_l - Xmag = Xmag_raw/2048.0 * 1.3 - - mag_vector = np.array([Xmag,Ymag,Zmag]) -# print 'Norm = ' + str(np.linalg.norm(mag_vector)); - -# read accelerometer axes, thermistors, and pressure sensor - Zaccel_raw = ADC.read("P9_40") - Yaccel_raw = ADC.read("P9_38") - Xaccel_raw = ADC.read("P9_36") - rawT_int = ADC.read("P9_37") #Inside payload thermistor - rawT_ext = ADC.read("P9_35") #External thermistor - rawP = ADC.read("P9_39") # read pressure sensor - - #convert raw voltage to pressure Kpa - formula derived from data sheet, page 11: http://sensing.honeywell.com/index.php?ci_id=151133 - p = ((rawP * 1.8 * 2 -.33)/1.65)*100 - - # Calculate Kelvin for internal thermistor - R = 1000/((1/rawT_int) - 1) #Get measured resistance - T_int = 1.0/To + (1.0/Bvalue)*np.log(R/Ro) #Formula from above blogspot address - T_int = 1.0/T_int - - # Calculate Kelvin for external thermistor - R = 1000/((1/rawT_ext) - 1) #Get measured resistance - T_ext = 1.0/To + (1.0/Bvalue)*np.log(R/Ro) #Formula from above blogspot address - T_ext = 1.0/T_ext - - # Calculate acceleration - Zaccel = ((Zaccel_raw * 3.6) - zeroOffsetZ)/conversionFactorZ; - Yaccel = ((Yaccel_raw * 3.6) - zeroOffsetY)/conversionFactorY; - Xaccel = ((Xaccel_raw * 3.6) - zeroOffsetX)/conversionFactorX; - - # raw input is multiplied by 3.6 because it has to be multiplied by 1.8 to get voltage and since it is hooked up to a voltage - # divider it also needs to be multiplied by 2 to get the original voltage - - #Below are the print statements used for debugging - - #print 'Z = '+str(Zvalue) + ' Y = ' + str(Yvalue) + ' X = ' + str(Xvalue); - accel_vector = np.array([Zaccel, Yaccel, Xaccel]) - #print 'Norm = ' + str(np.linalg.norm(a)); - #print 'Zraw = ' + str(rawZ * 3.6) + ' Yraw = ' + str(rawY * 3.6) + ' Xraw = ' + str(rawX * 3.6); - - #Console print the calculated temperature - #print str(T_int) + ' K' - #t_c = T_int - 273.15 #Convert to celsius - #print str(t_c) + ' C' - #t_f = t_c*(9/5.0) + 32.0 #Convert to Fahrenheit - #print str(t_f) - - #print str(rawPressure) + ' ' + str(p) - #write to csv file - - f1.write(gprmc.datestamp+','+gprmc.timestamp+','+gprmc.lat + gprmc.lat_dir+','+gprmc.lon + gprmc.lon_dir+','+gprmc.spd_over_grnd+','+gprmc.true_course+','+str(Zaccel)+','+str(Yaccel)+','+str(Xaccel)+','+str(np.linalg.norm(accel_vector))+','+str(Zmag)+','+str(Ymag)+','+str(Xmag)+','+str(np.linalg.norm(mag_vector))+','+str(T_int)+','+str(T_ext)+','+str(p)+'\n') - f2.write(gprmc.datestamp+','+gprmc.timestamp+','+gprmc.lat + gprmc.lat_dir+','+gprmc.lon + gprmc.lon_dir+','+gprmc.spd_over_grnd+','+gprmc.true_course+','+ str(Zaccel_raw)+','+str(Yaccel_raw)+','+str(Xaccel_raw)+','+ str(Zmag_raw)+','+str(Ymag_raw)+','+str(Xmag_raw)+','+str(rawT_int)+','+str(rawT_ext)+','+str(rawP)+'\n'); - print "datapoint" - time.sleep(1) -f1.close() -f2.close() diff --git a/start_experiments_with_comp.sh b/start_experiments_with_comp.sh old mode 100644 new mode 100755 diff --git a/start_experiments_without_comp.sh b/start_experiments_without_comp.sh old mode 100644 new mode 100755