Week 24. Turtlebot + Camera

2 minute read

To Do

  • Study the example of Turtlebot + camera
  • Review Keras errors when running the example
  • Study the code to understand it.

Progress

Study the example of Turtlebot + camera

The purpose of this point is to run the example where the Turtlebot uses the camera. To do this, both the code and the requirements had to be updated.

Review Keras errors when running the example

The error that occurred when trying to run the example was related to the order in which the images entered the network. The difference is that if the library to use tensors is Theano, the channels go in first position followed by rows and columns and if the TensorFlow library is used the channels go to the last position.

Since the Keras version has been changing, we have had to look for the equivalent call to the one that already existed since it was not in use.

Study the code to understand it

With Keras’ error fixed the example runs without problem but, before letting him train we studied the code a bit.

The complete algorithm is formed by a class, two functions and the main program.

The learning by reinforcement algorithm used in this example is DeepQN. Among the methods we can see the configuration of the neural network, with two layers of 16 neurons, followed by a MaxPooling, conversion to vector format and fully connected to the output layer that has 3 values, v, w and _.

The main program follows the following steps:

  • The Gazebo environment is created with the world and the robot + camera.
  • The training parameters are set (times, steps, etc)
  • If there are previous save points, they are loaded, otherwise they are initialized.
  • Double loop for the resolution of the algorithm: one for the times and one for the steps. The robot will take small steps where it will study the environment. If it collides, it resets the position and increases an epoch.

You can see the learning process in the next gif.

Turtlebot in labyrinth
Example of turtlebot + camera

The algorithm is in training right now. The result of the training will be shown in the next chapters. Training in progress.

Working

I’ll leave the algorithm here long enough for you to learn the circuit. Once it is achieved by changing only the world I will prove that it manages to learn this new environment.

Learned

This small goal increases the motivation in the project :-)