I'm running V-REP headless for simulating my robot in ROS.
I sometimes need to restart the simulation (e.g. the robot falls off the simulation scene :D)
but once I stop the simulation with /vrep/simRosStopSimulation, no ros services for controlling V-REP are available anymore, so it is not possible to call /vrep/simRosStartSimulation!
maybe an api for restarting the simulation would help?
ros: restarting simulation... useless api StartSimulation
Re: ros: restarting simulation... useless api StartSimulatio
Hello,
the ROS services are always available, also when simulation is not running. Which is not the case for publishers and subscribers.
so you should be able to restart your simulation with simRosStartSimulation. But remember: when you stop (or request a stop) a simulation, it will not immediately stop. If will go through various intermediate states and simulate a few additional frames before stopping (this, in order to give the chance to scripts to do clean-up and other specific operations before the stop). Have a look at the simulator states. So, before restarting simulation, make sure the simulation has really stopped. You can check this with the info topic which is a publisher that is always active (this is an exception, unlike the other publishers).
Cheers
the ROS services are always available, also when simulation is not running. Which is not the case for publishers and subscribers.
so you should be able to restart your simulation with simRosStartSimulation. But remember: when you stop (or request a stop) a simulation, it will not immediately stop. If will go through various intermediate states and simulate a few additional frames before stopping (this, in order to give the chance to scripts to do clean-up and other specific operations before the stop). Have a look at the simulator states. So, before restarting simulation, make sure the simulation has really stopped. You can check this with the info topic which is a publisher that is always active (this is an exception, unlike the other publishers).
Cheers
Re: ros: restarting simulation... useless api StartSimulatio
Here is what I do:
simulation now is running:
services are there... let's stop the simulation:
now I wait until the /vrep/info effectively shows that the simulation has stopped (and even more)
...
services are not there anymore
simulation now is running:
Code: Select all
$ rosservice list | grep simRosSt.*Simulation
/vrep/simRosStartSimulation
/vrep/simRosStopSimulation
$
Code: Select all
$ rosservice call /vrep/simRosStopSimulation "{}"
result: 1
$
...
Code: Select all
$ rosservice list | grep simRosSt.*Simulation
$
Code: Select all
$ rosservice call /vrep/simRosStartSimulation "{}"
ERROR: Service [/vrep/simRosStartSimulation] is not available.
Re: ros: restarting simulation... useless api StartSimulatio
What happens if you try to stop a simulation that is not running (via a service call)? And what happens if you try to run a simulation that is already running?
I would try to rebuild the ROS plugin, that should fix the problem.
Cheers
I would try to rebuild the ROS plugin, that should fix the problem.
Cheers