Code used to control the robot

The language

The choice

For this project, we used Rust.
Why? Rust offers better memory safety than C. Also, it has been a fun opportunity to learn a new language.

The Rust Ev3dev library

We made a pull request to the upstream project, by adding methods for the gyro sensor to the official library

Module structure

For convenience, we also generated the whole docs by running cargo doc.
It can be found here

Files

We created the following files for our robot:

main.rs
Coordinates and organizes all the movements.
clamp.rs
Controls the movements of the clamp.
navigation.rs
Controls the navigation of the robot.

Clamp and Scissor lifting module

The clamp.rs file consists of one main module, with two nested private submodules

It interfaces with the two motors and with the ColorSensor

Navigation module

The navigation.rs file consists of a single module, with convenience methods to rotate the robot, move it and fix drifting

It interfaces with the two motors, with the gyro and with the ultrasonic sensor