Skip to content
Snippets Groups Projects
Commit db860de7 authored by Leandro Rodrigues's avatar Leandro Rodrigues
Browse files

Alteracoes no main para gnuplot e arquivo de configuracao

parent fa7786af
Branches
No related tags found
No related merge requests found
conf.plt 0 → 100644
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"
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment