- To gain an understanding of how robot brains (controllers) are defined in RoboGen and how they operate.
Similar to the Getting Started Exercise and Body Plans (Morphologies) exercises, you will be using RoboGen with User Interface.
Note: Download the folder Tutorial to get relevant files for this exercise.
Now that you understand how to modify a robot body, it is time to learn a bit about how robot brains are described.
From the Build a Robot tab open myRobot2.robot.txt. This is an exact replica of simpleRobot.robot.txt that you saw in action at the start of Exercise 1.
Now look at the lines from
Hip1 0 Oscillator 0.8 -0.8 1
and below that were absent in myRobot1.robot.txt. These lines define a very simple “brain” for your robot.
In general, brains in RoboGen are Artificial Neural Networks (ANNs). However, we also provide the ability to include some alternative types of artificial neurons, such as oscillators, in order to quickly find good locomotion abilities. Here, for example, we have specified that motor-neuron 0 of body part Hip1 is an oscillator with a period of 0.8s, a phase offset (relative to a central clock) of -0.8 periods, and an amplitude of 1 (meaning the joint’s entire motor range).
Refer back to http://robogen.org/docs/guidelines-for-writing-a-robot-text-file/ for details of defining a robot brain (specifically the content under “The brain part”).
Try modifying the parameters of the oscillators and see what happens. What happens if you increase the period? What happens if you decrease the amplitude (note amplitude must be in [0,1])? Or change the phase offset?
It is also possible to define a standard ANN in this description file. Simple ANNs may be somewhat easy to understand, but as the ANNs become more complex it may become difficult to understand how the parameters (weights and biases) influence behavior.
Now should try to define a simple neural network to gain some intuition about how they operate.
Replace each oscillator definition line with a line like
Hip1 0 Sigmoid 10
(replacing Hip1 with the appropriate body part name for each motor neuron). This will set each motor neuron to be a standard sigmoid, with bias 10.
- What happens if you simulate this robot?
- What happens if you change 10 to -10 on some of these lines?
- Keep in mind that you have only set neuron biases, there are still no weights between neurons.
In order to manually set weights, you will need to add weight lines to this file. For example: remove all of the bias lines you just created and add this line to the file such that it comes immediately after two blank lines following the body description
Core 0 Hip1 0 10
This specifies that there is a connection with weight 10 from neuron 0 of Core to neuron 0 of Hip1. Note that the Core component contains the IMU sensor with accelerometer and gyroscope. The indices of neurons there are as follows: 0,1,2 are the sensor neurons corresponding to x,y,z accelerations respectively. 3,4,5 are the sensor neurons corresponding to x,y,z gyroscope respectively. Neuron 0 of Hip1 corresponds to the motor neuron driving the servo motor of Hip1.
- What happens when you specify this weight?
- What happens if you also include a bias on Hip1 0? Remember to include a blank line after the weight description lines.
In general, it is not so intuitive to define the parameters of a neural network by hand, but do not worry we will be allowing evolution to define the weights for us!
Previous Exercise: Body Plans (Morphologies) Next Exercise: Configuring the Simulator