Why does ROS2 not have pcl::toRosMsg? Deprecated?
I come from ROS(1) and pcl::toRosMsg is essential to everything to do with pointclouds. I see this message:
error: ‘fromROSMsg’ is not a member of ‘pcl’
It also happens with 'toROSMsg'. If I try pcl::fromPCLPointCloud2, for example, it works. I have seen that at PCL 1.12, toROSMsg and fromROSMsg are deprecated (why?) and it seems there's no substitute.
I am surely missing something...
My CMakeLists.txt is this:
cmake_minimum_required(VERSION 3.5)
project(hashtable)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package( PCL 1.8 REQUIRED )
find_package(pcl_conversions REQUIRED)
add_executable(demo_hashtable3d
src/main.cpp
src/hashtable3d_public.cpp
src/hashtable3d_private.cpp
include/hashtable/hashtable3d.hpp
)
ament_target_dependencies(demo_hashtable3d rclcpp sensor_msgs pcl_conversions)
if( PCL_FOUND )
# [C/C++]>[General]>[Additional Include Directories]
include_directories( ${PCL_INCLUDE_DIRS} )
# [C/C++]>[Preprocessor]>[Preprocessor Definitions]
add_definitions( ${PCL_DEFINITIONS} )
# For Use Not PreCompiled Features
#add_definitions( -DPCL_NO_PRECOMPILE )
# [Linker]>[General]>[Additional Library Directories]
link_directories( ${PCL_LIBRARY_DIRS} )
# [Linker]>[Input]>[Additional Dependencies]
target_link_libraries( demo_hashtable3d ${PCL_LIBRARIES} )
endif()
install(TARGETS
demo_hashtable3d
DESTINATION lib/${PROJECT_NAME})
ament_package()
and package.xml:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>hashtable</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="andreu@todo.todo">andreu</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>sensor_msgs</depend>
<depend>pcl_ros</depend>
<depend>pcl_conversions</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>