[English](README.adoc) | [日本語](README_ja.adoc)
In this repository, we provide assembly diagrams and programs for a railroad crossing constructed with LEGO MINDSTORMS EV3 kit and additional LEGO blocks. This railroad crossing can be operated alongside the LEGO City Train (and together with EV3_Train: https://github.com/kuboaki/ev3_train).
The STAMP/STPA [stamp_stpa] handbook [handbook1] provided by IPA [ipa] includes a case study on railroad crossings. However, this case study is limited to descriptions on paper. We thought that having a physical model to experiment with could aid in understanding hazards and other factors. Since testing with real trains is impractical, we decided to develop this system by creating LEGO block versions of the described railroad crossing and train for experimentation.
This system involves two actors:
-
Train
-
This is a standard LEGO City Train controlled by a remote.
-
-
Railroad Crossing
-
This is a simple railroad crossing as described in the handbook. It includes a locking rods, warning lights, and sensors to detect train passage.
-
For the train, we used a remote-controlled "LEGO City Train" kit.
The train is operated using a remote control typically provided with LEGO City Trains. I used the “Lego City 60198 Cargo Train” locomotive and freight car, but others will do.
It can be controlled wirelessly for forward, backward, and stop operations, with variable speed options.
The railroad crossing was constructed using LEGO Mindstorms EV3 and other LEGO parts.
The components of this crossing are as follows:
-
Blocking unit (Blocking rods and their controllers)
-
Warning lights (replaced with EV3 body LEDs)
-
Warning Sound (replaced with EV3 sound)
-
Train passage monitoring unit
-
Manual switch for operating the blocking unit
Note
|
This railroad crossing model is based on a case study introduced in the STAMP/STPA handbook provided by IPA. It may differ from real railroad crossings, as it was not created based on research of actual railroad crossings. |
Blocking unit consists of a Blocking rods and a motors that moves it.
The unit uses color and ultrasonic sensors to check for passing trains.
The system is built using TOPPERS/EV3RT (Real-Time platform for EV3) and programmed in C language. For details about the development environment, refer to the EV3RT website.
-
EV3RT on TOPPERS
The version of EV3RT used in this project is "1.1-release." If you intend to run it on older environments, adjustments may be needed in certain parts such as timer precision and configuration file formatting. It’s recommended to update to version 1.1 and adjust the code accordingly. Of course, it should also work well with other programming languages that support EV3.
Note
|
For simulation using a miniature environment, refer to hakoniwa_simulation.md .
|
railroad_crossing
├── images: LEGO Studio, Blender, png
├── models: system design model(uml)
└── railroad_crossing01: codes for railroad crossing
$ cd {installed location}/ev3rt-1.1-release/hrp3/sdk
$ git clone https://github.com/kuboaki/railroad_crossing.git
Go to the railroad_crossing
directory and build the railroad crossing program railroad_crossing01
.
Warning
|
Be careful that the directory you build is not railroad_crossing01 !
|
$ cd railroad_crossing
$ pwd
{installed location}/ev3rt-1.1-release/hrp3/sdk/railroad_crossing
$ make app=railroad_crossing01
$ ls -l app
-rw-r--r-- 1 kuboaki staff 102204 8 9 17:48 app
Transfer the created app
file to EV3 for the crossing.
See the EV3RT website for transfer instructions.
-
[ipa] 独立行政法人/情報処理推進機構 (Information-technology Promotion Agency, Japan)
-
[stamp_stpa] STAMP(Systems-Theoretic Accident Model and Processes,ステム理論に基づくアクシデントモデルと STPA(System-Theoretic Process Analysis)
-
[handbook1] はじめてのSTAMP/STPA https://www.ipa.go.jp/digital/stamp/ug65p90000001lxs-att/000055009.pdf