BreakingBot

How to use our code?


Go back to the contents page

You want to run our code on your robot? Let's see a short tutorial, supposing that you are using a Linux environment.


FIRST STEP

First of all, you need to flash a Debian GNU/Linux system on the SD card of the robot. To install Linux on your ev3, follow the indications made by Ralph Hempel and David Lechner, given here.

Now, to use our code with the robot, you have 2 possibilities:

  • Download our code on your computer (considering that you have a Linux environment), cross-compile it and send the executables to the robot.
  • Download our code, compile it and launch it on the robot.

CROSS-COMPILATION WITH DOCKER

It seems a little bit long to install docker to cross-compile instead of just using the robot to compile, but believe us, even if you will of course spend a certain amount of time to install docker, but then only a few seconds will be needed to compile and transfer the executable on the robot.

On your user directory (/home/$USER):
Clone the ev3dev github
$ GIT_SSL_NO_VERIFY=true git clone https://github.com/in4lio/ev3dev-c.git
(Install git if needed : $ sudo apt-get install git)
$ cd ~/ev3dev-c/source/ev3
Clone the BreakingBot directory:
$ GIT_SSL_NO_VERIFY=true git clone https://github.com/thib774/BreakingBot.git

Install docker:
https://docs.docker.com/engine/installation/linux/(choose your distribution and install Docker with repositories).

Install the ev3-dev image:
$ docker pull ev3dev/debian-jessie-cross
This docker image does not have all the required librairies. To install them, you need to run a cointainer, install all the librairies and commit this container as an image.
Run a container :
$ sudo docker run -it -v /home/$USER/:/src -w /src ev3/debian-jessie-cross
In the container :
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install libbluetooth-dev:armel
$ exit

Now that we have a running container with all the librairies installed, we need to commit it as a new image :
$ sudo docker ps -l
Get the ID of the running container and copy it (the ID is 12 characters long) :
$ sudo docker commit (paste the ID of the container here) ev3dev-bluetooth
We now need to remove the running container :
$ sudo docker stop (paste the ID)
$ sudo docker rm (paste the ID)


You now have a brand new image to work with !
You can check it by typing:
$ sudo docker images
The result should show the images ev3dev/debian-jessie-cross and ev3dev-bluetooth (whose size is bigger because of the librairies we installed in).
If you want to delete an image (you should keep ev3dev/debian-jessie-cross in case of a problem):
$ sudo docker images (list all the images)
$ sudo docker rmi (ID of the image you want to remove)

Now you can use your brand new image by typing:
$ sudo docker run -it --rm -v /home/$USER/:/src -w /src ev3dev-bluetooth

Now that you are a docker Master, start a new container (you know how to do it, don’t you?) go into the BreakingBot/docker directory, and enter, in order:
$ cd ~/ev3dev-c/source/ev3/BreakingBot/docker
$ chmod +x *
$ ./first_compilation_docker
$ ./second_compilation_docker


Now in the BreakingBot/executables directory, you have the executables needed for the small and the big arena !! :) You now just need to transfer them on your robot (a transfer script is provided in the BreakingBot/executables folder, but you have to launch it outside of the docker container).


ON THE ROBOT

Connect to your robot with SSH and link it to the Internet, and the update the robot with the latest packages:
$ sudo apt-get update&& sudo apt-get upgrade

Install extra packages you will need for the project:
$ sudo apt-get install gcc make libbluetooth-dev

You are now ready to compile a toy example, and to run it. To do so, you first need to install the development environment on the robot:
$ git clone https://github.com/in4lio/ev3dev-c.git
$ cd ~/ev3dev-c/source/ev3
$ make
$ sudo make install


Now, clone the BreakingBot git to use it:
$ git clone --recursive https://github.com/thib774/BreakingBot.git
$ cd BreakingBot/robot
$ chmod +x *
$./first_compilation_robot
$./second_compilation_robot
(those steps may take some time)

You know have all the executables in the BreakingBot/executables directories.


Go back to the contents page

Created by Sofiène Jerbi, Thibault Petitjean (@thib774) and Florian Kohler (@FlorianKohler)

OS Course, Eurecom 2k16