Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bbb_bioloid_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
bbb_bioloid_robot_driver
Commits
8e471b93
Commit
8e471b93
authored
9 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added basic support for the zigbee module.
parent
73194dd8
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/bioloid_robot.cpp
+79
-0
79 additions, 0 deletions
src/bioloid_robot.cpp
src/bioloid_robot.h
+9
-0
9 additions, 0 deletions
src/bioloid_robot.h
src/examples/bioloid_robot_test.cpp
+5
-2
5 additions, 2 deletions
src/examples/bioloid_robot_test.cpp
with
93 additions
and
2 deletions
src/bioloid_robot.cpp
+
79
−
0
View file @
8e471b93
...
...
@@ -41,6 +41,8 @@ CBioloidRobot::CBioloidRobot(const std::string &name,std::string &serial_dev,int
this
->
start_pb
=
NULL
;
this
->
mode_pb
=
NULL
;
this
->
clear_pending_interrupts
();
/* get the current zigbee status */
this
->
robot_device
->
read_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
&
this
->
zigbee_status
);
}
catch
(
CException
&
e
){
if
(
this
->
robot_device
!=
NULL
)
this
->
dyn_server
->
free_device
(
id
);
...
...
@@ -308,6 +310,83 @@ void CBioloidRobot::adc_disable(void)
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
// zigbee interface
void
CBioloidRobot
::
zigbee_enable_power
(
void
)
{
if
(
this
->
robot_device
!=
NULL
)
{
this
->
zigbee_status
|=
0x01
;
this
->
robot_device
->
write_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
this
->
zigbee_status
);
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
void
CBioloidRobot
::
zigbee_disable_power
(
void
)
{
if
(
this
->
robot_device
!=
NULL
)
{
this
->
zigbee_status
&=
0xFE
;
this
->
robot_device
->
write_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
this
->
zigbee_status
);
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
bool
CBioloidRobot
::
is_zigbee_power_on
(
void
)
{
unsigned
char
value
;
if
(
this
->
robot_device
!=
NULL
)
{
this
->
robot_device
->
read_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
&
value
);
if
(
value
&
0x01
)
return
true
;
else
return
false
;
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
void
CBioloidRobot
::
zigbee_enable
(
void
)
{
if
(
this
->
robot_device
!=
NULL
)
{
this
->
zigbee_status
|=
0x02
;
this
->
robot_device
->
write_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
this
->
zigbee_status
);
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
void
CBioloidRobot
::
zigbee_disable
(
void
)
{
if
(
this
->
robot_device
!=
NULL
)
{
this
->
zigbee_status
&=
0xFD
;
this
->
robot_device
->
write_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
this
->
zigbee_status
);
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
bool
CBioloidRobot
::
is_zigbee_enabled
(
void
)
{
unsigned
char
value
;
if
(
this
->
robot_device
!=
NULL
)
{
this
->
robot_device
->
read_byte_register
(
BIOLOID_ZIGBEE_CNTRL
,
&
value
);
if
(
value
&
0x02
)
return
true
;
else
return
false
;
}
else
throw
CBioloidRobotException
(
_HERE_
,
"Invalid robot device"
);
}
// motion manager interface
/*void CBioloidRobot::mm_set_period(double period_ms)
{
...
...
This diff is collapsed.
Click to expand it.
src/bioloid_robot.h
+
9
−
0
View file @
8e471b93
...
...
@@ -45,6 +45,8 @@ class CBioloidRobot
CFunctor
*
reset_pb
;
CFunctor
*
start_pb
;
CFunctor
*
mode_pb
;
/* zigbee status */
unsigned
char
zigbee_status
;
protected:
static
void
*
ext_int_thread
(
void
*
param
);
void
clear_pending_interrupts
(
void
);
...
...
@@ -123,6 +125,13 @@ class CBioloidRobot
double
adc_get_temperature
(
void
);
double
adc_get_vrefint
(
void
);
void
adc_disable
(
void
);
// zigbee interface
void
zigbee_enable_power
(
void
);
void
zigbee_disable_power
(
void
);
bool
is_zigbee_power_on
(
void
);
void
zigbee_enable
(
void
);
void
zigbee_disable
(
void
);
bool
is_zigbee_enabled
(
void
);
// motion manager interface
/* void mm_set_period(double period_ms);
unsigned char mm_get_num_servos(void);
...
...
This diff is collapsed.
Click to expand it.
src/examples/bioloid_robot_test.cpp
+
5
−
2
View file @
8e471b93
...
...
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
tina.clear_led(USER1_LED);
tina.clear_led(USER2_LED);
sleep(10);*/
for
(
i
=
0
;
i
<
100
;
i
++
)
/*
for(i=0;i<100;i++)
{
std::cout << "temperature: " << tina.adc_get_temperature() << std::endl;
std::cout << "Vref_int: " << tina.adc_get_vrefint() << std::endl;
...
...
@@ -74,7 +74,10 @@ int main(int argc, char *argv[])
std::cout << "Channel 5: " << tina.adc_get_value(ADC_CH5) << std::endl;
std::cout << "Channel 6: " << tina.adc_get_value(ADC_CH6) << std::endl;
usleep(100000);
}
}*/
tina
.
zigbee_enable_power
();
sleep
(
10
);
tina
.
zigbee_disable_power
();
}
catch
(
CException
&
e
){
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
}
...
...
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