Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
darwin_loc_nav
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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_loc_nav
Commits
824a33fd
Commit
824a33fd
authored
6 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added the simulated IMU to the example.
parent
2f7a2d2f
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/CMakeLists.txt
+2
-0
2 additions, 0 deletions
src/CMakeLists.txt
src/darwin_loc_nav.cpp
+34
-0
34 additions, 0 deletions
src/darwin_loc_nav.cpp
with
36 additions
and
0 deletions
src/CMakeLists.txt
+
2
−
0
View file @
824a33fd
...
@@ -17,6 +17,7 @@ INCLUDE_DIRECTORIES(${dynamixel_INCLUDE_DIR})
...
@@ -17,6 +17,7 @@ INCLUDE_DIRECTORIES(${dynamixel_INCLUDE_DIR})
INCLUDE_DIRECTORIES
(
${
darwin_robot_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
darwin_robot_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
OpenCV_INCLUDE_DIRS
}
)
INCLUDE_DIRECTORIES
(
${
OpenCV_INCLUDE_DIRS
}
)
INCLUDE_DIRECTORIES
(
${
detectqrcode_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
detectqrcode_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
bno055_imu_driver_INCLUDE_DIR
}
)
# application source files
# application source files
SET
(
sources darwin_loc_nav.cpp
)
SET
(
sources darwin_loc_nav.cpp
)
# application header files
# application header files
...
@@ -30,3 +31,4 @@ TARGET_LINK_LIBRARIES(darwin_loc_nav ${dynamixel_LIBRARY})
...
@@ -30,3 +31,4 @@ TARGET_LINK_LIBRARIES(darwin_loc_nav ${dynamixel_LIBRARY})
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
darwin_robot_LIBRARY
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
darwin_robot_LIBRARY
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
OpenCV_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
OpenCV_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
detectqrcode_LIBRARY
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
detectqrcode_LIBRARY
}
)
TARGET_LINK_LIBRARIES
(
darwin_loc_nav
${
bno055_imu_driver_LIBRARY
}
)
This diff is collapsed.
Click to expand it.
src/darwin_loc_nav.cpp
+
34
−
0
View file @
824a33fd
...
@@ -2,13 +2,16 @@
...
@@ -2,13 +2,16 @@
#include
"darwin_robot_exceptions.h"
#include
"darwin_robot_exceptions.h"
#include
"action_id.h"
#include
"action_id.h"
#include
"detectqrcode.h"
#include
"detectqrcode.h"
#include
"bno055_imu_driver.h"
#include
<iostream>
#include
<iostream>
#ifdef _SIM
#ifdef _SIM
std
::
string
robot_device
=
"/dev/pts/20"
;
std
::
string
robot_device
=
"/dev/pts/20"
;
std
::
string
imu_device
=
"/dev/pts/23"
;
#else
#else
std
::
string
robot_device
=
"A603LOBS"
;
std
::
string
robot_device
=
"A603LOBS"
;
std
::
string
imu_device
=
"/dev/ttyUSB0"
;
#endif
#endif
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
...
@@ -17,6 +20,7 @@ int main(int argc, char *argv[])
...
@@ -17,6 +20,7 @@ int main(int argc, char *argv[])
cv
::
Mat
gray
;
cv
::
Mat
gray
;
int
i
=
0
,
num_servos
;
int
i
=
0
,
num_servos
;
unsigned
int
present_servos
;
unsigned
int
present_servos
;
bool
accel_cal
,
mag_cal
,
gyro_cal
;
std
::
vector
<
std
::
vector
<
cv
::
Point
>
>
squares
;
std
::
vector
<
std
::
vector
<
cv
::
Point
>
>
squares
;
try
{
try
{
...
@@ -40,6 +44,36 @@ int main(int argc, char *argv[])
...
@@ -40,6 +44,36 @@ int main(int argc, char *argv[])
cv
::
namedWindow
(
"QRcode"
,
1
);
cv
::
namedWindow
(
"QRcode"
,
1
);
/* initialize IMU */
CBNO055IMUDriver
imu
(
"darwin_imu"
);
imu
.
open
(
imu_device
);
try
{
imu
.
load_calibration
(
"bno055.cal"
);
do
{
imu
.
set_operation_mode
(
ndof_mode
);
accel_cal
=
imu
.
is_accelerometer_calibrated
();
std
::
cout
<<
"Accelerometer calibrated: "
<<
accel_cal
<<
std
::
endl
;
mag_cal
=
imu
.
is_magnetometer_calibrated
();
std
::
cout
<<
"Magnetometer calibrated: "
<<
mag_cal
<<
std
::
endl
;
gyro_cal
=
imu
.
is_gyroscope_calibrated
();
std
::
cout
<<
"Gyroscope calibrated: "
<<
gyro_cal
<<
std
::
endl
;
sleep
(
1
);
}
while
(
!
accel_cal
||
!
mag_cal
||
!
gyro_cal
);
}
catch
(
CException
&
e
){
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
do
{
imu
.
set_operation_mode
(
ndof_mode
);
accel_cal
=
imu
.
is_accelerometer_calibrated
();
std
::
cout
<<
"Accelerometer calibrated: "
<<
accel_cal
<<
std
::
endl
;
mag_cal
=
imu
.
is_magnetometer_calibrated
();
std
::
cout
<<
"Magnetometer calibrated: "
<<
mag_cal
<<
std
::
endl
;
gyro_cal
=
imu
.
is_gyroscope_calibrated
();
std
::
cout
<<
"Gyroscope calibrated: "
<<
gyro_cal
<<
std
::
endl
;
sleep
(
1
);
}
while
(
!
accel_cal
||
!
mag_cal
||
!
gyro_cal
);
imu
.
save_calibration
(
"bno055.cal"
);
}
/* initialize robot */
/* initialize robot */
num_servos
=
darwin
.
mm_get_num_servos
();
num_servos
=
darwin
.
mm_get_num_servos
();
present_servos
=
darwin
.
mm_get_present_servos
();
present_servos
=
darwin
.
mm_get_present_servos
();
...
...
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