Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 23:e1e6411e5221
- Parent:
- 22:fe373ba68df3
- Child:
- 24:7fa7383e1b07
--- a/main.cpp Tue Dec 04 16:32:40 2018 +0000 +++ b/main.cpp Tue Dec 04 16:56:52 2018 +0000 @@ -8,7 +8,7 @@ #define FILENAME "/robot/data.txt" //filename to write backups to //Team calibrated parameters for car and battery -#define LOW_BATTERY_VOLTAGE 4.2 //measured voltage where charging is required +#define LOW_BATTERY_VOLTAGE 4.75 //measured voltage where charging is required #define CHARGE_TIME 20 //in seconds. 1200 seconds = 20 minutes #define CROSSROAD_REFL_VAL 350 //sensor reading on PC0 and PC4 at crossroad @@ -26,7 +26,7 @@ #define MAX 1.0 #define MIN 0 #define OPTIMAL_SPEED 0.8 //Current targeted optimal speed -#define PIT_SPEED 0.3 //Speed on a pit lap to avoid overshooting the pit +#define PIT_SPEED 0.5 //Speed on a pit lap to avoid overshooting the pit #define DECELLERATION 0.1 //Rate of decelleration to avoid bumping // PID terms @@ -318,34 +318,17 @@ /* Separate functions - pit_navigation (entering pit from T-intersection all the way to the charger) pit_execution (only when connected to charger - voltage > V_CHARGER_MIN - add 1 to number of pitstops charge and wait for signal from the external charging circuit during charging: integrate v(t) dt, add to cumulative sum when fully charged (or signal goes high): Calculate delta_Wh ( integrate{ v(t) dt} * u * 1/3600 ) Calculate total_Wh - save progress data to file - leave the charger -> pass control to pit_exit - - pit_exit - reverse out of the pit back to T-intersection - continue line following away from T-intersection, recal sensors after a few seconds - + - AfterPitAdmin: Calibrate sensors, save state to file, - - show_results_on_display: - - check_sensors_for_errors: - - check_battery_voltage -> return true false - compare m3pi.battery() < V_CRITICAL - - - - + AfterPitAdmin: Calibrate sensors + show_results_on_display + check_sensors_for_errors */