How to send PointCloud data to ROS

Typically: "How do I... ", "How can I... " questions
Post Reply
Hrithik Verma
Posts: 19
Joined: 07 Sep 2020, 21:20

How to send PointCloud data to ROS

Post by Hrithik Verma »

Actually I extracted data from camera x,y,z and I want to send it "sensor_msgs/PointCloud" ros message but there is some error which I'm not able to solve.

code to send data to ros topic:

Code: Select all

local msg ={
                             header={ stamp=simROS.getTime(), frame_id='a',
                             points={x=p[1], y=p[2] ,z=p[3]};
for sure there is some error in this


Code: Select all

57: read__sensor_msgs__PointCloud: field points: read__geometry_msgs__Point32: expected a table (in function 'simROS.publish@simExtROS')
    stack traceback:
        [C]: in function 'simROS.publish'
        [string "Vision_sensor@childScript"]:57: in function 'sysCall_vision'

for reference check this scene: ... sp=sharing

Posts: 837
Joined: 09 Sep 2013, 19:28

Re: How to send PointCloud data to ROS

Post by fferri »

Field points is an array. Your message should be something like:

Code: Select all

local msg={
      points={{x=p[1], y=p[2] ,z=p[3]}}

Post Reply