Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bno055_imu_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
Container Registry
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
labrobotica
drivers
bno055_imu_driver
Commits
3bdf2415
Commit
3bdf2415
authored
3 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added a function to set the units of the sensor (accelerations and angular speeds).
parent
f863e499
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
include/bno055_imu_driver.h
+1
-0
1 addition, 0 deletions
include/bno055_imu_driver.h
src/bno055_imu_driver.cpp
+37
-0
37 additions, 0 deletions
src/bno055_imu_driver.cpp
with
38 additions
and
0 deletions
include/bno055_imu_driver.h
+
1
−
0
View file @
3bdf2415
...
...
@@ -83,6 +83,7 @@ class CBNO055IMUDriver
void
get_remap_axis
(
std
::
vector
<
char
>
&
new_x
,
std
::
vector
<
char
>
&
new_y
,
std
::
vector
<
char
>
&
new_z
);
void
set_data_rate
(
double
rate_hz
);
double
get_data_rate
(
void
);
void
set_sensor_units
(
bool
degrees_s
,
bool
m_s_s
);
std
::
string
get_new_data_event_id
(
void
);
/* accelerometer functions */
std
::
vector
<
double
>
get_raw_accelerometer
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/bno055_imu_driver.cpp
+
37
−
0
View file @
3bdf2415
...
...
@@ -524,6 +524,43 @@ void CBNO055IMUDriver::get_sensor_units(void)
}
}
void
CBNO055IMUDriver
::
set_sensor_units
(
bool
degrees_s
,
bool
m_s_s
)
{
unsigned
char
units
=
0x00
;
try
{
if
(
m_s_s
)
{
units
&=
0xFE
;
this
->
accel_config
.
units
=
accel_linear
;
}
else
{
units
|=
0x01
;
this
->
accel_config
.
units
=
accel_gravity
;
}
if
(
degrees_s
)
{
units
&=
0xF9
;
this
->
gyro_config
.
units
=
gyro_deg
;
this
->
euler_units
=
euler_deg
;
}
else
{
units
|=
0x06
;
this
->
gyro_config
.
units
=
gyro_rad
;
this
->
euler_units
=
euler_rad
;
}
this
->
imu_access
.
enter
();
this
->
change_register_page
(
0x00
);
this
->
write_registers
(
0x3B
,
1
,
&
units
);
this
->
imu_access
.
exit
();
}
catch
(
CException
&
e
){
this
->
imu_access
.
exit
();
throw
;
}
}
void
CBNO055IMUDriver
::
get_sensor_configs
(
void
)
{
unsigned
char
configs
[
4
];
...
...
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