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
5783733a
Commit
5783733a
authored
8 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added support to read the fallen status from the firmware.
parent
e026b57f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/darwin_robot.cpp
+34
-0
34 additions, 0 deletions
src/darwin_robot.cpp
src/darwin_robot.h
+4
-0
4 additions, 0 deletions
src/darwin_robot.h
with
38 additions
and
0 deletions
src/darwin_robot.cpp
+
34
−
0
View file @
5783733a
...
...
@@ -590,6 +590,40 @@ bool CDarwinRobot::mm_is_power_enabled(void)
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
}
bool
CDarwinRobot
::
mm_has_fallen
(
void
)
{
unsigned
char
value
;
if
(
this
->
robot_device
!=
NULL
)
{
this
->
robot_device
->
read_byte_register
(
DARWIN_MM_CNTRL
,
&
value
);
if
(
value
&
(
MANAGER_FWD_FALL
|
MANAGER_BWD_FALL
))
return
true
;
else
return
false
;
}
else
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
}
fall_t
CDarwinRobot
::
mm_get_fallen_position
(
void
)
{
unsigned
char
value
;
if
(
this
->
robot_device
!=
NULL
)
{
this
->
robot_device
->
read_byte_register
(
DARWIN_MM_CNTRL
,
&
value
);
if
(
value
&
MANAGER_FWD_FALL
)
return
MM_FWD_FALL
;
else
if
(
value
&
MANAGER_BWD_FALL
)
return
MM_BWD_FALL
;
else
return
MM_STANDING
;
}
else
throw
CDarwinRobotException
(
_HERE_
,
"Invalid robot device"
);
}
void
CDarwinRobot
::
mm_enable_servo
(
unsigned
char
servo_id
)
{
unsigned
char
value
;
...
...
This diff is collapsed.
Click to expand it.
src/darwin_robot.h
+
4
−
0
View file @
5783733a
...
...
@@ -50,6 +50,8 @@ typedef struct
}
TChargerData
;
#pragma pack (pop)
typedef
enum
{
MM_FWD_FALL
=
0
,
MM_BWD_FALL
=
1
,
MM_STANDING
=
2
}
fall_t
;
class
CDarwinRobot
{
private:
...
...
@@ -109,6 +111,8 @@ class CDarwinRobot
void
mm_enable_power
(
void
);
void
mm_disable_power
(
void
);
bool
mm_is_power_enabled
(
void
);
bool
mm_has_fallen
(
void
);
fall_t
mm_get_fallen_position
(
void
);
void
mm_enable_servo
(
unsigned
char
servo_id
);
void
mm_disable_servo
(
unsigned
char
servo_id
);
bool
mm_is_servo_enabled
(
unsigned
char
servo_id
);
...
...
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