Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to restart simulation #59

Open
mphamhung opened this issue May 27, 2020 · 3 comments
Open

How to restart simulation #59

mphamhung opened this issue May 27, 2020 · 3 comments

Comments

@mphamhung
Copy link

Hi, are there any exposed functions that would let me restart the simulation without killing and relaunching? I'm looking to implementing an openaigym-like interface and want to restart the simulation for each episode.

@makokal
Copy link
Member

makokal commented May 30, 2020

There is nothing exposed right now, but it should be easy to clear the scene and re-spawn the agents

@mphamhung
Copy link
Author

In simulator_node.cpp, I add the following calls too a ros listener callback:

      sm.cleanUp();
      sm.initializeSimulation();
      sm.runSimulation();

Where sm.cleanUp is defined in simulator.cpp as:

void Simulator::cleanUp() {
  SCENE.clear();
}

This seems to get the simulator to reset on callback, except the pedsim simulator node crashes after a few times. I get an exit code -11, which sounds to me like a memory reference problem. Furthermore, each time new agents spawn, their number in rviz also increases?

Is there a different way to clear and respawn?

@makokal
Copy link
Member

makokal commented Jun 17, 2020

Yes, this is a little more involved. We need to also reset agent ids in the libpedsim part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants