Arrows pointing in wrong direction while visualizing in rviz.

asked 2018-03-04 07:44:08 -0600

BhanuKiran.Chaluvadi gravatar image


I converted LaserScan messages into point cloud and using kd tree and PCA i found the direction of normal at each point.

For debugging purposes i printed the arrow orientation.

visualization_msgs::Marker arrow;
 arrow.pose.orientation.x =  some value;
 arrow.pose.orientation.y = some value;
 arrow.pose.orientation.z = 0;

But while visualizing in rviz, few arrows are clearly pointing in the z direction. image description

edit retag flag offensive close merge delete



Your question is not really useful if you remove exactly the needed information (namely the values of your orientation). You did not mention the w-parameter, do you know that the orientation is a quaternion?

NEngelhard gravatar image NEngelhard  ( 2018-03-04 09:14:58 -0600 )edit

Also, the normal vector for points in a laser scan is not well defined as it can be rotated arbitrarily around the points. Your points are in 3d, although one component (e.g the z-value) is the same which degenerates the data. So the normals into z-direction are as plausible as the normals towards x

NEngelhard gravatar image NEngelhard  ( 2018-03-04 09:18:43 -0600 )edit

Yes you are right. I did not realize the orientation is a quaternion. I tried arrow.points.push_back(); and its giving me the expected result. Do u know a way to get a quaternion ? Currently i have information about the point(x,y,z) and the orientation of normal (x, y, z)

BhanuKiran.Chaluvadi gravatar image BhanuKiran.Chaluvadi  ( 2018-03-04 10:13:38 -0600 )edit

hello, I'm facing the same problem today! could you calculate your quaternion from the normal vector?

vrcat gravatar image vrcat  ( 2018-11-27 05:45:19 -0600 )edit