I want to run a Simulation experiment multiple times, until it is told by a ROS service call to stop. One experiment does not have a fixed length. It is also told by a ROS service call that it ended.
I know that I can reset everything that was set in my LoopFunctions class. For this, I can save the configuration node of the call of Init and use it once again when resetting. But I didn't find any way to reset the elements which were not declared in the configuration for the loop functions in the argos file. For example, if I declared boxes in the arena element with random positions, this way does not work to change their positions.
I also tried calling GetSimulator().Reset() in my LoopFunctions class (and defining the reset behaviour of the LoopFunctions class in its Reset() function), but this call results in an error.
Another way I tried was based on the galib example (https://github.com/ilpincy/argos3-examp ... b/main.cpp): I started the Simulator and executed and reset it in a loop basically like this:
Code: Select all
CSimulator& cSimulator = CSimulator::GetInstance();
cSimulator.SetExperimentFileName(file);
cSimulator.LoadExperiment();
while (run) {
cSimulator.Execute();
cSimulator.Reset();
}
The problem is that the the call of cSimulator.Execute() keeps blocking even after IsExperimentFinished returns true. So the call of cSimulator.Reset() is only reached when closing the ARGoS window, which can not be done by a ROS service call.
Thank you in advance!