This page primarily provides usage examples for simulating and evolving the robot in RoboGen with User Interface edition.
NOTE:
This information can also be adapted to other Robogen editions such as RoboGen on the Web and the RoboGen with Command Line of RoboGen. Click here for more information.
Four steps to evolve a robot
Robogen is designed to be a simple and powerful tool for evolving robots. The picture below shows the fours simple steps:
The goal of the following sections is to provide a detailed explanation on all the aspects of Robogen Software in detail, with the aim to build a Smart Cart Robot whose brain is evolved through the RoboGen software Suite.
Setting up the environment:
Once the last line of installation command of the installation procedure is executed, the robogen user interface will appear on the screen. If a popup to add Robogen as a system app appears, press yes. From now on, you can start the app by just searching Robogen on the search bar.
The app comprises two main components: simulator and evolver. As names suggest, the simulator is responsible for performing and displaying you a simulation of your robot, while the evolver is responsible for evolving your robot. At any time, you can see the status of the simulator and evolver on the top right corner of the app. In the case of an inactive system, you will need to activate it by clicking a link appearing on the status.
By default, at the first usage, the software will download necessary files. You can see the downloading status at the top-right corner of the Robogen app window. When the app is ready to use, the status will change for both Simulator and Evolver to active. Once the statuses are active, you can follow this documentation to build your first Robot in Robogen.
Download the files: Cart Robo files for download
Once downloaded extract the zip file and place it in the folder ~/Robogen/Exercises/Excercise1
.
Home page:
By default, the app will be pointing to the home page. It contains two folder paths: Main Folder and Project Folder. The Main folder path will automatically point to ~/Robogen/Exercises
folder. Remember, only the files within this folder are available for the Simulator and the Evolver. The second folder is the Project folder
that contains all the project files. Go ahead and select ~/Robogen/Exercises/Excercise1
as your project folder. This step will automatically recognize the files and load them into the system.
Step 1: Build a Robot
This section allows to manually defining the body and brain of a robot or upload an existing robot body-brain file (e.g. name.robot.txt). For this exercise, choose cart.robot.txt as your Robot file (it should be selected by default). Followed by this, you will have the following sections
- Robot Body: that describes the tree structure of the body
- Hidden neurons: that describes any hidden neuron in the brain of the robot along with their parameters
- Connection to describe the connection of the neural network and
- The bias that defines the offset
As you see the current robot has no hidden neurons and no connections. However, there is a slight bias that makes the robot moves.
Let’s now test the robot by clicking Test Me button on the right bottom of the application. Clicking this should open a new window. Click, drag and zoom to have a look on the robot. As you see, the robot has three IR sensors on the front and one IR sensor on the back. The robot also has a front-drive mechanism, where the front two wheels are actively driven by DC motor while the back wheels are passive.
Click the button P on your computer to see the robot in action.
Wondering why the robot moves?
This is because of the bias in the robot’s network. The robot currently has a bias of 0.1 (clockwise) on the left wheel and 0.5 (anticlockwise) on the right wheel. Modify these numbers to get a robot that goes straight with its maximum speed.
Step 2. Simulation Settings:
Simulation settings aims in defining the environment of the robot. The settings should be as close as that of reality to ensure the right robot behavior.
In Simulation Settings tab you will see the file conf.sim.txt is automatically updated. Firstly, go ahead and press Simulate Robot button on the right. Zoom in the simulation window and press P to simulate the robot.
Below are the parameters that can be configured in the Simulations Settings.
• Robot File (The main Robot file from Step 1)
• Fitness Function File. (This is the important file that defines the good behavior of the robot. More details of writing this file are available here)
• Time step and simulation time are the parameters that define how precise the simulation calculation should be and how long the execution should take place.
• Terrain friction and Gravity
• We can also have many other parameters for the simulation settings. Look here for more details.
• obstaclesConfig file is what defines the obstacle (or maze) of the simulation. You can simply modify it by opening it in a text editor. Guide for creating a maze/arena is available here.
Step 3. Evolution Settings:
Evolution settings define the parameters that you can change to evolve an effective robot. This link will guide you through the detailed list of parameters.
As you see the evolution settings from conf.evol.txt would be automatically loaded into the User Interface. You should have the cart.robot.txt (from step 1) and conf.sim.txt (from step 2) as your robot and simulation file. Cart robot is a special kind of robot that supports only the brain evolution, however, Robogen is capable to evolve a body of the robots too. So for time being set the evolution mode to brain. You can also explore the evolution parameters (like number of generations, population and offspring size, Replacement Strategy, etc.) and Brain Variation Probabilities.
With default parameters, let’s run our first evolution by clicking Evolve Robot button on the right bottom corner. Clicking Evolve Robot button leads automatically to section 4 where results of the evolution are displayed.
Step 4. Evolution Results:
On this page, you have two tabs, Past Evolutions, and Ongoing Evolution. Past Evolutions are used to analyze your previous evolutions and Ongoing Evolution (where you are now), will show the status of your current evolution. However, both of these tabs have almost similar layouts.
The top part of the page contains the Fitness Evaluation Graph that shows the Generation on the X-Axis and the fitness value in the Y-Axis. Below this graph, you have a table that shows the best, mean and standard deviations of the individuals in each generation. On the right of these values, it displays the performance distribution within the population. In this distribution, all individuals of that generation are represented as a square (of different color according to the individual fitness value). By clicking on any individual of the generation, it is possible to play the simulation of the corresponding individual.
What does Fitness value mean?
The fitness value is the value that defines the performance of the robot. This value comes from the fitness function file that you used in Step 2. By default, the fitness function we have provided try to maximize speed of the robot regardless of obstacles.
Can Evolutionary Algorithm eventually solve the maze problem with this fitness function?
Yes, eventually, the well-tuned evolutionary algorithm can solve the maze just by evolving a robot that follows always the same trajectory. This is called overfitting problem. The ideal fitness function should generalize the problem in such a way that the same robot should be capable of solving the task irrespective of the maze configuration and of a certain trajectory.
How to ensure that your robot does not overfit a fixed trajectory?
Starting Positions: You can have multiple starting positions configured through the startPositionConfigFile in the Simulation Settings. This method will evaluate every individual (during evolution) starting from all the available starting points and the lowest value across them is returned as the fitness value of the robot.
How to test the robot in different arenas?
In the simulation settings section of the robogen app, it is possible to change the arena by changing: obstaclesConfigFile= nameofyourfile.arena.txt
By default we provide two areas:
- arena.txt
- arena.txt