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

conversion of sensor_msgs::PointCloud2ConstPtr

asked 2013-06-13 06:29:52 -0500

xelda1988 gravatar image

Hi all How can I convert sensor_msgs::PointCloud2ConstPtr to sensor_msgs::PointCloud2?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-13 07:56:51 -0500

Jiayi Liu gravatar image

Say you have input as sensor_msgs::PointCloud2ConstPtr and output as sensor_msgs::PointCloud2. output = *input;

edit flag offensive delete link more


Just a small addition to this answer. That's because the first (PointCloud2ConstPtr) is a pointer (Ptr), hence the *

Bernhard gravatar image Bernhard  ( 2013-06-14 04:16:32 -0500 )edit

Thanks guys! Is this copying the pointcloud, which allocates new memory? If yes, is there another way to do it?

xelda1988 gravatar image xelda1988  ( 2013-06-19 23:49:23 -0500 )edit

This might be a really 'new' comment. ConstPtr types are typedef(s) for boost::shared_ptr (shared pointer) to manage the life-cycle of pointer-memories. There won't be any new memory allocated but reuse of an already allocated memory.

ashish gravatar image ashish  ( 2017-06-01 05:46:49 -0500 )edit

Question Tools


Asked: 2013-06-13 06:29:52 -0500

Seen: 6,737 times

Last updated: Jun 13 '13