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 27:24fd8e32511c, committed 2013-01-10
- Comitter:
- tylerjw
- Date:
- Thu Jan 10 19:20:18 2013 +0000
- Parent:
- 26:85cdb1031eb1
- Child:
- 28:032d55fa57b8
- Commit message:
- added course_to and distance to sensor log
Changed in this revision
config.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/config.h Thu Jan 10 19:03:34 2013 +0000 +++ b/config.h Thu Jan 10 19:20:18 2013 +0000 @@ -14,7 +14,7 @@ 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; +const float BAT_GPS_MUL = 16.14; // values for calculating battery voltage +const float BAT_MBED_MUL = 10.35; #endif \ No newline at end of file
--- a/main.cpp Thu Jan 10 19:03:34 2013 +0000 +++ b/main.cpp Thu Jan 10 19:20:18 2013 +0000 @@ -123,6 +123,7 @@ float time; float gps_battery_voltage, mbed_battery_voltage; float temp; + float distance, course_to, course; sd_sem.wait(); // wait for the sd card to initialize and open files @@ -137,7 +138,7 @@ queue_sensor_line.put(message); message = mpool_sensor_line.alloc(); - sprintf(message->line, ",Temperature,GPS Altitude,GPS Course \r\n"); + sprintf(message->line, ",Temperature,GPS Altitude,GPS Course,Course to Target,Distance \r\n"); queue_sensor_line.put(message); while(true) { @@ -156,8 +157,13 @@ //temperature temp = temperature.sample_f(); + + //gps + distance = nmea.calc_dist_to_km(target_lat, target_lon); + course_to = nmea.calc_initial_bearing(target_lat, target_lon); + course = nmea.track(); - sprintf(message->line, "%f,%f,%f,%f,%f,%f\r\n", time,gps_battery_voltage,mbed_battery_voltage,temp,nmea.calc_altitude_ft(),nmea.track()); + sprintf(message->line, "%f,%f,%f,%f,%f,%f,%f,%f\r\n", time,gps_battery_voltage,mbed_battery_voltage,temp,nmea.calc_altitude_ft(),course,course_to,distance); queue_sensor_line.put(message); Thread::wait(100);