HI
I am trying to update the parameters of my plugins before starting the simulation.
So I want to create a standalone publisher that will publish to a topic listened to by the world and model plugins in the simulation.
However, this does not work. Gazebo just hangs and stop responding. When I try to restart the standalone publisher, Gazebo crashes with this error:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl>'
what(): boost thread: trying joining itself: Resource deadlock avoided
I am using **Gazebo 7.4.0**
The minimized version of the independent publisher is:
#include
#include
#include
#include "gazebo/common/common.hh"
#include
#include
#include
#include
#include
#include
std::mutex mutex1;
using namespace std;
bool world_loaded;
void world_loaded_func(ConstAnyPtr &any)
{std::lock_guard lock(mutex1);
world_loaded = any->bool_value();
}
int main(int _argc, char **_argv)
{
world_loaded = false;
//Load gazebo
gazebo::client::setup(_argc, _argv);
//create our node for communication
gazebo::transport::NodePtr node(new gazebo::transport::Node());
node->Init();
//listen to when world is loaded
gazebo::transport::SubscriberPtr sub_world_loaded;
sub_world_loaded = node->Subscribe("/world_loaded",world_loaded_func);
//for advertising simulation parameters
gazebo::transport::PublisherPtr pub_params = node->Advertise("/params_topic");
pub_params->WaitForConnection();
gazebo::msgs::Any any;
any.set_type(gazebo::msgs::Any::STRING);
std::string pars = "nei_sensing:5.0";
any.set_string_value(pars);
while(true){//busy wait
gazebo::common::Time::MSleep(100);
if(world_loaded)
{
cout<<"world_loaded"<Publish(any);
}
//cout<<"running"<
#include "gazebo/physics/physics.hh"
#include "gazebo/common/common.hh"
#include "gazebo/gazebo.hh"
#include
#include
#include
#include
#include
#include
↧