Creating a robot for Eurobot : Part 1 - Context

(with some rust pieces included)

Cover Image

Hi there !

This is my first post to announce an upcoming serie of posts about creating a robot in Rust.

I am part of a team of students participating in Eurobot and this year we have decided that our firmware will be written in Rust. The goal is to write most of it in Rust but if we lack some time we will use C. I will also write about both higher level concepts (AI) and lower level concepts (hardware design).

I will try to use this blog as a logbook for our organization and for tutorials.

But first, why do we build this robot ?

The competition

This year the theme of the competition is Atom Factory ! The 2019's rules should be out soon but here are a few points that will not change :

  • there is two team facing each with one or two robot(s)
  • the robot must be autonomous for the duration of a match (100s)
  • the robot must not collide with an other robot

The goal is to have as many points as possible, the top 16 teams will take part in the final phases.

The team

We are a team of roughly 10 students ranging from undergraduate to graduate level and with a lot of different skills : some people are studying Computer Science, some Electronics and some others Mechanical Engineering. Most of us are quite old in the sense that this will be our last year in the competition.

This is why we plan to recruit a lot of new students ranging from the 1st year to the 4th year. Recruiting new students means teaching them our technologies, so it will be a lot of work. I have already a few classes ready for Rust but we still have to test them.

We also plan to use this new potential workforce to create a secondary robot this year

We try to reuse as much stuff as possible from the previous years but a few things need to redone every year :

  • the whole structure of the robot
  • the AI of the robot which handles action prioritiy based on our sensor input
  • new electronic cards when the previous ones did not work as we wanted them to

The technology

This year we decided that our main robot will be driven by a Raspberry PI 3, it will run the main AI which is a petri net calling C++ functions in each state. The C++ codebase is roughly 50k lines of code so it's a really good exercise for students to try to integrate themselves into this codebase.

The Raspberry PI communicates through a serial (or USART) link with an electronic card. We use a Nucleo f446RE which is based on the stm32f446RE microcontroller. It features :

  • Cortex M4 running @ 180 MHz with an FPU
  • 4 USART and 2 UART
  • 3 CAN
  • More timers than we will ever use

Last year this card was programmed in C++ using mbed but since we were not satisfied with it and since I am a huge Rust enthousiast we will use Rust this year.

This card has to take care of :

  • multiple DC motors
  • 2 brushless motors controlled through an ESC
  • a lot of servomotors that we control through an UART bus
  • communicating with old electronic cards with a CAN bus

There are also a few sensors but nothing too fancy.

The nucleo in the foreground, and the raspberry pi in the background The cable mess that is our robot

Old electronic boards ?

Last year, we decided to dump all of our electronic cards to redo them with mbed.

We used to have a decentralized architecture, where each electronic card only deals with one sensor/actuator and they all communicate through a CAN bus to a card to relay the messages on the UART link with the AI.

This architecture had a lot of pros, but also a few cons : we used dsPIC30/33F so we had to use a proprietary C compiler with some homemade libraries for a lot of stuff.

But the real reason for why we dumped it is technical debt. The people who designed this architecture and who understood it eventually graduated and they left the school without writting enough documentation.

Finally, here is a small diagramm of last year robot architecture (chocobot) :

Chocobot architecture

That's it for today, next time I will dive a lot deeper in our microcontroller and how we managed to use Rust on it !

Update (25-09)

This year subject is now out !

Image description

You can check the rules here !