简体   繁体   中英

Publishing normals in ROS

Is there a way to publish normals of a given point cloud in ROS? I subscribe to my 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. Ideally I want to convert these normals to PoseStamped ROS messages and publish them.

Can anyone help me?

Thanks in advanced!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM