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

Conflicts:

	src/radar_main.c
This commit is contained in:
Stefan Bühler 2008-07-13 23:36:46 +02:00
commit b835ace69f
4 changed files with 12 additions and 7 deletions

View File

@ -207,15 +207,13 @@ void trial_print(trial *t){
} }
void telemetry_matlab(gpointer tele, gpointer file){ void telemetry_matlab(gpointer tele, gpointer file){
FILE* outfile;
telemetry* t; telemetry* t;
vehicle * v;
outfile = (FILE*) file;
t = (telemetry*) tele; t = (telemetry*) tele;
v = &t->vehicle; vehicle_matlab((FILE*) file,t->ts,&t->vehicle);
}
fprintf(outfile,"v(end+1,:) = [%d %f, %f, %f, %f];\n",t->ts,v->x,v->y,v->dir,v->speed); void vehicle_matlab(FILE* out, timestamp ts, vehicle* v){
fprintf(out,"v(end+1,:) = [%d %f, %f, %f, %f];\n",ts,v->x,v->y,v->dir,v->speed);
} }
/*prints coordinate history to matlab compatible file*/ /*prints coordinate history to matlab compatible file*/

View File

@ -115,6 +115,7 @@ object* object_new(object_t type, double x, double y, double rad, double dir, do
/* debugging stuff */ /* debugging stuff */
void object_print(object *o); void object_print(object *o);
void vehicle_print(vehicle *v); void vehicle_print(vehicle *v);
void vehicle_matlab(FILE* out,timestamp ts, vehicle* v);
void telemetry_print(telemetry *t); void telemetry_print(telemetry *t);
void trial_print(trial *t); void trial_print(trial *t);
void trial_matlab(trial *t); void trial_matlab(trial *t);

View File

@ -1,6 +1,6 @@
#include "lookahead.h"
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "lookahead.h"
double turn2w(trial* t, turn_t turn) { double turn2w(trial* t, turn_t turn) {

View File

@ -7,7 +7,11 @@
#define LATENCY 2 #define LATENCY 2
void trial_loop(trial *t) { void trial_loop(trial *t) {
FILE* sim;
char name[80];
do { do {
sprintf(name,"simulation%d.m",t->runcnt);
sim = fopen(name,"w");
if (-1 == trial_wait_for_start(t)) return; if (-1 == trial_wait_for_start(t)) return;
if (t->finished) break; if (t->finished) break;
if (t->runcnt == 0) { if (t->runcnt == 0) {
@ -33,6 +37,7 @@ void trial_loop(trial *t) {
} }
while (t->alive) { while (t->alive) {
radar_dgl(t, getcurts(t) + LATENCY); radar_dgl(t, getcurts(t) + LATENCY);
vehicle_matlab(sim,t->sim.tm.ts,&t->sim.tm.vehicle);
goradar(t); goradar(t);
// vehicle_break(t); // vehicle_break(t);
// vehicle_hard_right(t); // vehicle_hard_right(t);
@ -40,6 +45,7 @@ void trial_loop(trial *t) {
// if (-1 == trial_wait_for_input(t)) return; // if (-1 == trial_wait_for_input(t)) return;
} }
trial_reset_run(t); trial_reset_run(t);
fclose(sim);
} while (!t->finished); } while (!t->finished);
} }