Generation 3 of the Harp project
Dependencies: Servo TMP36 GZ buffered-serial1 chan_fatfs_sd nmea_parser watchdog mbed-rtos mbed
Fork of HARP2 by
Revision 24:7477105103e5, committed 2012-12-17
- Comitter:
- tylerjw
- Date:
- Mon Dec 17 23:42:34 2012 +0000
- Parent:
- 23:5a7b5db55be5
- Child:
- 25:81c3696ba2c9
- Commit message:
- documentation and naming standards
Changed in this revision
--- a/GPS_parser.lib Thu Dec 13 23:56:31 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/tylerjw/code/GPS_parser/#59acef1c795b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OfficialLibraries/mbed-rtos.lib Mon Dec 17 23:42:34 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#88a1a9c26ae3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OfficialLibraries/mbed.bld Mon Dec 17 23:42:34 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63cdd78b2dc1 \ No newline at end of file
--- a/buffered-serial1.lib Thu Dec 13 23:56:31 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/tylerjw/code/buffered-serial1/#a4a21e18acd1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buffered_serial_UART1.lib Mon Dec 17 23:42:34 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tylerjw/code/buffered-serial1/#d3122119f92b
--- a/config.h Thu Dec 13 23:56:31 2012 +0000 +++ b/config.h Mon Dec 17 23:42:34 2012 +0000 @@ -1,3 +1,8 @@ +// file containing configuration values + +#ifndef HARP_CONFIG_H +#define HARP_CONFIG_H + #define WAIT_FOR_LOCK 1 // set to 1 to not open log file until gps lock #define UNLOCK_ON_FALL 0 // set to 1 to not signal parachute untill falling @@ -10,4 +15,6 @@ const float distance_fudge_km = 0.1; // stop turning if within distance_fudge km const float BAT_GPS_MUL = 15.51; -const float BAT_MBED_MUL = 10.26; \ No newline at end of file +const float BAT_MBED_MUL = 10.26; + +#endif \ No newline at end of file
--- a/main.cpp Thu Dec 13 23:56:31 2012 +0000 +++ b/main.cpp Mon Dec 17 23:42:34 2012 +0000 @@ -1,20 +1,24 @@ +/** +* HARP Version 2 +*/ + #include "mbed.h" #include "rtos.h" #include "buffered_serial.h" #include "ff.h" #include "BMP085.h" -#include "GPS_parser.h" +#include "nmea_parser.h" #include "config.h" I2C i2c(p9, p10); // sda, scl BMP085 alt_sensor(i2c); Serial pc(USBTX, USBRX); -BufferedSerial gps(NC, p14); +BufferedSerial gps; AnalogIn gps_battery(p20); AnalogIn mbed_battery(p19); -GPS_Parser nmea; +NmeaParser nmea; Semaphore parachute_sem(0); @@ -42,7 +46,7 @@ while(true) { //gps_led = !gps_led; - gps.read_line(buffer); + gps.get_line(buffer); int line_type = nmea.parse(buffer); //pc.puts(buffer); // send to log... @@ -51,13 +55,13 @@ queue_gps_line.put(message); // test altitude direction - release parachute thread to run - if(line_type == RMC && nmea.get_lock()) { + if(line_type == RMC && nmea.quality()) { if(UNLOCK_ON_FALL) { if(alt != 0) { // first time - alt = nmea.get_msl_altitude(); + alt = nmea.msl_altitude(); } else { alt_prev = alt; - alt = nmea.get_msl_altitude(); + alt = nmea.msl_altitude(); if(alt < alt_prev) // going down parachute_sem.release(); // let the parachute code execute } @@ -113,13 +117,13 @@ int bmp_pressure; if(WAIT_FOR_LOCK) { - while(!nmea.get_date()) Thread::wait(100); // wait for lock + while(!nmea.date()) Thread::wait(100); // wait for lock } t.start(); // start timer after lock sensor_line *message = mpool_sensor_line.alloc(); - sprintf(message->line, "Date: %d, Time: %f\r\nGPS Time (UTC),GPS Battery(V),mbed Battery(V),BMP085 Temperature(C),Pressure,Altitude(ft),GPS Altitude, GPS Course\r\n", nmea.get_date(), nmea.get_time()); + sprintf(message->line, "Date: %d, Time: %f\r\nGPS Time (UTC),GPS Battery(V),mbed Battery(V),BMP085 Temperature(C),Pressure,Altitude(ft),GPS Altitude, GPS Course\r\n", nmea.date(), nmea.utc_time()); queue_sensor_line.put(message); while(true) { @@ -128,7 +132,7 @@ sensor_line *message = mpool_sensor_line.alloc(); //timestamp - time = nmea.get_time(); + time = nmea.utc_time(); //gps battery gps_battery_voltage = gps_battery.read()*BAT_GPS_MUL; @@ -141,7 +145,7 @@ bmp_pressure = alt_sensor.get_pressure(); bmp_altitude = alt_sensor.get_altitude_ft(); - sprintf(message->line, "%f,%f,%f,%f,%d,%f,%f,%f\r\n", time,gps_battery_voltage,mbed_battery_voltage,bmp_temperature,bmp_pressure,bmp_altitude,nmea.get_altitude_ft(),nmea.get_course_d()); + sprintf(message->line, "%f,%f,%f,%f,%d,%f,%f,%f\r\n", time,gps_battery_voltage,mbed_battery_voltage,bmp_temperature,bmp_pressure,bmp_altitude,nmea.calc_altitude_ft(),nmea.track()); queue_sensor_line.put(message); } } @@ -164,8 +168,8 @@ if(distance < distance_fudge_km) continue; // dont do anything - float course = nmea.get_course_d(); - float course_to = nmea.calc_course_to(target_lat, target_lon); + float course = nmea.track(); + float course_to = nmea.calc_initial_bearing(target_lat, target_lon); float course_diff = course_to - course; if(course == 0.0) // not moving fast enough
--- a/mbed-rtos.lib Thu Dec 13 23:56:31 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#88a1a9c26ae3
--- a/mbed.bld Thu Dec 13 23:56:31 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63cdd78b2dc1 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmea_parser.lib Mon Dec 17 23:42:34 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tylerjw/code/nmea_parser/#a6e1707fdec0