Ask Your Question
0

conversion of sensor_msgs::PointCloud2ConstPtr

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

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
3

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

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

Comments

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

Bernhard gravatar imageBernhard ( 2013-06-14 04:16:32 -0600 )edit

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

xelda1988 gravatar imagexelda1988 ( 2013-06-19 23:49:23 -0600 )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 imageashish ( 2017-06-01 05:46:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 3,151 times

Last updated: Jun 13 '13