Robotics StackExchange | Archived questions

GazeboJS - Resetting world state

I have a problem using GazeboJS to reset the world state.

The simple script I am using to test this command is

var gazebojs = require("gazebojs");
var gazebo = new gazebojs.Gazebo();
gazebo.publish("gazebo.msgs.WorldControl", "~/world_control", { reset: { all: true } });

However, this throws an error when running the script in terminal

 >node test.js

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
pure virtual method called
terminate called recursively
Aborted (core dumped)

However by initialising a node and typing each command in the above script into the terminal, it works perfectly. Any ideas or explanations to what I am donig wrongly?

Asked by Lifthrasir on 2016-03-07 14:09:25 UTC

Comments

Answers

When running the script in the terminal, the script is run and then the node process shuts down. There is a problem during shutdown, because the Gazebo transport seems to die prematurely. This is not a problem when typing into the terminal, because the Gazebo transport is not shutdown in the same way. It is a known problem, but there is no fix yet. Sometimes you can get around this problem by keeping the node process alive for a few seconds after the last message is sent to the simulation server.

Asked by hugomatic on 2016-03-08 13:33:05 UTC

Comments

for me it doesn't give an error, but it doesn't either work, doesn't really reset the world.

Asked by MhAyman on 2016-07-01 06:17:55 UTC