How starss9/cruise-controller-system works
Project Type and Purpose
• This is a lightweight, single-page web application built with Streamlit.
File Structure
• Top-level files:
• README.md – Project description and run instructions
• cruise_Sim.py – Main Streamlit app and simulation logic
• Untitled1.ipynb – Development/playground notebook (not part of production pipeline)
• No separate frontend/backend folders: the Streamlit script both renders the UI and drives the backend simulation.
Extract Key Architectural Insights from README
• Core features: real-time plots, slider-based parameter tuning, system stability/performance visualization.
• Technical stack: Python + Streamlit, underlying plotting library (Streamlit’s built-in charts or Matplotlib/Plotly).
Main Components
a. User Interface (UI)
• Browser / local client rendering the Streamlit app
• Slider widgets for Kp, Ki, Kd
b. Streamlit Application Server
• cruise_Sim.py as entrypoint
• Handles HTTP/WebSocket requests from the browser
c. Simulation Engine
• PID controller logic (compute error, integral, derivative, output)
• Vehicle dynamics model (first-order/second-order system)
d. Visualization Module
• Real-time plotting libraries (Streamlit charts, Matplotlib, or Plotly)
• Data buffers/time-series generator
e. Development Notebook (Optional/Evaluation)
• Jupyter notebook used for prototyping
• Not active in production but useful to mention as “Dev/Analysis”
Relationships & Data Flow
• 1) User moves sliders → 2) UI widget events sent to Streamlit server → 3) Server invokes Simulation Engine with new Kp, Ki, Kd → 4) Engine returns time-series of speed vs. setpoint → 5) Visualization Module renders updated plots → 6) Browser updates display.
• All components run in the same Python process (no external services or databases).
Architectural Patterns & Design Principles
• Separation of Concerns:
• UI layer (Streamlit widgets & layout)
• Business logic layer (PID computation + vehicle model)
• Presentation layer (plot rendering)
• Event-driven update cycle: UI events trigger recomputation and re-rendering.
• Single‐process, reactive web app (no microservices or external dependencies).
Essential Elements
• Clear, concise labels for:
• Browser (User)
• Streamlit App / Server
• PID Simulation Engine
• Visualization Component
• (Optional) Jupyter Notebook