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

fromROSMsg to PointXYZI [closed]

asked 2012-03-23 02:37:32 -0500

liquidmonkey gravatar image

updated 2014-01-28 17:11:43 -0500

ngrennan gravatar image

i'm using a ToF camera which records x, y, z and intensity values. then i use fromROSMsg to convert between the sensor_msgs/PointCloud2 and pcl::PointCloudXYZ.

this works fine EXCEPT that the intensity information is gone due to PointCloudXYZ only keeping x y z data. http://docs.pointclouds.org/1.3.1/structpcl_1_1_point_x_y_z.html

when i try and use the PointCloudXYZI type, i get an error.

how can i keep the intensity information? or am i using fromROSMsg wrong?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2013-09-09 15:04:46

Comments

1

Please post your error. Just saying 'I get an error' is not helpful. http://ros.org/wiki/Support#Guidelines_for_asking_a_question_.28Please_read_before_posting.29

Lorenz gravatar image Lorenz  ( 2012-03-23 03:22:24 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2012-03-23 05:53:34 -0500

liquidmonkey gravatar image

updated 2012-03-23 06:14:29 -0500

Lorenz gravatar image

my code in the callback

void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud) {
   pcl::PointCloud<pcl::PointXYZI>::Ptr outCld (new pcl::PointCloud<pcl::PointXYZI>);

   // Convert the sensor_msgs/PointCloud2 data to pcl/PointCloud
   pcl::fromROSMsg (*cloud, *outCld);
   testCloud.pointDataTemp = outCld;

   pub_Cld1.publish (testCloud.pointDataVoxel); //bottom
}

the error

instantiated from here
  /usr/include/boost/smart_ptr/shared_ptr.hpp:314:9: error: no matching function for call to ‘boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >::shared_ptr(const boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >&)’
  /usr/include/boost/smart_ptr/shared_ptr.hpp:314:9: note: candidates are:
  /usr/include/boost/smart_ptr/shared_ptr.hpp:289:14: note: template<class Ap> boost::shared_ptr::shared_ptr(Ap, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:279:14: note: template<class Y> boost::shared_ptr::shared_ptr(std::auto_ptr<_Tp1>&)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:268:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, boost::detail::polymorphic_cast_tag)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:259:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, boost::detail::dynamic_cast_tag)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:254:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, boost::detail::const_cast_tag)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:249:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, boost::detail::static_cast_tag)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:244:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, T*)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:231:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::shared_ptr<Y>&, typename boost::detail::sp_enable_if_convertible<Y, T>::type)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:220:5: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::weak_ptr<Y>&, boost::detail::sp_nothrow_tag)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:213:14: note: template<class Y> boost::shared_ptr::shared_ptr(const boost::weak_ptr<Y>&)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:205:41: note: template<class Y, class D, class A> boost::shared_ptr::shared_ptr(Y*, D, A)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:198:32: note: template<class Y, class D> boost::shared_ptr::shared_ptr(Y*, D)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:187:14: note: template<class Y> boost::shared_ptr::shared_ptr(Y*)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:182:5: note: boost::shared_ptr< <template-parameter-1-1> >::shared_ptr() [with T = const pcl::PointCloud<pcl::PointXYZ>]
  /usr/include/boost/smart_ptr/shared_ptr.hpp:182:5: note:   candidate expects 0 arguments, 1 provided
  /usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >::shared_ptr(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >&)
  /usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note:   no known conversion for argument 1 from ‘const boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >’ to ‘const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZ> >&’
edit flag offensive delete link more

Comments

Please edit your question, not post an answer with more clarifications.

Tully gravatar image Tully  ( 2012-03-23 18:07:09 -0500 )edit

Question Tools

Stats

Asked: 2012-03-23 02:37:32 -0500

Seen: 2,341 times

Last updated: Mar 23 '12