KIT-MRT / mrt_cmake_modules

Automated catkin project handling framework
BSD 3-Clause "New" or "Revised" License
40 stars 24 forks source link

Open3d #24

Open 0xd1ma opened 3 years ago

0xd1ma commented 3 years ago

Hello I would like to use open3D in one of my robotics projects under ROS. Unfortunately, then i add to yaml/cmake.yaml:

open3d:
  components: []
  name: Open3D
  include_dirs: [Open3D_INCLUDE_DIRS]
  libraries: [Open3D_LIBRARIES]
  library_dirs: [Open3D_LIBRARY_DIRS]

and generate cmake by mrt.

it is possible to build simple code:

#include "open3d/Open3D.h"

int main(int argc, char** argv)
{
    using namespace open3d;

    auto sphere = geometry::TriangleMesh::CreateSphere(1.0);
    sphere->ComputeVertexNormals();
    sphere->PaintUniformColor({ 0.0, 1.0, 0.0 });
    visualization::DrawGeometries({ sphere });

    return 0;
}

but then i try to add ROS:

#include <ros/ros.h>
#include "open3d/Open3D.h"

int main(int argc, char** argv)
{
    using namespace open3d;

    ros::init(argc, argv, "map_loader");

    auto sphere = geometry::TriangleMesh::CreateSphere(1.0);
    sphere->ComputeVertexNormals();
    sphere->PaintUniformColor({ 0.0, 1.0, 0.0 });
    visualization::DrawGeometries({ sphere });

    return 0;
}

i have:

undefined reference to ros::init(int&, char**, std::string const&, unsigned int)

is it possible to help me with such an issue?

poggenhans commented 3 years ago

Looks like your package.xml is missing a dependency to roscpp?

0xd1ma commented 3 years ago

no

in package.xml

  <depend>roscpp</depend>
  <depend>sensor_msgs</depend>
  <depend>pcl_ros</depend>
  <depend>open3d</depend>
BaltashovIlia commented 2 years ago

Hi,

This issue is not related to mrt_cmake_modules, but related to Open3d compilation settings. For details, see here: https://github.com/ros-perception/perception_open3d/issues/16