Gazebo | Ignition | Community
Ask Your Question
0

stuck in transport::init()

asked 2013-05-08 00:48:46 -0500

frank gravatar image

updated 2013-05-09 02:32:06 -0500

i was testing the example listener.cc according to the tutorials. I first ran gazebo and then ran listener. I found that the listener stuck at the function transport::init().

The output of listener is

Msg Waiting for master........
Msg Connected to gazebo master @ http://127.0.0.1:11345

Here is my code:

#include <transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/gazebo.hh>
#include "transport/Node.hh"
#include "transport/Publisher.hh"
#include "transport/Subscriber.hh"
#include "transport/ConnectionManager.hh"
#include "transport/Transport.hh"

#include "msgs/msgs.hh"
#include "common/Events.hh"
#include "transport/TopicManager.hh"

#include "gazebo_config.h"

#include <iostream>

using namespace gazebo;

/////////////////////////////////////////////////
// Function is called everytime a message is received.
void cb(ConstWorldStatisticsPtr &_msg)
{
  // Dump the message contents to stdout.
  std::cout << _msg->DebugString();
}



/////////////////////////////////////////////////
int main(int _argc, char **_argv)
{
  printf("transport init...\n");
  std::string host = "localhost";
  unsigned int port = 11345;
  transport::TopicManager::Instance()->Init();
  printf("topic manager init ok...\n");

  //transport::ConnectionManager()::Instance()->stop = false;

  if (!transport::ConnectionManager::Instance()->Init(host, port))
      printf("return false\n");

    printf("return true\n");



  // Create our node for communication
  gazebo::transport::NodePtr node(new gazebo::transport::Node());
  node->Init();

  // Listen to Gazebo world_stats topic
  gazebo::transport::SubscriberPtr sub = node->Subscribe("~/world_stats", cb);

  gazebo::transport::run();

  // Busy wait loop...replace with your own code as needed.
  while (true)
    gazebo::common::Time::MSleep(10);

  // Make sure to shut everything down.
  gazebo::transport::fini();
}

And i found that it got stuck in the code

if (!transport::ConnectionManager::Instance()->Init(host, port))
      printf("return false\n");

Can you help me? Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-05-09 07:24:03 -0500

frank gravatar image

I know what happened! I got another app using boost-1.53.0 But gazebo1.7.2 uses boost-1.46, and so the listener above does. I removed boost-1.53.0 and the listener works well.

But how can i handle the conflict bewteen the different version of boost? My other apps need the newest version of boost. Thank you.

edit flag offensive delete link more

Comments

If you [build gazebo from source](http://gazebosim.org/wiki/1.6/install), you can use the latest version of boost.

scpeters gravatar imagescpeters ( 2013-05-10 11:49:54 -0500 )edit

Question Tools

Stats

Asked: 2013-05-08 00:48:46 -0500

Seen: 277 times

Last updated: May 09 '13