Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_imu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_ros
wolf_ros_imu
Commits
d33ae90b
Commit
d33ae90b
authored
4 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
added optional parameter to specify input in deg/s
parent
1b8fa08f
No related branches found
No related tags found
2 merge requests
!5
After cmake and const refactor
,
!3
new release
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/subscriber_imu.h
+1
-1
1 addition, 1 deletion
include/subscriber_imu.h
src/subscriber_imu.cpp
+14
-0
14 additions, 0 deletions
src/subscriber_imu.cpp
with
15 additions
and
1 deletion
include/subscriber_imu.h
+
1
−
1
View file @
d33ae90b
...
@@ -35,7 +35,7 @@ namespace wolf
...
@@ -35,7 +35,7 @@ namespace wolf
class
SubscriberImu
:
public
Subscriber
class
SubscriberImu
:
public
Subscriber
{
{
protected:
protected:
bool
flip_x_axis_
;
bool
flip_x_axis_
,
in_degrees_
;
std
::
string
cov_source_
;
std
::
string
cov_source_
;
bool
publish_bias_
;
bool
publish_bias_
;
ros
::
Publisher
pub_bias_accel_
,
pub_bias_gyro_
,
pub_imu_corrected_
;
ros
::
Publisher
pub_bias_accel_
,
pub_bias_gyro_
,
pub_imu_corrected_
;
...
...
This diff is collapsed.
Click to expand it.
src/subscriber_imu.cpp
+
14
−
0
View file @
d33ae90b
...
@@ -14,6 +14,15 @@ SubscriberImu::SubscriberImu(const std::string& _unique_name,
...
@@ -14,6 +14,15 @@ SubscriberImu::SubscriberImu(const std::string& _unique_name,
flip_x_axis_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/flip_x_axis"
);
flip_x_axis_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/flip_x_axis"
);
cov_source_
=
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/cov_source"
);
cov_source_
=
_server
.
getParam
<
std
::
string
>
(
prefix_
+
"/cov_source"
);
assert
(
cov_source_
==
"msg"
or
cov_source_
==
"sensor"
);
assert
(
cov_source_
==
"msg"
or
cov_source_
==
"sensor"
);
try
{
in_degrees_
=
_server
.
getParam
<
bool
>
(
prefix_
+
"/in_degrees"
);
}
catch
(...)
{
in_degrees_
=
false
;
}
}
}
void
SubscriberImu
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
void
SubscriberImu
::
initialize
(
ros
::
NodeHandle
&
nh
,
const
std
::
string
&
topic
)
...
@@ -48,6 +57,11 @@ void SubscriberImu::callback(const sensor_msgs::Imu::ConstPtr& msg)
...
@@ -48,6 +57,11 @@ void SubscriberImu::callback(const sensor_msgs::Imu::ConstPtr& msg)
msg
->
angular_velocity
.
z
;
msg
->
angular_velocity
.
z
;
}
}
if
(
in_degrees_
)
{
data
.
tail
<
3
>
()
*=
M_PI
/
180.0
;
}
Eigen
::
Matrix6d
cov
(
Eigen
::
Matrix6d
::
Zero
());
Eigen
::
Matrix6d
cov
(
Eigen
::
Matrix6d
::
Zero
());
cov
.
topLeftCorner
<
3
,
3
>
()
=
Eigen
::
Map
<
const
Eigen
::
Matrix3d
>
(
msg
->
linear_acceleration_covariance
.
data
());
cov
.
topLeftCorner
<
3
,
3
>
()
=
Eigen
::
Map
<
const
Eigen
::
Matrix3d
>
(
msg
->
linear_acceleration_covariance
.
data
());
cov
.
bottomRightCorner
<
3
,
3
>
()
=
Eigen
::
Map
<
const
Eigen
::
Matrix3d
>
(
msg
->
angular_velocity_covariance
.
data
());
cov
.
bottomRightCorner
<
3
,
3
>
()
=
Eigen
::
Map
<
const
Eigen
::
Matrix3d
>
(
msg
->
angular_velocity_covariance
.
data
());
...
...
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