Demo which shows how the NengoRos can be setup to use externally provided simulation time.
In this case, the Nengo simulator will subscribe to the /clock topic. At each time step it will
wait for a new stime tick (new time value) on this topic. If new value received, one Nengo simulation step
This demo shows the scenario where time is provided from external source, e.g. real world robotic system or some external (environment) simulator.
Note that external time provider can be launched completely externally or as an ordinary NeuralModule from the Nengoros. But in both cases command line parameter /use_sim_time:=false
Note that this is not ideally implemented and not tested very much, so the received time is used in the
NodeThreadPool.step() method, but e.g. the Nengo interactive simulaiton GUI does not reflect these values.
Demo is similar to the `basic/minmax.py` (starts two external ROS nodes), important are
lines after this one: ‘################# setup the ROS utils (optional)’.
Launching the Script
This demo can be launched by the following code written in the Nengo command line:
How does it Work
In this case, the RosparamServer sets the `/use_sim_time` to true, so all ROS nodes will use simulated time. Also, the Nengo starts the node called `NengoRosTimeSlave`, which listens to data published on the /clock topic.
Each time when the simulation step is called (see: ca.nengo.util.impl.NodeThreadPool.step()), it will wait for some new value published on the /clock topic. If yes, the Nengo receives the enTime value and makes one simulation step.
Note that in this demo, no TimeMaster was launched, so the entire network waits for some node which publishes Clock messages to the /clock topic. Now, the resulting network looks as:
Note that now the interactive simulation can be launched, but the simulation will not start without the eternal TimeMaster.
So, we can launch any external ROS node which publishes time data to the `/clock ` topic. This can be made e.g. by the following:
cd nengoros/demonodes/basic ./runner org.hanns.demonodes.time.pubsub.Pub /use_sim_time:=false
After launching the eternal TimeMaster, all nodes listen to the simulated time and simulation can run now. This situation is depicted in the following figure: