Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
goroyeh
Mobilebot
Commits
7ed019d0
Commit
7ed019d0
authored
Aug 26, 2020
by
Demo User
Browse files
fixed drive_simple
parent
a1cbf98c
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
7ed019d0
...
@@ -11,3 +11,8 @@ java/rob550.jar
...
@@ -11,3 +11,8 @@ java/rob550.jar
java/src/*
java/src/*
optitrack/common/lib/libcommon.a
optitrack/common/lib/libcommon.a
python/lcmtypes/*
python/lcmtypes/*
.DS_Store
.vscode-server
.ssh
.nano
.cmake
drive_simple/drive_simple.c
View file @
7ed019d0
...
@@ -37,18 +37,6 @@ int mot_r_pol;
...
@@ -37,18 +37,6 @@ int mot_r_pol;
int
enc_l_pol
;
int
enc_l_pol
;
int
enc_r_pol
;
int
enc_r_pol
;
// printed if some invalid argument was given
static
void
__print_usage
(
void
)
{
printf
(
"
\n
"
);
printf
(
"-l {pol} polarity of left motor (-1 or 1)
\n
"
);
printf
(
"-r {pol} polarity of right motor (-1 or 1)
\n
"
);
printf
(
"-le {pol} polarity of left encoder (-1 or 1)
\n
"
);
printf
(
"-re {pol} polarity of right encoder (-1 or 1)
\n
"
);
printf
(
"-h print this help message
\n
"
);
printf
(
"
\n
"
);
}
/*******************************************************************************
/*******************************************************************************
* int main()
* int main()
*
*
...
@@ -66,10 +54,10 @@ int main(int argc, char *argv[]){
...
@@ -66,10 +54,10 @@ int main(int argc, char *argv[]){
enc_l_pol
=
atoi
(
argv
[
3
]);
enc_l_pol
=
atoi
(
argv
[
3
]);
enc_r_pol
=
atoi
(
argv
[
4
]);
enc_r_pol
=
atoi
(
argv
[
4
]);
if
(
(
mot_l_pol
!=
1
)
&
(
mot_l_pol
!=
-
1
)
|
if
(
(
(
mot_l_pol
!=
1
)
&
(
mot_l_pol
!=
-
1
)
)
|
(
mot_r_pol
!=
1
)
&
(
mot_r_pol
!=
-
1
)
|
(
(
mot_r_pol
!=
1
)
&
(
mot_r_pol
!=
-
1
)
)
|
(
enc_l_pol
!=
1
)
&
(
enc_l_pol
!=
-
1
)
|
(
(
enc_l_pol
!=
1
)
&
(
enc_l_pol
!=
-
1
)
)
|
(
enc_r_pol
!=
1
)
&
(
enc_r_pol
!=
-
1
)){
(
(
enc_r_pol
!=
1
)
&
(
enc_r_pol
!=
-
1
))
)
{
printf
(
"Usage: polarities must be -1 or 1"
);
printf
(
"Usage: polarities must be -1 or 1"
);
return
0
;
return
0
;
}
}
...
@@ -118,7 +106,6 @@ int main(int argc, char *argv[]){
...
@@ -118,7 +106,6 @@ int main(int argc, char *argv[]){
rc_motor_set
(
2
,
0
.
0
);
rc_motor_set
(
2
,
0
.
0
);
printf
(
"timeout...
\r
"
);
printf
(
"timeout...
\r
"
);
}
}
printf
()
// define a timeout (for erroring out) and the delay time
// define a timeout (for erroring out) and the delay time
lcm_handle_timeout
(
lcm
,
1
);
lcm_handle_timeout
(
lcm
,
1
);
rc_nanosleep
(
1E9
/
100
);
//handle at 10Hz
rc_nanosleep
(
1E9
/
100
);
//handle at 10Hz
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment