OctoMap / octomap_msgs

ROS package to provide messages and serializations / conversion for the OctoMap library
http://www.ros.org/wiki/octomap_msgs
32 stars 53 forks source link

How to creates a new octree by a `octomap_msgs/Octomap` message #12

Closed punnpkin closed 4 years ago

punnpkin commented 4 years ago

Hello there,

I'm trying an example of conversing octomap_msgs/Octomap message into a oct tree.

The callback function which I wrote is:

void callback(const octomap_msgs::Octomap &msg)
{
    octomap::AbstractOcTree* tree = octomap_msgs::fullMsgToMap(msg);
}

But an error occurred at compile time:

In function `octomap_msgs::fullMsgToMap(octomap_msgs::Octomap_<std::allocator<void> > const&)': 
octo_move.cpp:(.text+0x14e): undefined reference to octomap::AbstractOcTree::createTree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double)'

What I want to ask is, am I right in writing like this? How can I solve this problem?

Thanks a lot

wxmerkt commented 4 years ago

Hi @punnpkin, Can you include your CMakeLists.txt entries for the source file? It appears that maybe you are missing to link to octomap library.

Best wishes

punnpkin commented 4 years ago

Hi @punnpkin, Can you include your CMakeLists.txt entries for the source file? It appears that maybe you are missing to link to octomap library.

Best wishes

yes... I am missing to link octomap_ros lib, thank you