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

Create octree

asked 2016-10-25 09:24:54 -0500

kotoko gravatar image

updated 2016-10-27 06:48:29 -0500

gvdhoorn gravatar image

Hi!

This question is really simple I think but I can't figure it out. This code:

#include <octomap_msgs/Octomap.h>//Octomap Binary
#include <octomap/OcTree.h>
#include <octomap_msgs/conversions.h>

int main(int argc, char **argv)
{
  ros::init(argc, argv, "mapper");
  ros::NodeHandle n;
  octomap::OcTree* octomap_ = new octomap::OcTree(0.1f);
  ros::spin();
  return 0;
}

Gives this compile error

CMakeFiles/mapper_node.dir/src/nodes/mapper_node.cpp.o: In function `octomath::Pose6D::Pose6D(octomath::Pose6D const&)':
mapper_node.cpp:(.text._ZN8octomath6Pose6DC2ERKS0_[_ZN8octomath6Pose6DC5ERKS0_]+0x3a): undefined reference to `octomath::Quaternion::Quaternion(octomath::Quaternion const&)'
CMakeFiles/mapper_node.dir/src/nodes/mapper_node.cpp.o: In function `octomap::OcTreeNode::updateOccupancyChildren()':
mapper_node.cpp:(.text._ZN7octomap10OcTreeNode23updateOccupancyChildrenEv[_ZN7octomap10OcTreeNode23updateOccupancyChildrenEv]+0x14): undefined reference to `octomap::OcTreeNode::getMaxChildLogOdds() const'
CMakeFiles/mapper_node.dir/src/nodes/mapper_node.cpp.o: In function `octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::OcTreeBaseImpl(double)':
mapper_node.cpp:(.text._ZN7octomap14OcTreeBaseImplINS_10OcTreeNodeENS_23AbstractOccupancyOcTreeEEC2Ed[_ZN7octomap14OcTreeBaseImplINS_10OcTreeNodeENS_23AbstractOccupancyOcTreeEEC5Ed]+0x1a): undefined reference to `octomap::AbstractOccupancyOcTree::AbstractOccupancyOcTree()'

Isn't this the simplest possible initialization? What am I missing?

octree 1.6.9, indigo

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-10-27 06:43:46 -0500

kotoko gravatar image

And it is really silly.

Just add the octomap_ros dependencies to

CMakeList :

find_package(catkin REQUIRED COMPONENTS <other dependencies> octomap_ros)
catkin_package(
    CATKIN_DEPENDS <other dependencies> octomap_ros
)

and package.xml:

 <depend>octomap_ros</depend>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-10-25 09:24:54 -0500

Seen: 1,380 times

Last updated: Oct 27 '16