diff --git a/source/RobotAPI/libraries/aron/core/CMakeLists.txt b/source/RobotAPI/libraries/aron/core/CMakeLists.txt index 0bdb8203c8083108012fb02e10eac9b7b7a2779e..2fceeadf18630f109777c2552338afea33353358 100644 --- a/source/RobotAPI/libraries/aron/core/CMakeLists.txt +++ b/source/RobotAPI/libraries/aron/core/CMakeLists.txt @@ -5,9 +5,6 @@ armarx_set_target("Library: ${LIB_NAME}") find_package(Eigen3 QUIET) armarx_build_if(Eigen3_FOUND "Eigen3 not available") -if(Eigen3_FOUND) - include_directories(${Eigen3_INCLUDE_DIR}) -endif() find_package(Simox QUIET) armarx_build_if(Simox_FOUND "Simox not available") @@ -15,6 +12,9 @@ if(Simox_FOUND) include_directories(${Simox_INCLUDE_DIR}) endif() +find_package(PCL QUIET COMPONENTS io common) +armarx_build_if(PCL_FOUND "PCL not available") + set(LIBS ArmarXCoreInterfaces @@ -22,6 +22,9 @@ set(LIBS RobotAPIInterfaces cppgen ${Simox_LIBS} + # System libraries + Eigen3::Eigen + # PCLInterface ) set(LIB_FILES @@ -217,7 +220,17 @@ set(LIB_HEADERS codegenerator/typeReader/xml/Reader.h ) + armarx_add_library("${LIB_NAME}" "${LIB_FILES}" "${LIB_HEADERS}" "${LIBS}") + +if(PCL_FOUND) +target_include_directories("${LIB_NAME}" + SYSTEM PUBLIC + "${PCL_INCLUDE_DIRS}" +) +endif() + + # add unit tests add_subdirectory(test) diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp index 1ba373de5aaaf56fb7062da4134792991b80ac47..1d4c51c5480309d096420ef8af6e8af2176c428e 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp @@ -24,6 +24,8 @@ // Header #include "PCLPointCloud.h" +#include <RobotAPI/libraries/core/pcl_point_types.h> + namespace armarx::aron::cppcodegenerator::serializer { @@ -37,6 +39,7 @@ namespace armarx::aron::cppcodegenerator::serializer {"PointXYZRGBL", {"pcl::PointXYZRGBL", 32}}, {"PointXYZRGBA", {"pcl::PointXYZRGBA", 32}}, {"PointXYZHSV", {"pcl::PointXYZHSV", 32}}, + {"PointPolar", {"pcl::PointPolar", 16}}, }; // constructors diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h index 2f62f1b579b5e84b3acc93aa7a72d70329492736..a5e7f249f322d246cc3ce5af1a2f510904b472f6 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h @@ -79,7 +79,8 @@ namespace armarx::aron::typenavigator {"PointXYZRGB", {"pcl::PointXYZRGB"}}, {"PointXYZRGBL", {"pcl::PointXYZRGBL"}}, {"PointXYZRGBA", {"pcl::PointXYZRGBA"}}, - {"PointXYZHSV", {"pcl::PointXYZHSV"}} + {"PointXYZHSV", {"pcl::PointXYZHSV"}}, + {"PointPolar", {"pcl::PointPolar"}} }; const unsigned int ACCEPTED_DIMENSION_MIN_SIZE = 2; const unsigned int ACCEPTED_DIMENSION_MAX_SIZE = 2; diff --git a/source/RobotAPI/libraries/core/pcl_point_types.h b/source/RobotAPI/libraries/core/pcl_point_types.h new file mode 100644 index 0000000000000000000000000000000000000000..e610f72fed7ac5051c8ec43a842b2f60e811281d --- /dev/null +++ b/source/RobotAPI/libraries/core/pcl_point_types.h @@ -0,0 +1,63 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::Core + * @author Fabian Reister ( fabian dot reister at kit dot edu ) + * @date 2021 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +#define PCL_NO_PRECOMPILE +#include <pcl/pcl_macros.h> +#include <pcl/point_types.h> +#include <pcl/point_cloud.h> +#include <pcl/io/pcd_io.h> +// #include <pcl/memory.h> + +#include <Eigen/Core> + +namespace pcl +{ + + /** + * @brief Point for polar coordinates + * + */ + struct PointPolar + { + // PCL_ADD_POINT4D; // preferred way of adding a XYZ+padding + + //! radial distance + float r; + + //! angle + float phi; + + EIGEN_MAKE_ALIGNED_OPERATOR_NEW + // PCL_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned + } EIGEN_ALIGN16; // enforce SSE padding for correct memory alignment + + + +} // namespace pcl + + +POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointPolar, + (float, r, r) + (float, phi, phi) + ) \ No newline at end of file