ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As of ROS2 humble there is also read_points_numpy
(see here) which would give you directly a 2D NumPy array. For example:
cloud = point_cloud2.read_points_numpy(
msg, field_names=['x', 'y', 'z', "intensity"], skip_nans=True)
Note that there also exists a read_points_list
(see here) at least for galactic, foxy, and humble which would have simplified the code of the other answers.
2 | No.2 Revision |
As of ROS2 humble there is also read_points_numpy
(see here) which would give you directly a 2D NumPy array. For example:
cloud = point_cloud2.read_points_numpy(
msg, field_names=['x', 'y', 'z', "intensity"], skip_nans=True)
Note that there also exists a read_points_list
(see here) at least for galactic, foxy, and humble which would have simplified the code of the other answers.
3 | No.3 Revision |
As of ROS2 humble there is also read_points_numpy
(see here) which would give you directly a 2D NumPy array. For example:
cloud = point_cloud2.read_points_numpy(
msg, field_names=['x', 'y', 'z', "intensity"], skip_nans=True)
Note that there also exists a read_points_list
(see here) at least for galactic, foxy, and humble which would have simplified the code of the other answers.