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
80e193a5
Commit
80e193a5
authored
5 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Modified the example to interface with the ADC module.
parent
61a5f3e5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/examples/CMakeLists.txt
+2
-2
2 additions, 2 deletions
src/examples/CMakeLists.txt
src/examples/darwin_adc_test.cpp
+22
-20
22 additions, 20 deletions
src/examples/darwin_adc_test.cpp
with
24 additions
and
22 deletions
src/examples/CMakeLists.txt
+
2
−
2
View file @
80e193a5
...
...
@@ -9,9 +9,9 @@ TARGET_LINK_LIBRARIES(darwin_manager_test darwin_robot)
#TARGET_LINK_LIBRARIES(darwin_gpio_test darwin_robot)
# create an example application
#
ADD_EXECUTABLE(darwin_adc_test darwin_adc_test.cpp)
ADD_EXECUTABLE
(
darwin_adc_test darwin_adc_test.cpp
)
# link necessary libraries
#
TARGET_LINK_LIBRARIES(darwin_adc_test darwin_robot)
TARGET_LINK_LIBRARIES
(
darwin_adc_test darwin_robot
)
# create an example application
ADD_EXECUTABLE
(
darwin_imu_test darwin_imu_test.cpp
)
...
...
This diff is collapsed.
Click to expand it.
src/examples/darwin_adc_test.cpp
+
22
−
20
View file @
80e193a5
#include
"darwin_
robot
.h"
#include
"darwin_
adc
.h"
#include
"darwin_robot_exceptions.h"
#include
<iostream>
std
::
string
robot_device
=
"A603LOBS"
;
//std::string robot_device="A4008atn";
#ifdef _SIM
std
::
string
robot_device
=
"/tmp/darwin_driver"
;
#else
std
::
string
robot_device
=
"/dev/ttyACM0"
;
#endif
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
=
0
;
try
{
CDarwinRobot
darwin
(
"Darwin"
,
robot_device
,
1000000
,
0x02
);
std
::
cout
<<
"found darwin controller"
<<
std
::
endl
;
darwin
.
adc_start
();
for
(
i
=
0
;
i
<
5000
;
i
++
)
CDarwinADC
adc
(
"Darwin"
,
robot_device
,
1000000
,
0x01
);
adc
.
start
();
for
(
i
=
0
;
i
<
50
;
i
++
)
{
std
::
cout
<<
"Temperature: "
<<
darwin
.
adc
_
get_temperature
()
<<
std
::
endl
;
std
::
cout
<<
"Channel1: "
<<
darwin
.
adc
_
get_value
(
ADC_CH1
)
<<
std
::
endl
;
std
::
cout
<<
"Channel2: "
<<
darwin
.
adc
_
get_value
(
ADC_CH2
)
<<
std
::
endl
;
std
::
cout
<<
"Channel3: "
<<
darwin
.
adc
_
get_value
(
ADC_CH3
)
<<
std
::
endl
;
std
::
cout
<<
"Channel4: "
<<
darwin
.
adc
_
get_value
(
ADC_CH4
)
<<
std
::
endl
;
std
::
cout
<<
"Channel5: "
<<
darwin
.
adc
_
get_value
(
ADC_CH5
)
<<
std
::
endl
;
std
::
cout
<<
"Channel6: "
<<
darwin
.
adc
_
get_value
(
ADC_CH6
)
<<
std
::
endl
;
std
::
cout
<<
"Channel7: "
<<
darwin
.
adc
_
get_value
(
ADC_CH7
)
<<
std
::
endl
;
std
::
cout
<<
"Channel8: "
<<
darwin
.
adc
_
get_value
(
ADC_CH8
)
<<
std
::
endl
;
std
::
cout
<<
"Channel9: "
<<
darwin
.
adc
_
get_value
(
ADC_CH9
)
<<
std
::
endl
;
std
::
cout
<<
"Channel10: "
<<
darwin
.
adc
_
get_value
(
ADC_CH10
)
<<
std
::
endl
;
std
::
cout
<<
"Channel12: "
<<
darwin
.
adc
_
get_value
(
ADC_CH12
)
<<
std
::
endl
;
std
::
cout
<<
"Temperature: "
<<
adc
.
get_temperature
()
<<
std
::
endl
;
std
::
cout
<<
"Channel1: "
<<
adc
.
get_value
(
ADC_CH1
)
<<
std
::
endl
;
std
::
cout
<<
"Channel2: "
<<
adc
.
get_value
(
ADC_CH2
)
<<
std
::
endl
;
std
::
cout
<<
"Channel3: "
<<
adc
.
get_value
(
ADC_CH3
)
<<
std
::
endl
;
std
::
cout
<<
"Channel4: "
<<
adc
.
get_value
(
ADC_CH4
)
<<
std
::
endl
;
std
::
cout
<<
"Channel5: "
<<
adc
.
get_value
(
ADC_CH5
)
<<
std
::
endl
;
std
::
cout
<<
"Channel6: "
<<
adc
.
get_value
(
ADC_CH6
)
<<
std
::
endl
;
std
::
cout
<<
"Channel7: "
<<
adc
.
get_value
(
ADC_CH7
)
<<
std
::
endl
;
std
::
cout
<<
"Channel8: "
<<
adc
.
get_value
(
ADC_CH8
)
<<
std
::
endl
;
std
::
cout
<<
"Channel9: "
<<
adc
.
get_value
(
ADC_CH9
)
<<
std
::
endl
;
std
::
cout
<<
"Channel10: "
<<
adc
.
get_value
(
ADC_CH10
)
<<
std
::
endl
;
std
::
cout
<<
"Channel12: "
<<
adc
.
get_value
(
ADC_CH12
)
<<
std
::
endl
;
usleep
(
100000
);
}
darwin
.
adc
_
stop
();
adc
.
stop
();
}
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