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.
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?
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
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)hello, I'm facing the same problem today! could you calculate your quaternion from the normal vector?