ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The eigenvectors represent the rotation matrix of the ellipsoid in the space while the eigenvalues represent the scale of the sphere through the rotation frame axes. Here http://geus.wordpress.com/2011/09/15/how-to-represent-a-3d-normal-function-with-ros-rviz/ you can see a blog post with a more detailed code and a video with the results.
Here you can see a chunk of python code about how to solve the problem (thanks to hersh and dornhege for the suggestions):
enter code here
(eigValues,eigVectors) = numpy.linalg.eig (covMat)
eigx_n=PyKDL.Vector(eigVectors[0,0],eigVectors[0,1],eigVectors[0,2])
eigy_n=-PyKDL.Vector(eigVectors[1,0],eigVectors[1,1],eigVectors[1,2])
eigz_n=PyKDL.Vector(eigVectors[2,0],eigVectors[2,1],eigVectors[2,2])
eigx_n.Normalize()
eigy_n.Normalize()
eigz_n.Normalize()
rot = PyKDL.Rotation (eigx_n,eigy_n,eigz_n)
quat = rot.GetQuaternion ()
#painting the Gaussian Ellipsoid Marker
marker.pose.orientation.x =quat[0]
marker.pose.orientation.y = quat[1]
marker.pose.orientation.z = quat[2]
marker.pose.orientation.w = quat[3]
marker.scale.x = eigValues[0]
marker.scale.y = eigValues[1]
marker.scale.z =eigValues[2]
2 | No.2 Revision |
The eigenvectors represent the rotation matrix of the ellipsoid in the space while the eigenvalues represent the scale of the sphere through the rotation frame axes. Here http://geus.wordpress.com/2011/09/15/how-to-represent-a-3d-normal-function-with-ros-rviz/ you can see a blog post with a more detailed code and a video with the results.
Here you can see a chunk of python code about how to solve the problem (thanks to hersh and dornhege for the suggestions):
enter code here
(eigValues,eigVectors) = numpy.linalg.eig (covMat)
eigx_n=PyKDL.Vector(eigVectors[0,0],eigVectors[0,1],eigVectors[0,2])
eigy_n=-PyKDL.Vector(eigVectors[1,0],eigVectors[1,1],eigVectors[1,2])
eigz_n=PyKDL.Vector(eigVectors[2,0],eigVectors[2,1],eigVectors[2,2])
eigx_n.Normalize()
eigy_n.Normalize()
eigz_n.Normalize()
rot = PyKDL.Rotation (eigx_n,eigy_n,eigz_n)
quat = rot.GetQuaternion ()
#painting the Gaussian Ellipsoid Marker
marker.pose.orientation.x =quat[0]
marker.pose.orientation.y = quat[1]
marker.pose.orientation.z = quat[2]
marker.pose.orientation.w = quat[3]
marker.scale.x = eigValues[0]
marker.scale.y = eigValues[1]
marker.scale.z =eigValues[2]
3 | fixing an error in the code... |
The eigenvectors represent the rotation matrix of the ellipsoid while the eigenvalues represent the scale of the sphere through the rotation frame axes. Here http://geus.wordpress.com/2011/09/15/how-to-represent-a-3d-normal-function-with-ros-rviz/ you can see a blog post with a more detailed code and a video with the results.
Here you can see a chunk of python code about how to solve the problem (thanks to hersh and dornhege for the suggestions):
enter code here
(eigValues,eigVectors) = numpy.linalg.eig (covMat)
eigx_n=PyKDL.Vector(eigVectors[0,0],eigVectors[0,1],eigVectors[0,2])
eigy_n=-PyKDL.Vector(eigVectors[1,0],eigVectors[1,1],eigVectors[1,2])
eigz_n=PyKDL.Vector(eigVectors[2,0],eigVectors[2,1],eigVectors[2,2])
eigx_n.Normalize()
eigy_n.Normalize()
eigz_n.Normalize()
eigx_n=-PyKDL.Vector(eigVectors[0,0],eigVectors[1,0],eigVectors[2,0])
eigy_n=-PyKDL.Vector(eigVectors[0,1],eigVectors[1,1],eigVectors[2,1])
eigz_n=-PyKDL.Vector(eigVectors[0,2],eigVectors[1,2],eigVectors[2,2])
rot = PyKDL.Rotation (eigx_n,eigy_n,eigz_n)
quat = rot.GetQuaternion ()
#painting the Gaussian Ellipsoid Marker
marker.pose.orientation.x =quat[0]
marker.pose.orientation.y = quat[1]
marker.pose.orientation.z = quat[2]
marker.pose.orientation.w = quat[3]
marker.scale.x = eigValues[0]
marker.scale.y = eigValues[1]
marker.scale.z =eigValues[2]