Go to file
2024-09-12 19:41:48 +00:00
.README Upload files to '.README' 2024-09-12 19:20:19 +00:00
Follow_the_line Update 'Follow_the_line/README.md' 2024-09-10 15:45:36 +00:00
Object_Sorting Update 'Object_Sorting/README.md' 2024-09-10 15:43:32 +00:00
.gitignore Virtual Enviroment created and added to git ignore 2023-09-25 17:32:01 +02:00
README.md Update 'README.md' 2024-09-12 19:41:48 +00:00

Python on LEGO EV3 Framework

Welcome to the Python on LEGO EV3 Framework that was created in the course of the thesis "Open-Source LEGO EV3 Python Framework for Teaching". The framework contains the two sample projects that where the main contribution of the thesis. In the following sections we will describe the steps you need to consider before using the projects on your EV3 robot. In addition the abstract of the related thesis is listed so you can get an impression of the work. You can access the full thesis here.

Preperation Steps

You need to prepare you EV3 Brick before you can use it with Python and the given projects.

EV3 Dev

We chose the operating system ev3dev which makes the Lego robots compatible with all types of script languages, inculding Python3. You need to download the latest image from the EV3 DEV Website. With the image you need to flash a microSD card. The software platform runs directly from the microSD card and does not interfere with the original firmware. After putting the SD card into your Brick turn it on and the Brick will start to boot. After the first boot that takes several minutes from now on your Brick will boot from the SD card everytime. There are several possibilitys to communicate with your brick but we connected it via a USB-Cable and used Microsoft's editor Visual Studio Code. But it is also possible to use other editors and communicate via an SSH connection. To see the alternatives and in case of problems visit the Getting Started with ev3dev-Guide.

Visual Studio Code

VS Code is supporting nearly every major programming language and is very versatile thanks to additional extensions. You can download the editor here. The extension ev3dev-browser is specially created for working with devices on which the ev3dev image is booted. You can install it directly inside the extension Browser of VS Code. After installing the extension, you should see the text EV3DEV DEVICE BROWSER at the lower edge of the Explorer. Click on the arrow next to the text and afterward on the appearing text "Click here to connect to a device". In the pop-upped box you can search for your device and by clicking on it, you can connect it. If the connection succeeded, you can see the device in the Explorer with a green dot on the right side. Once your device is connected, you can simply run the opened projects by clicking F5. If you want a more precise instruction, visit this GitHub Repository.

Dowload program

As a last step, you need to download the program code you want to run on your robot. Simply open the program inside of VS Code and, if needed, adapted the Ports according to your environment. When the program is customized and the robot is connected, simply press F5 and the robot will download the program and run it.

Open-Source LEGO EV3 Python Framework for Teaching: Abstract

The primary aim of the thesis is to explore the applicability of the programming language Python on the LEGO MINDSTORMS® Education EV3 set. As Python is one of the popular programming languages and important for the fields of data science and machine learning, applying it in the context of robotics is relevant for our university. The EV3 Brick already has MicroPython, a slimmed down version of Python, available. Since it can be frustrating, not being able to use all one's knowledge, the application of the full Python libraries should be achieved by using the ev3dev operating system.
The focus lied on creating two beginner-friendly sample projects that test the possibilities of the software platform. The first project has a robot follow a given line with two different approaches. One program works direct with the color recognized and one with the intensity of reflected light, both measured by the color sensor. The second project uses camera-based object recognition to have the robot sort two differently colored cubes. The device used for this is Pixy2, which is especially set up for working with the LEGO robotic sets. The program is build in an object-oriented way and switches between different methods that represent the states of the robot. The test for evaluating the generated codes is based on varying environmental settings. The behavior of the robot inside them is documented and capabilities are summarized. In the first project, the color recognition program is better able to cope with different environmental conditions, but rather slower and jerkier than the intensity of reflected light program under certain circumstances. Throughout the second project the work with the detection of Pixy2 was often tedious as a big part of it was captured by troubleshooting rather than fully testing the capabilities in the environment settings. The full project extent is documented on the Git of the chair, including the developed code. The framework on Git as well as the thesis illustrate that the use of Python on the EV3 is possible and rather simple with the ev3dev system.