This demo shows connection of Nengoros with an external simulator of simple virtual environment.
The simulator is called ViVae and was developed by colleagues on CTU, in group called CIG.
The simulator contains two main surfaces (grass and road) several types of objects (movable objects obstacles) and mobile agents with actuators (two motors) and sensors (friction, distance and speed sensors). The simulator simulates physical properties of this environment (friction, collisions etc).
For purposes of our research, the simulator was equipped with the ROS interface. Now the SimulatorServer provides ROS services such as load map, start/stop the simulation and spawning agents in the simulation.
Running the Demos
Simple Agent Controllers
The script named `nr-demo/vivaeplugin/02PIRegulator.py` shows the following:
- The SimulatorServer is started
- Map is loaded
- One agent with distance sensors is spawned (only two sensors of four used)
- These sensors are wired in a closed loop with the agents actuators with simple PI regulator.
- The simulation is ran for several seconds (measured data are stored under the `simulator-ui/data` folder)
- Simulation is restarted and interactive Nengo window is opened
In the demo, the regulator is used to navigate agent on the road, while the objective is to navigate as fast as possible. Road has small friction, so the agent navigates fastest on the road.
In te fig. we can see the Nengo interactive simulator window and the Vivae simualtor. The following figure shows closed control loop wired in the Nengo simulator and the third figure shows the corresponding ROS network.
GUI Drag and Drop Template
There is GUI template in the current version of Nengoros, which loads map and spawns as many agents as is possible with the map (agents bodies are placed already in the map). After spawning the agent, its controls can be used as Nengo Origins/Terminations in the simulator (either scripting or GUI interface).
In this case, the map contained three agents “bodies” so the Nengo script managed to spawn 3 agents. For each agent, the Publisher and Subscriber were registered on both sides of ROS network: the SimulatorServer and Nengoros modem, which translates ROS messages to Nengo communication.
The script also configures number and parameters of agent sensors. In this case, each agent has 10 friction sensors, 10 distance sensors and one speed sensor.