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

Faz dois graficos agora

parent db860de7
No related branches found
No related tags found
No related merge requests found
set terminal png
set output 'posicoes.png'
set xlabel "x"
set autoscale
set ylabel "y"
set format y "%s"
set zlabel "Time"
set title "Simulacao de Posicoes"
set key reverse Left outside
set grid
set style data linespoints
splot "graph" using 1:2:3 title "Posicao"
set terminal png
set output 'velDir.png'
set xlabel "Velocidade/Direcao"
set autoscale
set ylabel "Tempo"
set format y "%s"
set title "Simulacao de Velocidade e Direcao"
set key reverse Left outside
set grid
set style data linespoints
splot "velo" using 1:2 title "Velocidade", \
"dir" using 1:2 title "Direcao"
......@@ -66,8 +66,9 @@ int main(int argc, char const *argv[]) {
Tuple *tuplas;
Robot r = {0, 0, 0};
FILE *graph = fopen("./graph", "w");
FILE *out = fopen("./table", "w");
if(graph == NULL || out == NULL) {
FILE *velo = fopen("./velo", "w");
FILE *dir = fopen("./dir", "w");
if(graph == NULL || velo == NULL || dir == NULL) {
puts("Erro ao criar arquivos de saída.");
exit(1);
}
......@@ -102,12 +103,14 @@ int main(int argc, char const *argv[]) {
// 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(out, "%f %f %d\n", velocidade, r.theta, frame);
fprintf(velo, "%f %d\n", velocidade, frame);
fprintf(dir, "%f %d\n", r.theta, frame);
moverRobo(&r,tuplas[i].x,tuplas[i].y);
}
fclose(graph);
fclose(out);
fclose(velo);
fclose(dir);
return 0;
}
gnuplot confPos.plt
gnuplot confR.plt
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment