introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
999 stars 558 forks source link

error: ‘sensor_msgs::PointCloud2’ {aka ‘struct sensor_msgs::PointCloud2_<std::allocator<void> >’} has no member named ‘begin’ #763

Open MaverickJohnny opened 2 years ago

MaverickJohnny commented 2 years ago

environment: Ubuntu 20.04, ROS noetic

When I use the catkin_make command, i got some errors:

/home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp: In member function ‘virtual void rtabmap_ros::VoxelLayer::updateBounds(double, double, double, double, double, double, double)’: /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:170:75: error: ‘sensor_msgs::PointCloud2’ {aka ‘struct sensormsgs::PointCloud2<std::allocator >’} has no member named ‘begin’ 170 | pcl::PointCloud::const_iterator pointit = obs.cloud->begin(); | ^~~~~ /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:171:34: error: ‘sensor_msgs::PointCloud2’ {aka ‘struct sensormsgs::PointCloud2<std::allocator >’} has no member named ‘end’ 171 | for (;pointit < obs.cloud->end(); ++point_it) { | ^~~ /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp: In member function ‘virtual void rtabmap_ros::VoxelLayer::raytraceFreespace(const costmap_2d::Observation&, double, double, double, double)’: /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:312:92: error: ‘sensor_msgs::PointCloud2’ {aka ‘struct sensormsgs::PointCloud2<std::allocator >’} has no member named ‘begin’ 312 | pcl::PointCloud::const_iterator point_it = clearingobservation.cloud->begin(); | ^~~~~ /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:313:51: error: ‘sensor_msgs::PointCloud2’ {aka ‘struct sensormsgs::PointCloud2<std::allocator >’} has no member named ‘end’ 313 | for (;point_it < clearingobservation.cloud->end(); ++point_it) { | ^~~ /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:393:106: error: no matching function for call to ‘fromPCL(stdmsgs::Header<std::allocator >::_stamp_type&)’ 393 | clearingendpoints.header.stamp = pcl_conversions::fromPCL(clearingobservation.cloud->header.stamp); | ^ In file included from /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:42: /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:80:8: note: candidate: ‘void pcl_conversions::fromPCL(const uint64_t&, ros::Time&)’ 80 | void fromPCL(const std::uint64_t &pcl_stamp, ros::Time &stamp) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:80:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:92:13: note: candidate: ‘ros::Time pcl_conversions::fromPCL(const uint64_t&)’ 92 | ros::Time fromPCL(const std::uint64_t &pcl_stamp) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:92:42: note: no known conversion for argument 1 from ‘stdmsgs::Header<std::allocator >::_stamp_type’ {aka ‘ros::Time’} to ‘const uint64_t&’ {aka ‘const long unsigned int&’} 92 | ros::Time fromPCL(const std::uint64_t &pcl_stamp) | ~~~~~^~~~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:110:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PCLHeader&, std_msgs::Header&)’ 110 | void fromPCL(const pcl::PCLHeader &pcl_header, std_msgs::Header &header) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:110:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:126:20: note: candidate: ‘std_msgs::Header pcl_conversions::fromPCL(const pcl::PCLHeader&)’ 126 | std_msgs::Header fromPCL(const pcl::PCLHeader &pcl_header) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:126:50: note: no known conversion for argument 1 from ‘stdmsgs::Header<std::allocator >::_stamp_type’ {aka ‘ros::Time’} to ‘const pcl::PCLHeader&’ 126 | std_msgs::Header fromPCL(const pcl::PCLHeader &pcl_header) | ~~~~^~~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:155:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PCLImage&, sensor_msgs::Image&)’ 155 | void fromPCL(const pcl::PCLImage &pcl_image, sensor_msgs::Image &image) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:155:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:196:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PCLPointField&, sensor_msgs::PointField&)’ 196 | void fromPCL(const pcl::PCLPointField &pcl_pf, sensor_msgs::PointField &pf) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:196:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:205:8: note: candidate: ‘void pcl_conversions::fromPCL(const std::vector&, std::vector<sensormsgs::PointField<std::allocator >, std::allocator<sensormsgs::PointField<std::allocator > > >&)’ 205 | void fromPCL(const std::vector &pcl_pfs, std::vector &pfs) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:205:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:251:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PCLPointCloud2&, sensor_msgs::PointCloud2&)’ 251 | void fromPCL(const pcl::PCLPointCloud2 &pcl_pc2, sensor_msgs::PointCloud2 &pc2) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:251:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:294:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PointIndices&, pcl_msgs::PointIndices&)’ 294 | void fromPCL(const pcl::PointIndices &pcl_pi, pcl_msgs::PointIndices &pi) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:294:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:324:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::ModelCoefficients&, pcl_msgs::ModelCoefficients&)’ 324 | void fromPCL(const pcl::ModelCoefficients &pcl_mc, pcl_msgs::ModelCoefficients &mc) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:324:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:369:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::Vertices&, pcl_msgs::Vertices&)’ 369 | void fromPCL(const pcl::Vertices &pcl_vert, pcl_msgs::Vertices &vert) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:369:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:375:8: note: candidate: ‘void pcl_conversions::fromPCL(const std::vector&, std::vector<pclmsgs::Vertices<std::allocator > >&)’ 375 | void fromPCL(const std::vector &pcl_verts, std::vector &verts) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:375:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:392:8: note: candidate: ‘void pcl_conversions::fromPCL(std::vector&, std::vector<pclmsgs::Vertices<std::allocator > >&)’ 392 | void fromPCL(std::vector &pcl_verts, std::vector &verts) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:392:8: note: candidate expects 2 arguments, 1 provided /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:439:8: note: candidate: ‘void pcl_conversions::fromPCL(const pcl::PolygonMesh&, pcl_msgs::PolygonMesh&)’ 439 | void fromPCL(const pcl::PolygonMesh &pcl_mesh, pcl_msgs::PolygonMesh &mesh) | ^~~ /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:439:8: note: candidate expects 2 arguments, 1 provided /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp: In member function ‘virtual void rtabmap_ros::VoxelLayer::updateOrigin(double, double)’: /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:412:92: error: no matching function for call to ‘tf2ros::Buffer::lookupTransform(std::string&, std::string&, ros::Time, tf::StampedTransform&)’ 412 | tf->lookupTransform(globalframe, robot_baseframe, ros::Time(0), stampedTransform); | ^ In file included from /opt/ros/noetic/include/costmap_2d/layer.h:43, from /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.h:41, from /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:38: /opt/ros/noetic/include/tf2_ros/buffer.h:76:5: note: candidate: ‘virtual geometry_msgs::TransformStamped tf2_ros::Buffer::lookupTransform(const string&, const string&, const ros::Time&, ros::Duration) const’ 76 | lookupTransform(const std::string& target_frame, const std::string& source_frame, | ^~~~~~~ /opt/ros/noetic/include/tf2_ros/buffer.h:77:64: note: no known conversion for argument 4 from ‘tf::StampedTransform’ to ‘ros::Duration’ 77 | const ros::Time& time, const ros::Duration timeout) const; | ~~~~^~~ /opt/ros/noetic/include/tf2_ros/buffer.h:92:5: note: candidate: ‘virtual geometry_msgs::TransformStamped tf2_ros::Buffer::lookupTransform(const string&, const ros::Time&, const string&, const ros::Time&, const string&, ros::Duration) const’ 92 | lookupTransform(const std::string& target_frame, const ros::Time& target_time, | ^~~~~~~ /opt/ros/noetic/include/tf2_ros/buffer.h:92:5: note: candidate expects 6 arguments, 4 provided In file included from /opt/ros/noetic/include/tf2_ros/buffer_interface.h:35, from /opt/ros/noetic/include/tf2_ros/buffer.h:35, from /opt/ros/noetic/include/costmap_2d/layer.h:43, from /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.h:41, from /home/chance/rosspace/src/rtabmap_ros/src/costmap_2d/voxel_layer.cpp:38: /opt/ros/noetic/include/tf2/buffer_core.h:142:5: note: candidate: ‘geometry_msgs::TransformStamped tf2::BufferCore::lookupTransform(const string&, const ros::Time&, const string&, const ros::Time&, const string&) const’ 142 | lookupTransform(const std::string& target_frame, const ros::Time& target_time, | ^~~~~~~ /opt/ros/noetic/include/tf2/buffer_core.h:142:5: note: candidate expects 5 arguments, 4 provided /opt/ros/noetic/include/tf2/buffer_core.h:126:5: note: candidate: ‘geometry_msgs::TransformStamped tf2::BufferCore::lookupTransform(const string&, const string&, const ros::Time&) const’ 126 | lookupTransform(const std::string& target_frame, const std::string& source_frame, | ^~~~~~~ /opt/ros/noetic/include/tf2/buffer_core.h:126:5: note: candidate expects 3 arguments, 4 provided

MaverickJohnny commented 2 years ago

can anyone help me plz 😭

matlabbe commented 2 years ago

Did you use latest master for rtabmap and rtabmap_ros? Normally rtabmap_ros should build on ubuntu20.04/noetic. https://github.com/introlab/rtabmap_ros/actions/runs/3215311199/jobs/5256316555