diff --git a/src/path.c b/src/path.c index 850f670..b5af1b4 100644 --- a/src/path.c +++ b/src/path.c @@ -26,7 +26,7 @@ path *path_new(map* m,vehicle *v){ /* Calculate a trivial path to the origin*/ /* Turn towards origin, take shorter direction*/ - angle = atan(v->y/v->x)*180/M_PI; + angle = atan2(v->y,v->x)*180/M_PI; stop = abs(angle - v->dir)/m->max_turn*1000; printf("Angle: %f stop: %f\n",angle,stop); if(angle - v->dir > 0){ @@ -60,7 +60,6 @@ void path_execute(trial* t,path* p){ } now = getcurts(t); - /*fprintf(stderr,"Now: %d TS: %d\n",now,clock());*/ /*magic number for latency, send messages that much earlier*/ while(tmp != NULL && now - 20 > tmp->ts){ tmp = (command*) g_queue_pop_head(p->commands);