# Arrows pointing in wrong direction while visualizing in rviz.

Hi,

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.

edit retag close merge delete

1

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?

( 2018-03-04 09:14:58 -0500 )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

( 2018-03-04 09:18:43 -0500 )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)

( 2018-03-04 10:13:38 -0500 )edit

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

( 2018-11-27 05:45:19 -0500 )edit