Ask Your Question

J.Beuls's profile - activity

2015-03-21 05:05:46 -0600 commented question Problem publishing octomap to the planning scene

I did that because i want to be able to change the message being published when the input changes. This is code i wanted to add later. I will try what you told me. Thank you for the feedback.

2015-03-19 08:16:09 -0600 commented question Rviz: Process have died

I am having the same problem when i launch a self written node. I hope someone can find the solution and post it here.

2015-03-19 03:31:46 -0600 received badge  Enthusiast
2015-03-18 09:24:55 -0600 commented question Problem publishing octomap to the planning scene

Yes, thank you. I knew it weren't ROS nodes as rosnode list doesn't give me allot of nodes. But i didn't know what was really meant by this. Is this conversion of octomap to octree taking so long?

2015-03-09 03:38:39 -0600 received badge  Famous Question (source)
2015-02-19 05:43:33 -0600 received badge  Notable Question (source)
2015-02-18 02:21:27 -0600 received badge  Editor (source)
2015-02-18 02:19:15 -0600 received badge  Popular Question (source)
2015-02-11 08:29:12 -0600 received badge  Supporter (source)
2015-02-11 08:20:38 -0600 received badge  Student (source)
2015-02-11 08:18:27 -0600 asked a question Problem publishing octomap to the planning scene

Hello dear community,

I am having a problem with publishing my octomap to the planning scene for obstacle avoidance. Can anyone help me with what i did wrong in my code please? I am using ROS Hydro.

At the moment when i launch this node, ROS publishes the nodes to the output stream. (See Fig. 1) Is there a way to resolve this? I want to publish the data continuously but not transform the data every time.

#include "ros/ros.h"
#include "std_msgs/String.h"

#include <sstream>

#include <moveit/planning_scene/planning_scene.h>
#include <moveit/kinematic_constraints/utils.h>
#include <eigen_conversions/eigen_msg.h>

#include <octomap/octomap.h>
#include <octomap_msgs/conversions.h>

#include <octomap/OcTree.h>

int main(int argc, char **argv)
{
  ros::init(argc, argv, "octomap_publisher");

  ros::NodeHandle n;

  //publisher for the planning scene
  ros::Publisher octomap_pub = n.advertise<moveit_msgs::PlanningScene>("planning_scene", 1);
  ros::Rate loop_rate(1);

  int count = 0;
  while (ros::ok())
  {
        static octomap_msgs::Octomap octomap;
        static bool msgGenerated = false;

        //Turn the octomap .bt file into an octree format, which is needed by BinaryMapToMsg

        if ( msgGenerated == false)
        {
              octomap::OcTree myOctomap("/Dir1/Dir2/.../SOLMeasurePolygon.bt");
              octomap_msgs::binaryMapToMsg(myOctomap, octomap);
              msgGenerated = true;
        }

      moveit_msgs::PlanningScene planning_scene;
      planning_scene.world.octomap.header.frame_id = "odom_combined";
      planning_scene.world.octomap.octomap.header.frame_id = "odom_combined";
      planning_scene.world.octomap.octomap.binary = true;
      planning_scene.world.octomap.octomap.id = "OcTree";
      planning_scene.world.octomap.octomap.data = octomap.data;


      ROS_INFO("Adding the octomap into the world.");
      octomap_pub.publish(planning_scene);

    ros::spinOnce();

    loop_rate.sleep();
    ++count;
  } 
  return 0;
}

Fig. 1: The terminal when i launch the node image description

Kind regards

Joris Beuls