This demo shows how the NengoRos can be setup to use its own simulation time and publish it to (other externally running) ROS nodes.
Demo is similar to the `basic/minmax.py` (starts one external ROS node), this node finds min and max, multiplies these values by the current time (in seconds) and publishes values.
Launching the Script
The demo file is located under `nengoros/simulator-ui/nr-demo/basic/timeMaster.py` and can be launched from the Nengo command line:
How does it Work
In this case, the NengoRos automatically launches own Parameter Server and sets the parameter
`/use_sim_time` to `true`. This ensures that all ROS nodes will use simulated time by default (this can be overriden by the command line parameter `/use_sim_time:=false’).
Then, the ROS node called NengoRosTimeMaster is launched. This node publishes the endTime value at each Nengo simulation step, see: `ca.nengo.util.impl.NodeThreadPool.step()` for more exact information. This value is then received by all ROS nodes, simulator makes step and waits for responses from all ROS nodes.
The RQT visualization of ROS graph can be seen here:
We can see that NengoRosTimeMaster node publishes data on the `/clocl` topic. These information about current (simulated) time are received by both running ROS nodes (acrual ROS node and its modem). There is a RosParam node in the picture, this is used to set parameters in the ROS network, such as `/use_sim_time:=true`.