added some debug functions

This commit is contained in:
Johannes Reinhardt 2008-07-12 03:10:38 +02:00
parent 1e4dbb03d6
commit f9d0de1edd
2 changed files with 33 additions and 0 deletions

View File

@ -69,6 +69,12 @@ static telemetry* telemetry_new() {
return te; return te;
} }
void telemetry_print(telemetry *t){
fprintf(stderr,"Telemetry object:\n");
fprintf(stderr,"\tTimestamp: %d Number of Objects: %d Vehicle:\n",t->ts,t->objects->len) ;
vehicle_print(&t->vehicle);
}
trial *trial_new(const char *hostname, const char *port) { trial *trial_new(const char *hostname, const char *port) {
trial *t; trial *t;
int sock; int sock;
@ -144,3 +150,22 @@ void trial_free(trial *t) {
control_parser_free(t); control_parser_free(t);
g_slice_free(trial, t); g_slice_free(trial, t);
} }
void trial_print(trial *t){
fprintf(stderr,"Trial Alive: %d Last Timestep: %d Socket: %d\n",t->alive,t->last_ts,t->socket);
/*perhaps add map_print and vehicle_print*/
}
/* debugging stuff */
void object_print(object *o){
fprintf(stderr,"Object: Type: %d x: %f, y: %f, rad: %f dir: %f speed: %f\n",o->type,o->x,o->y,o->rad,o->dir,o->speed);
}
void vehicle_print(vehicle *v){
fprintf(stderr,"Vehicle: Accel: %d Turn: %d x: %f y: %f dir: %f speed: %f\n",v->accel,v->turn,v->x,v->y,v->dir,v->speed);
}
void map_print(map *m){}

View File

@ -81,6 +81,14 @@ void trial_check_input(trial *t);
void trial_wait_for_input(trial *t); void trial_wait_for_input(trial *t);
void trial_free(trial *t); void trial_free(trial *t);
/* debugging stuff */
void object_print(object *o);
void vehicle_print(vehicle *v);
void telemetry_print(telemetry *t);
void trial_print(trial *t);
void map_print(map *m);
INLINE void vehicle_accel(trial *t); INLINE void vehicle_accel(trial *t);
INLINE void vehicle_roll(trial *t); INLINE void vehicle_roll(trial *t);
INLINE void vehicle_break(trial *t); INLINE void vehicle_break(trial *t);