mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-12 04:29:49 +08:00
imu_to_tf: fixed fixed_frame to base_frame orientation when IMU's frame z axis is not up accordingly to base frame
This commit is contained in:
@@ -87,8 +87,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
tf::StampedTransform tmp;
|
tf::StampedTransform tmp;
|
||||||
tfListener_.lookupTransform(msg->header.frame_id, baseFrameId_, msg->header.stamp, tmp);
|
tfListener_.lookupTransform(baseFrameId_, msg->header.frame_id, msg->header.stamp, tmp);
|
||||||
tf::Transform t = tmp.inverse()*st*tmp;
|
tf::Quaternion q;
|
||||||
|
q.setRPY(0.0,0.0,tf::getYaw(tmp.getRotation()));
|
||||||
|
tf::Transform t = tf::Transform(q)*st*tmp.inverse(); // base_frame orientation
|
||||||
st.setRotation(t.getRotation());
|
st.setRotation(t.getRotation());
|
||||||
st.child_frame_id_ = baseFrameId_;
|
st.child_frame_id_ = baseFrameId_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user