Page 1 of 1

How to send PointCloud data to ROS

Posted: 14 Sep 2021, 13:56
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]};
                             }
                        --d.channels={name="abc",values=p}
                        simROS.publish(pub,msg)
for sure there is some error in this


error

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: https://drive.google.com/file/d/1AyX4O2 ... sp=sharing

Re: How to send PointCloud data to ROS

Posted: 14 Sep 2021, 21:49
by fferri
Field points is an array. Your message should be something like:

Code: Select all

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