Skip to content

RustyRailways/RustyRailways

Repository files navigation

Rusty Railways Logo

Rust and Godot Based Autonomous Lego Train System


Rusty Railways Railtrack 2 Rusty Railways Server and Client Station 2

Description

Group Project by lucaSartore (Luca Sartore), LorenzoCattai (Lorenzo Cattai), MrLakige (Michele Callegari), Technorico (Federico Peruzzo) for Embedded Software for The Internet of Things - 145996 taught by professor Kasim Sinan Yildirim at University of Trento, DISI Department.

This is a system that automates the motion of Lego trains and rail switches. You can tell the system in which station you want a train to go (either using an HTTP request or using our GUI), and the system will figure out the best way to achieve the goal, even moving trains that are on your way if necessary.

Presentation Video

Presentation Video

Components

The system is implemented using 5 different components:

  • The Master: This is the component that does all the calculations to find the optimal path, and then controls the trains and the switches, you can learn more about the master here
  • The Client: (Godot based client to create the train track and control/monitor the train system), you can learn more about the client here
  • The Map: The map is a support data structure (a modified graph in particular) used by the master, you can learn more about the master here
  • The Common Infrastructure: The common infrastructure defines some basic messages that all components need to communicate with each other, as well as the IPs and the hardware abstraction layer traits, you can learn more about the master here
  • The Trains: You can learn more about the code that manages the trains here
  • The Switches: You can learn more about the code that manages the switches here

Documentation

Installation

Here you can find a quick list of the things you need to do, to try our project yourself.

Master Installation

The current implementation of the master runs on a Linux system (e.g. Raspberry Pi with Raspberry Pi OS) so to run it, you just need to install the regular rust toolchain. Given that we used a Hardware Abstraction Layer (HAL) to implement the master, with a bit more work, it can be executed on something smaller (like an ESP-32), if you are interested in this you can check out the train toolchain installation down below.

Train Toolchain Installation

The train code is written in embedded rust, with the embedded-hal and embedded-svc crates. To install the software needed to build for our target (The ESP-32) you can follow the tutorial here.

Switch Toolchain Installation

To compile the switch code you can follow this tutorial we have written.

Client Installation

See Client README.md.

3D Printing

Files to print the switch mechanism are located here You can find a 3D printing tutorial here.

Electronic Components

To build the switch PCB you can follow this tutorial we have written

Additional Videos

1.mp4
2.mp4
3.mp4
4.mp4
5.mp4

Special Thanks

FabLab UniTn for the space, tools and part of the materials used