Merge branch 'master' of gitosis@stbuehler.de:icfp11

This commit is contained in:
Stefan Bühler 2008-07-12 11:33:55 +02:00
commit 054e61e7c8
3 changed files with 23 additions and 0 deletions

View File

@ -172,7 +172,28 @@ void trial_print(trial *t){
/*perhaps add map_print and vehicle_print*/
}
void telemetry_matlab(gpointer tele, gpointer file){
FILE* outfile;
telemetry* t;
vehicle * v;
outfile = (FILE*) file;
t = (telemetry*) tele;
v = &t->vehicle;
fprintf(outfile,"v(end+1,:) = [%d %f, %f, %f, %f];\n",t->ts,v->x,v->y,v->dir,v->speed);
}
/*prints coordinate history to matlab compatible file*/
void trial_matlab(trial *t){
FILE* outfile;
outfile = fopen("velocity.m","w");
fprintf(outfile,"v = [];\n");
g_queue_foreach(&t->telemetry,telemetry_matlab,outfile);
fclose(outfile);
}
/* debugging stuff */
void object_print(object *o){

View File

@ -91,6 +91,7 @@ void object_print(object *o);
void vehicle_print(vehicle *v);
void telemetry_print(telemetry *t);
void trial_print(trial *t);
void trial_matlab(trial *t);
void map_print(map *m);

View File

@ -33,6 +33,7 @@ int main(int argc, char **argv) {
}
trial_loop(t);
trial_matlab(t);
trial_free(t);