Gazebo | Ignition | Community
Ask Your Question

GazeboJS - Resetting world state

asked 2016-03-07 13:09:25 -0600

Lifthrasir gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-08 12:33:05 -0600

hugomatic gravatar image

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.

edit flag offensive delete link more


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

MhAyman gravatar imageMhAyman ( 2016-07-01 06:17:55 -0600 )edit

Question Tools

1 follower


Asked: 2016-03-07 13:09:25 -0600

Seen: 284 times

Last updated: Mar 08 '16