Ask Your Question
2

problem publishing octomap msg from an octomap file

asked 2016-12-07 09:10:01 -0500

Tenrampi gravatar image

Hello, I have a .bt file and would like to publish an octomap_msg that you can visualize in rviz.

i wrote the following node:

ros::Publisher octomap_pub = n.advertise<octomap_msgs::Octomap>("octomap_loaded", 1);
octomap_msgs::Octomap octomap;
octomap::OcTree myOctomap("fr_079.bt");
octomap_msgs::binaryMapToMsg(myOctomap, octomap);
pub_octomap.publish(octomap);

and i can visualize the topic "octomap_loaded" but when i try to visualize it in rviz using the occupancygrid under "status" i have the following message:

0 binary octomap messages received

What am I doing wrong? The message contains the publish octomap because I tried to save the contents to a file using myOctomap.writeBinary("map.bt"); and actually I create the same amount .bt file.

Thank You

edit retag flag offensive close merge delete

Comments

Did you manage to solve this problem? In my case, I actually am receiving the message but Rviz tells me that the octomap "type" is wrong, which is I believe the id of the message. This is set to "OcTree" which is a valid type as far as I know

HououinKyouma gravatar image HououinKyouma  ( 2017-09-29 03:11:18 -0500 )edit

Did you find a fix for this? This file has some related code. I am curious if there is an easier route.

balakumar-s gravatar image balakumar-s  ( 2018-02-27 18:06:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-22 23:41:44 -0500

Yesika Rodriguez gravatar image

You have a mistake

ros :: Publisher octomap_pub = n.advertise <octomap_msgs ::="" octomap=""> ("octomap_loaded", 1);

When you publish, it must have the same name as the publisher

pub_octomap.publish (octomap);

In this case you use different name: octomap_pub and pub_octomap

Fix

octomap_pub.publish (octomap);

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-12-07 09:10:01 -0500

Seen: 681 times

Last updated: Apr 22 '20