diff --git a/conf.plt b/conf.plt new file mode 100644 index 0000000000000000000000000000000000000000..0c042969353a4c47d01d9ae2206a76cc8f214186 --- /dev/null +++ b/conf.plt @@ -0,0 +1,20 @@ +set terminal png +set output 'simulation.png' + +set xlabel "x/velocidade" + +set autoscale + +set ylabel "y/angulo de deslocamento" +set format y "%s" +set zlabel "Time" + +set title "Simulation" +set key reverse Left outside +set grid + +set style data linespoints + +splot "graph" using 1:2:3 title "Posicao", \ + "table" using 1:2:3 title "Angulo/Velocidade" + diff --git a/main.c b/main.c index 4e722c81cae7ea8ed62afc55a559cc5489ed7a08..a30979f810c4a301bfc8354810f9080b61ca996c 100644 --- a/main.c +++ b/main.c @@ -47,7 +47,7 @@ double angleFromOrigin(int x, int y) { double angleFromPoint(int ox, int oy, int x, int y) { //ox e oy são os pontos da nova referência - double hip = distance(o)nx, oy, x, y); + double hip = distance(ox, oy, x, y); return acos((ox-x)/hip) * 180/PI; } @@ -96,13 +96,13 @@ int main(int argc, char const *argv[]) { double angle = angleFromPoint(r.x, r.y, tuplas[i].x, tuplas[i].y); double turn = angle - r.theta; // angulo para girar o robo //printf("DEBUG: %f %f\n", angle, r.theta); - fprintf(graph, "%d %d %d %f\n", tuplas[i].x, tuplas[i].y, frame, angle - r.theta); + fprintf(graph, "%d %d %d\n", tuplas[i].x, tuplas[i].y, frame); // Gira o robô r.theta += turn; // calcula a velocidade para as rodas distancia = distance(r.x, r.y, tuplas[i].x, tuplas[i].y); velocidade = velocity(distancia, tuplas[i].t); - fprintf(graph, "%f\n", velocidade); + fprintf(out, "%f %f %d\n", velocidade, r.theta, frame); moverRobo(&r,tuplas[i].x,tuplas[i].y); }