diff --git a/confPos.plt b/confPos.plt new file mode 100644 index 0000000000000000000000000000000000000000..65dd45720eb41979c5ebfc1ff212b669de5c6255 --- /dev/null +++ b/confPos.plt @@ -0,0 +1,19 @@ +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" + diff --git a/confR.plt b/confR.plt new file mode 100644 index 0000000000000000000000000000000000000000..bd0addb1c787ed43d8db24f963901388fc32f2ee --- /dev/null +++ b/confR.plt @@ -0,0 +1,19 @@ +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" + diff --git a/main.c b/main.c index a30979f810c4a301bfc8354810f9080b61ca996c..3b7b9d8fdca53664b335c468b47730f7a214fab0 100644 --- a/main.c +++ b/main.c @@ -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; } diff --git a/runPlot.sh b/runPlot.sh new file mode 100755 index 0000000000000000000000000000000000000000..a23be6dbefdbb4930d8c08905624549099b4c262 --- /dev/null +++ b/runPlot.sh @@ -0,0 +1,2 @@ +gnuplot confPos.plt +gnuplot confR.plt