I'm writing a program to control a RC boat via GPS waypoints.
I get this error when compiling my source code:
Couldn't determine program size: C:\Programmer\arduino-0012\hardware/tools/avr/bin/avr-size: 'C:\DOCUME~1\JONLOL~1\LOKALE~1\Temp\build5629.tmp\Boatbrain6.hex': No such file
I've located the offending line. Its this one:
engine_forward(engine_ignition_time);
It is line 6 in the function go_AtoB in the source code below:
#include <TinyGPS.h>
#include <NewSoftSerial.h>
TinyGPS gps;
NewSoftSerial softSerial(2, 3);
long current_lat, current_lon, dest_lats[100], dest_lons[100];
unsigned long course_to_dest, current_course, former_course, current_lat_age;
double ang_velocity = 0.0001; //last measured angular velocity in unknown unit
bool dest_reached;
bool navigate();
bool go_AtoB(long dest_lat, long dest_lon);
long get_course_to_dest(long dest_lat, long dest_lon);
bool gps_lock();
bool destination_reached(long dest_lat, long dest_lon);
bool engine_forward(int time);
bool engine_turn(long angle); //a course is an angle
void feedgps();
void setup() { softSerial.begin(4800); }
void loop() {}
bool navigate() {}
bool go_AtoB(long dest_lat, long dest_lon) {
long diff_course;
int engine_ignition_time = 100; //hundreds of seconds
if (!gps_lock()) {return false;}
//first round:
engine_forward(engine_ignition_time); //THIS IS THE OFFENDING LINE!!!
feedgps(); current_course = gps.course();
course_to_dest = get_course_to_dest(dest_lat, dest_lon);
diff_course = course_to_dest - current_course;
if (diff_course > 18000) {diff_course = diff_course-36000;}
if (diff_course < -18000) {diff_course = diff_course+36000;}
if (!engine_turn(diff_course)) {return false;} //evt. sæt fejlkode
engine_forward(engine_ignition_time);
//all other rounds:
while(!destination_reached(dest_lat, dest_lon)) {
former_course = current_course; feedgps();
current_course = gps.course();
course_to_dest = get_course_to_dest(dest_lat, dest_lon);
diff_course = course_to_dest - current_course;
if (diff_course > 18000) {diff_course = diff_course-36000;}
if (diff_course < -18000) {diff_course = diff_course+36000;}
if (!engine_turn(diff_course)) {return false;} //evt. sæt fejlkode
engine_forward(engine_ignition_time);
//correct angular velocity:
ang_velocity+= (ang_velocity*(course_to_dest-former_course))/(course_to_dest-current_course);
}
}
long get_course_to_dest(long dest_lat, long dest_lon) {}
bool destination_reached(long dest_lat, long dest_lon) {/*within 10m of target*/}
bool gps_lock() {
long lat=0, lon=0; unsigned long age, time; time = millis();
feedgps(); gps.get_position(&lat, &lon, &age);
while (lat == TinyGPS::GPS_INVALID_ANGLE) { //no lock has been obtained by the GPS
feedgps(); gps.get_position(&lat, &lon, &age);
if ((millis()-time) > 180000) { //no lock obtained within 3 minutes :(
return false; //could be extended to also tell WHY the go failed
}
}
return true;
}
bool engine_foward(int time) {} //remember to keep gps updated
bool engine_turn(long angle) { //remember to keep gps updated
double ignition_time;
ignition_time = abs(angle) * ang_velocity;
//return true if turn was successfull. Else return false.
}
void feedgps() {
while (softSerial.available()) {
gps.encode(softSerial.read());
}
}
What can be wrong?