Skip to content
Snippets Groups Projects
Commit 18ea5b87 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Merge branch 'master' into outFiles

Conflicts:
	main.c
parents 5a15c9d3 b28badee
Branches outFiles
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ typedef struct { ...@@ -20,7 +20,7 @@ typedef struct {
} Robot; } Robot;
double velocity(double dist, double tempo){ double velocity(double dist, double tempo){
return (dist / tempo); return (dist / (tempo/1000));
} }
double distance(int xa, int ya, int xb,int yb){ double distance(int xa, int ya, int xb,int yb){
...@@ -45,6 +45,15 @@ double angleFromOrigin(int x, int y) { ...@@ -45,6 +45,15 @@ double angleFromOrigin(int x, int y) {
return acos(x/hip) * 180/PI; return acos(x/hip) * 180/PI;
} }
void moverRobo(Robot *r, int x, int y){
/* Deveríamos "acionar os motores"
* e realmente movimentar o robô
* Contudo estamos só simulando esse movimento
*/
r->x = x;
r->y = y;
}
int main(int argc, char const *argv[]) { int main(int argc, char const *argv[]) {
int t_size; int t_size;
double velocidade, distancia; double velocidade, distancia;
...@@ -83,6 +92,7 @@ int main(int argc, char const *argv[]) { ...@@ -83,6 +92,7 @@ int main(int argc, char const *argv[]) {
distancia = distance(r.x, r.y, tuplas[i].x, tuplas[i].y); distancia = distance(r.x, r.y, tuplas[i].x, tuplas[i].y);
velocidade = velocity(distancia, tuplas[i].t); velocidade = velocity(distancia, tuplas[i].t);
fprintf(graph, "w %f\n", velocidade); fprintf(graph, "w %f\n", velocidade);
moverRobo(&r,tuplas[i].x,tuplas[i].y);
} }
fclose(graph); fclose(graph);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment