Skip to main content

600m Trajectory Simulation Engine

📌 What is this for? (Quick Summary for New Interns)​

In Simple Words:
When you are testing the dashboard at your desk, you cannot physically launch a 1-ton hyperloop vehicle down the track just to see if your React code works!

That's why we have this simulation engine:

  • It reads a recorded CSV file (telemetry.csv) containing 126 seconds of a real flight test.
  • It plays back the run: accelerating up to 60 km/h, reaching the 600m end station, stopping, and returning back.
  • It sends these numbers into the Go gateway exactly like a real pod would.

1. What Does a Full Run Look Like?​

The flight path in telemetry.csv models a complete roundtrip run:

xychart-beta
title "Vehicle Speed Over Time"
x-axis "Seconds" [0, 15, 30, 45, 60, 75, 90, 105, 120, 126]
y-axis "Speed (km/h)" 0 --> 70
line [0, 35, 60, 60, 15, 0, 30, 60, 20, 0]

The 6 Stages of a Test Run:​

  1. 0 to 30s (Speeding up): Pod accelerates smoothly up to 60 km/h and travels the first 250 meters.
  2. 30 to 55s (Cruising): Pod cruises at steady 60 km/h towards the end of the track.
  3. 55 to 65s (Braking): Pod slows down and stops precisely at the 600-meter mark.
  4. 65 to 90s (Reverse run): Pod reverses direction and accelerates back towards the start dock.
  5. 90 to 120s (Return cruise & braking): Pod cruises back and decelerates safely.
  6. 126s (Docked & complete): Pod comes to a full stop at 0 km/h at Station Zero.

2. Automatic Stop When the Run Finishes​

While the pod is running along the track, it sets the over_current flag to 1.
As soon as the run finishes at second 126 and the pod reaches 0 km/h:

  1. The script flips over_current to 0.
  2. The web dashboard sees this transition from 1 to 0 and immediately stops the flight timer.
  3. The dashboard sends a start: 0 command to reset the launch sequence and unlocks the controls for the next test run.

3. How to Run It on Your Machine​

cd ~/RPi-Package/emulator
source venv/bin/activate
python src/run_trajectory.py

Watch the numbers stream into port 20006, and check your web dashboard to see the pod moving along the track in real time!