How to send PointCloud data to ROS

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

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]};
                             }
                        --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

fferri
Posts: 814
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={
      header=...,
      points={{x=p[1], y=p[2] ,z=p[3]}}
}

Post Reply