This tutorial shows how the Nengoros is able to launch current installed ROS nodes and use them in the simulation. This demo uses current ROS tutorial called turtlesim.
In this tutorial a small turtle-bot navigates in a simple environment. Turtlebot is able to see its speeds (angular and forward) and `colors` of the environment (r-g-b). These data are published across the ROS network. The robot is subscribed to `cmd_vel` topic.
Note about composed types of messages:
For example, the cmd_vel message is type of geometry_msgs/Twist, decoding and encoding of this message type had to be added into the Nengoros project, under `simulator/ctu.nengoros.comm.rosBackend.backend` package. The sctructure of message can be viewed either:
- on ros.org/geometry_msgs
- api documentation from ros
- the auto-generated Java interface can be found under `rosjava/rosjava_messages/build/generated-src/`
- or (in case of ROS installation) by launching rqt, in menu select: plugins/message introspection and find a particular message, the result looks as follows:
We can see that the message is composed of two vectors of double primitive data types, each defining x,y,z. In this case, the message is translated into vector of 6 corresponding float values in the Nengo simulator.
Launching the Script
To start the demo, launch the Nengo simulator GUI and write to the command line:
The script does:
- uses rosrun command to launch the turtlesim node – a simple simulator with one turtle (part of ROS installation)
- adds necessary custom inputs and outputs to the Neural Module. Types of IO must correspond with the ROS message types
- adds generator of 6 pseudo-random values (generate 6 numbers for velocity)
- adds two neural networks whiich will represent signals received from the turtle (color and position)
The resulting state of the simulator is as follows:
The turtlesim application is running and the turtle is waiting for new commands.
Running the Simulation
Now, after opening the interactive simulation window and clicking the “play” button, the command signals are generated and sent to the turtle. Turtle wanders around and sends back the sensory data. These are then approximated by two populations of spiking neurons:
This demo showed how the Nengoros is able to use not only ROSjava nodes, non-ros native applications, but also properly installed ROS nodes. All these components can be simple employed in one bigger simulation.