ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to know Ring/Layer/Laser(/Color) from PointCloud2

asked 2018-11-25 05:43:14 -0500

Cicilia gravatar image

updated 2018-11-25 05:45:30 -0500

Hi, friend. I am using Ubuntu 14.04 and ROS Indigo for the sensor Velodyne VLP-16. I am trying to extract the useful Information form PointCloud2 and reorder them to the format that I needed.

Now I can extract the x,y,z coordinates in python, but my current question is:

How can I know the layer of points? (How can I know which laser of 16 lasers measured that point?)

--> Contain the colors (r,g,b values.) those info? How can I from the color values like below know the layers? Sorry i don´t find the definition of rgb or examples.

r = (pack & 0x00FF0000)>> 16
g = (pack & 0x0000FF00)>> 8
b = (pack & 0x000000FF)

--> Should I calculate the elevation angles then get the layer information?

I am so confusing now....

I would appreciate if you could put some Python codes examples.

Thanks for your answers and best wishes.

edit retag flag offensive close merge delete

Comments

I found this file: colors.cc, but there is only 6 colors defined, for VLP-16 there should have 16 colors for rings, right? Sorry for the stupid question.

Cicilia gravatar image Cicilia  ( 2018-11-25 05:53:10 -0500 )edit

Calculating the elevation of each point would seem like the most robust way of going about this. What is the problem you're having?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-25 06:14:55 -0500 )edit

Thank you for reply. I am totally new to ROS and python, so I always have problem by transforming and calculating the data in array (or struct? or numpy array?) and then putting them in new custom message in the way without bug. :(

Cicilia gravatar image Cicilia  ( 2018-11-25 09:34:43 -0500 )edit

I want to convert the PointCloud2 as a custom message including the the info such as distance and azimuth angle etc. Should I use the tf2 transform better than point by point calculating? Thanks in advance.

Cicilia gravatar image Cicilia  ( 2018-11-25 09:59:28 -0500 )edit

Can you tell us what you're trying to build overall. There doesn't seem to be any point including redundant information such as distance and elevation in a custom point cloud message type. It would be easier to calculate those properties as and when needed.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-25 12:01:38 -0500 )edit

I want to build a custom message similar to the raw sensor message then publish them. It contains the azimuth angles and distance values from 16 lasers in 1206 bytes. Please see my question before.

Cicilia gravatar image Cicilia  ( 2018-11-26 08:23:29 -0500 )edit

Hi Cicilia, you said you can extract x,y,z coordinates in python. Could you help me understand how I can do that? Maybe you can share your code if possible please.

beluga gravatar image beluga  ( 2020-03-31 03:36:29 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-11-27 07:53:33 -0500

Cicilia gravatar image

UPDATE: PointCloud2::XYZIR, the fifth field Ring contains the layer information. For VLP-16, the ring values are 0 to 15.

edit flag offensive delete link more

Comments

I have a VLP-16 and a PointCloud2 extracted from it from velodyne_points topic. Inside the data I checked every 5th number and it is not smaller than 16. There are even 14 numbers in a row in which none of them are smaller than 16. I was expecting every other 5th data to be smaller than 16 so that it represents a ring value. I am totally confused now. Do you have any idea?

beluga gravatar image beluga  ( 2020-03-31 03:40:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-25 05:43:14 -0500

Seen: 1,410 times

Last updated: Nov 27 '18