Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T800
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vytor Calixto
T800
Commits
35d4123c
Commit
35d4123c
authored
9 years ago
by
Victor Perszel
Browse files
Options
Downloads
Patches
Plain Diff
Missing includes added, function velocity created and added to main with velocity
parent
88385fcc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.c
+10
-1
10 additions, 1 deletion
main.c
with
10 additions
and
1 deletion
main.c
+
10
−
1
View file @
35d4123c
#include
<stdio.h>
#include
<stdio.h>
#include
<math.h>
#include
<stdlib.h>
#define L 0.15
#define L 0.15
// L = Distancia centro da roda - eixo em cm
// L = Distancia centro da roda - eixo em cm
...
@@ -16,12 +18,17 @@ typedef struct {
...
@@ -16,12 +18,17 @@ typedef struct {
double
theta
;
double
theta
;
}
Robot
;
}
Robot
;
double
menorDistancia
(
int
xa
,
int
ya
,
int
xb
,
int
yb
){
double
velocity
(
double
dist
,
double
tempo
){
return
(
dist
/
tempo
);
}
double
distance
(
int
xa
,
int
ya
,
int
xb
,
int
yb
){
return
(
sqrt
((
xb
-
xa
)
*
(
xb
-
xa
)
+
(
yb
-
ya
)
*
(
yb
-
ya
)));
return
(
sqrt
((
xb
-
xa
)
*
(
xb
-
xa
)
+
(
yb
-
ya
)
*
(
yb
-
ya
)));
}
}
int
main
(
int
argc
,
char
const
*
argv
[])
{
int
main
(
int
argc
,
char
const
*
argv
[])
{
int
t_size
;
int
t_size
;
double
velocidade
,
distancia
;
Tuple
*
tuplas
;
Tuple
*
tuplas
;
Robot
r
=
{
0
,
0
,
0
};
Robot
r
=
{
0
,
0
,
0
};
puts
(
"Quantos pontos há na lista? Mínimo de 10 elementos."
);
puts
(
"Quantos pontos há na lista? Mínimo de 10 elementos."
);
...
@@ -46,6 +53,8 @@ int main(int argc, char const *argv[]) {
...
@@ -46,6 +53,8 @@ int main(int argc, char const *argv[]) {
// pega o ângulo entre a posição do robô e o próximo ponto
// pega o ângulo entre a posição do robô e o próximo ponto
// gira o robô
// gira o robô
// calcula a velocidade para as rodas
// calcula a velocidade para as rodas
distancia
=
distance
(
r
.
x
,
r
.
y
,
tuplas
[
i
].
x
,
tuplas
[
i
].
y
);
velocidade
=
velocity
(
distancia
,
tuplas
[
i
].
t
);
}
}
// gerar tabela e grafico
// gerar tabela e grafico
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment