1

I'm new to the ROS and i have a struggle with the normals. So here is my situation.

I subscribe to my camera (realsense camera), I get the point cloud, I convert the point cloud from ROS_to_pcl and finally I use the function make_NormalEstimation() of python_pcl to get the normals. So far so good! Now I want to publish somehow these normals to a ROS topic and by publishing i mean visualizing them also in RVIZ. The python_pcl function make_NormalEstimation() returns 4 values in the form of a vector. The 3 first values are normal_x, normal_y, normal_z and the 4th value is the curvature. I want to publish and visualize the normals in RVIZ through PoseStamed messages. As far as i know a PoseStamped message needs a Pose and a Quaternion. For the Pose field i use the x, y, z of the desired point in my point cloud i want to find the normal. But when it comes for the quaternion (and here is my main problem and struggle) i don't know what to use! I tried to use the returned values as they were quaternion_x, quaternion_y, quaernion_z, quaternion_w but the results where not so good...

So. my questions are:

  • How can i use the returned values of make_NormalEstimation() to create a PoseStamed message?
  • Is there a way to transform the returned values into quaternion?
  • Am i missing something about the returned values?
  • Is there another way of finding and using normals in ROS?
  • How can i generate and publish a normal in ROS? Not only it's normal_x, normal_y, normal_z values but also it's orientation.
  • Do i have to publish both it's normal_x, normal_y, normal_z and orientation or just it's normal_x, normal_y, normal_z values? And if so how will a robot know the orientation it needs to approach a point of interest?

Sorry for the chaos in my questions! I really hope they make sense!

Thanks in advance!

  • Maybe you could provide some code and other data to help understand your problem.. – hpchavaz Nov 13 '21 at 11:34
  • Yes, sorry for the chaos in my post. I edited it to make my question more clear. My code is a little bit long to post it here but if you steal need it i will try to add it. – Dimitris Tsolakidis Nov 15 '21 at 08:55

1 Answers1

0

You can simply setup a publisher and create messages on demand for every normal in your list.

import rospy
from geometry_msgs import PoseStamped

pose_pub = rospy.Publisher('/normals_topic', PoseStamped, queue_size=10)
def calc_and_publish():
    #Calculate your normals
    norms = calculate_norms()

    for n in norms:
        output_pose = PoseStamped
        output_pose.pose.position.x = n[0]
        output_pose.pose.position.y = n[1]
        output_pose.pose.position.z = n[2]
        
        pose_pub.publish(output_pose)

I should note that this can eat up a lot of resources since you'll be having to loop over the pointcloud multiple times per message.

BTables
  • 4,413
  • 2
  • 11
  • 30