fixed some compiler errors

This commit is contained in:
Johannes Reinhardt 2008-07-13 18:56:28 +02:00
parent 41c4affc6c
commit 7af14cb4b7
2 changed files with 11 additions and 7 deletions

View File

@ -14,7 +14,7 @@ void check_coll(gpointer key, gpointer value, gpointer ud){
*ud.collision |= (sqrt(dx*dx + dy*dy) - value.rad) < 1;
}
void fit_parameter(telemetry* t1, telemetry* t2, telemetry* t3, double* a, double* aw){
void fit_parameter(telemetry* t1, telemetry* t2, telemetry* t3, map* m){
double a1,a2;
double w1,w2;
double dt1,dt2;
@ -29,12 +29,13 @@ void fit_parameter(telemetry* t1, telemetry* t2, telemetry* t3, double* a, doubl
fprintf(stderr,"Inkonsistent accelerations, inaccurate results possible\n");
}
*a = (a1 + a2)/2;
m->a = (a1 + a2)/2;
m->k = m->a/m->max_speed/m->max_speed;
w1 = (t2->dir - t1->dir)/dt1;
w2 = (t3->dir - t2->dir)/dt2;
*aw = 2*(w2 - w1)/(dt1 + dt2);
m->aw = 2*(w2 - w1)/(dt1 + dt2);
}
void dgl(trial* t, vehicle* after, vehicle* before, timestamp deltat){

View File

@ -1,6 +1,5 @@
#include "control.h"
#include "path.h"
#include <stdio.h>
@ -13,7 +12,7 @@ void trial_loop(trial *t) {
if (t->runcnt == 0) {
goradar(t);
vehicle_accel(t);
switch (t->v.turn) {
switch (t->vehicle.turn) {
case TURN_LEFT:
case TURN_STRAIGHT:
vehicle_hard_left(t); break;
@ -21,10 +20,14 @@ void trial_loop(trial *t) {
vehicle_hard_right(t); break;
default: break;
}
while (t->telemetry->length < 4) {
while (t->telemetry.length < 4) {
if (-1 == trial_wait_for_input(t)) return;
}
/* TODO: call constant calculatoin */
fit_parameter( (telemetry*) g_queue_peek_nth(&t->telemetry,1),
(telemetry*) g_queue_peek_nth(&t->telemetry,2),
(telemetry*) g_queue_peek_nth(&t->telemetry,3),
&t->map);
}
while (t->alive) {
simulate(t, getcurts(t) + LATENCY);