mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-12 20:49:50 +08:00
fixed #172
This commit is contained in:
@@ -69,6 +69,13 @@ void transformToGeometryMsg(const rtabmap::Transform & transform, geometry_msgs:
|
|||||||
if(!transform.isNull())
|
if(!transform.isNull())
|
||||||
{
|
{
|
||||||
tf::transformEigenToMsg(transform.toEigen3d(), msg);
|
tf::transformEigenToMsg(transform.toEigen3d(), msg);
|
||||||
|
|
||||||
|
// make sure the quaternion is normalized
|
||||||
|
long double recipNorm = 1.0 / sqrt(msg.rotation.x * msg.rotation.x + msg.rotation.y * msg.rotation.y + msg.rotation.z * msg.rotation.z + msg.rotation.w * msg.rotation.w);
|
||||||
|
msg.rotation.x *= recipNorm;
|
||||||
|
msg.rotation.y *= recipNorm;
|
||||||
|
msg.rotation.z *= recipNorm;
|
||||||
|
msg.rotation.w *= recipNorm;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user