Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
darwin_robot_driver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
humanoides
darwin
darwin_robot_driver
Commits
f26d94d0
Commit
f26d94d0
authored
8 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added a function to get the servos present.
parent
023dd8c1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/darwin_robot.cpp
+13
-0
13 additions, 0 deletions
src/darwin_robot.cpp
src/darwin_robot.h
+1
-0
1 addition, 0 deletions
src/darwin_robot.h
src/examples/darwin_action_test.cpp
+8
-1
8 additions, 1 deletion
src/examples/darwin_action_test.cpp
with
22 additions
and
1 deletion
src/darwin_robot.cpp
+
13
−
0
View file @
f26d94d0
...
@@ -457,6 +457,19 @@ unsigned char CDarwinRobot::mm_get_num_servos(void)
...
@@ -457,6 +457,19 @@ unsigned char CDarwinRobot::mm_get_num_servos(void)
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
}
}
unsigned
int
CDarwinRobot
::
mm_get_present_servos
(
void
)
{
unsigned
int
present_servos
;
if
(
this
->
robot_device
!=
NULL
)
{
this
->
robot_device
->
read_registers
(
DARWIN_MM_PRESENT_SERVOS1
,(
unsigned
char
*
)
&
present_servos
,
4
);
return
present_servos
;
}
else
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
}
void
CDarwinRobot
::
mm_start
(
void
)
void
CDarwinRobot
::
mm_start
(
void
)
{
{
if
(
this
->
robot_device
!=
NULL
)
if
(
this
->
robot_device
!=
NULL
)
...
...
This diff is collapsed.
Click to expand it.
src/darwin_robot.h
+
1
−
0
View file @
f26d94d0
...
@@ -83,6 +83,7 @@ class CDarwinRobot
...
@@ -83,6 +83,7 @@ class CDarwinRobot
void
mm_set_period
(
double
period_ms
);
void
mm_set_period
(
double
period_ms
);
double
mm_get_period
(
void
);
double
mm_get_period
(
void
);
unsigned
char
mm_get_num_servos
(
void
);
unsigned
char
mm_get_num_servos
(
void
);
unsigned
int
mm_get_present_servos
(
void
);
void
mm_start
(
void
);
void
mm_start
(
void
);
void
mm_stop
(
void
);
void
mm_stop
(
void
);
bool
mm_is_running
(
void
);
bool
mm_is_running
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/examples/darwin_action_test.cpp
+
8
−
1
View file @
f26d94d0
...
@@ -10,15 +10,19 @@ std::string robot_device="A4008atn";
...
@@ -10,15 +10,19 @@ std::string robot_device="A4008atn";
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
i
=
0
,
num_servos
;
int
i
=
0
,
num_servos
;
unsigned
int
present_servos
;
try
{
try
{
CDarwinRobot
darwin
(
"Darwin"
,
robot_device
,
1000000
,
0x02
);
CDarwinRobot
darwin
(
"Darwin"
,
robot_device
,
1000000
,
0x02
);
num_servos
=
darwin
.
mm_get_num_servos
();
num_servos
=
darwin
.
mm_get_num_servos
();
present_servos
=
darwin
.
mm_get_present_servos
();
std
::
cout
<<
"Found "
<<
num_servos
<<
" servos "
<<
std
::
endl
;
std
::
cout
<<
"Found "
<<
num_servos
<<
" servos "
<<
std
::
endl
;
std
::
cout
<<
"Present servos: "
<<
std
::
hex
<<
"0x"
<<
present_servos
<<
std
::
dec
<<
std
::
endl
;
// enable all servos and assign them to the action module
// enable all servos and assign them to the action module
darwin
.
mm_enable_power
();
darwin
.
mm_enable_power
();
for
(
i
=
1
;
i
<=
num_servos
;
i
++
)
sleep
(
1
);
for
(
i
=
0
;
i
<
MAX_NUM_SERVOS
;
i
++
)
{
{
darwin
.
mm_enable_servo
(
i
);
darwin
.
mm_enable_servo
(
i
);
darwin
.
mm_assign_module
(
i
,
DARWIN_MM_ACTION
);
darwin
.
mm_assign_module
(
i
,
DARWIN_MM_ACTION
);
...
@@ -28,7 +32,10 @@ int main(int argc, char *argv[])
...
@@ -28,7 +32,10 @@ int main(int argc, char *argv[])
darwin
.
action_load_page
(
WALK_READY
);
darwin
.
action_load_page
(
WALK_READY
);
darwin
.
action_start
();
darwin
.
action_start
();
while
(
darwin
.
action_is_page_running
())
while
(
darwin
.
action_is_page_running
())
{
std
::
cout
<<
"action running ... "
<<
std
::
endl
;
usleep
(
100000
);
usleep
(
100000
);
}
darwin
.
mm_stop
();
darwin
.
mm_stop
();
darwin
.
mm_disable_power
();
darwin
.
mm_disable_power
();
}
catch
(
CException
&
e
){
}
catch
(
CException
&
e
){
...
...
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