Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_imu_msg_fix
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
labrobotica
ros
sensors
imu
iri_imu_msg_fix
Commits
80363d9d
Commit
80363d9d
authored
3 years ago
by
Carlos Neves
Browse files
Options
Downloads
Patches
Plain Diff
Add orientation conversion passing from quaternion to euler to quaternion again
parent
5f8c1cfa
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/imu_msg_fix_alg_node.h
+3
-0
3 additions, 0 deletions
include/imu_msg_fix_alg_node.h
src/imu_msg_fix_alg_node.cpp
+23
-1
23 additions, 1 deletion
src/imu_msg_fix_alg_node.cpp
with
26 additions
and
1 deletion
include/imu_msg_fix_alg_node.h
+
3
−
0
View file @
80363d9d
...
@@ -32,6 +32,9 @@
...
@@ -32,6 +32,9 @@
#include
<geometry_msgs/PoseStamped.h>
#include
<geometry_msgs/PoseStamped.h>
#include
<sensor_msgs/Imu.h>
#include
<sensor_msgs/Imu.h>
#include
<tf2_ros/transform_listener.h>
#include
<tf2_geometry_msgs/tf2_geometry_msgs.h>
// [service client headers]
// [service client headers]
// [action server client headers]
// [action server client headers]
...
...
This diff is collapsed.
Click to expand it.
src/imu_msg_fix_alg_node.cpp
+
23
−
1
View file @
80363d9d
...
@@ -105,10 +105,32 @@ void ImuMsgFixAlgNode::imu_in_callback(const sensor_msgs::Imu::ConstPtr& msg)
...
@@ -105,10 +105,32 @@ void ImuMsgFixAlgNode::imu_in_callback(const sensor_msgs::Imu::ConstPtr& msg)
this
->
imu_out_Imu_msg_
.
linear_acceleration_covariance
[
3
]
=
msg
->
linear_acceleration_covariance
[
1
];
this
->
imu_out_Imu_msg_
.
linear_acceleration_covariance
[
3
]
=
msg
->
linear_acceleration_covariance
[
1
];
this
->
imu_out_Imu_msg_
.
linear_acceleration_covariance
[
8
]
=
msg
->
linear_acceleration_covariance
[
8
];
this
->
imu_out_Imu_msg_
.
linear_acceleration_covariance
[
8
]
=
msg
->
linear_acceleration_covariance
[
8
];
}
}
this
->
imu_out_Imu_msg_
.
orientation
.
x
=
msg
->
orientation
.
y
;
/*this->imu_out_Imu_msg_.orientation.x=msg->orientation.y;
this->imu_out_Imu_msg_.orientation.y=msg->orientation.x;
this->imu_out_Imu_msg_.orientation.y=msg->orientation.x;
this->imu_out_Imu_msg_.orientation.z=-msg->orientation.z;
this->imu_out_Imu_msg_.orientation.z=-msg->orientation.z;
this->imu_out_Imu_msg_.orientation.w=-msg->orientation.w;
this->imu_out_Imu_msg_.orientation.w=-msg->orientation.w;
*/
geometry_msgs
::
Quaternion
quat_msg
=
msg
->
orientation
;
double
yaw
;
double
pitch
;
double
roll
;
tf2
::
Matrix3x3
(
tf2
::
Quaternion
(
quat_msg
.
x
,
quat_msg
.
y
,
quat_msg
.
z
,
quat_msg
.
w
)).
getEulerYPR
(
yaw
,
pitch
,
roll
);
//TODO: modify yaw, pitch or roll
double
tmp_pitch
=
pitch
;
pitch
=
roll
;
roll
=
tmp_pitch
;
yaw
=
-
yaw
;
tf2
::
Quaternion
quat_tf
;
quat_tf
.
setRPY
(
roll
,
pitch
,
yaw
);
tf2
::
convert
(
quat_tf
,
quat_msg
);
this
->
imu_out_Imu_msg_
.
orientation
=
quat_msg
;
this
->
imu_out_Imu_msg_
.
angular_velocity
.
x
=
msg
->
angular_velocity
.
y
;
this
->
imu_out_Imu_msg_
.
angular_velocity
.
x
=
msg
->
angular_velocity
.
y
;
this
->
imu_out_Imu_msg_
.
angular_velocity
.
y
=
msg
->
angular_velocity
.
x
;
this
->
imu_out_Imu_msg_
.
angular_velocity
.
y
=
msg
->
angular_velocity
.
x
;
...
...
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