diff --git a/doc/architecture/README.md b/doc/architecture/README.md new file mode 100644 index 0000000..14e7407 --- /dev/null +++ b/doc/architecture/README.md @@ -0,0 +1,29 @@ + +# Architecture Documentation + +This section describes the architecture of the racecar system. + +## Overview + +The system is built using a modular ROS2 architecture that supports both: + +- Simulation (Gazebo) +- Real vehicle hardware (Racecar) + +The same control flow is reused for both environments. + +--- + +## Architecture Diagrams + +- [System Context](context.md) + High-level view of how the system interacts with users and external systems. + +- [Component Map](components.md) + Internal structure of the system and relationships between modules. + +- [Sequence Diagram](sequences.md) + Step-by-step of the most complex core logic flow through the system. + +--- + diff --git a/doc/architecture/components.md b/doc/architecture/components.md new file mode 100644 index 0000000..9e55ed8 --- /dev/null +++ b/doc/architecture/components.md @@ -0,0 +1,98 @@ + +# Component Map + +This diagram shows the relationship between the major modules of the system. + +```mermaid + +flowchart LR + + User[User] + +%% -------------------- +%% INPUT INTERFACES +%% -------------------- + subgraph Input [Input Interfaces] + Control["(Joystick / Web Interface)"] + end + +%% -------------------- +%% ROS SYSTEM +%% -------------------- + subgraph ROS [ROS2 System] + direction LR +%% Control (grouped) + subgraph Controls [Arduino Motor Controls] + direction LR + SpeedControl[SpeedControl] + PositionControl[PositionControl] + Openloop[Openloop] + end + +%% Perception + subgraph Perception [Perception] + Lidar[Lidar] + Camera[Camera] + end + +%% Odometry / state + subgraph State [Odometry] + direction LR + IMU[IMU] + Encoder[Wheel Encoder] + Steering[Steering Angle] + end + +%% Navigation / decision + subgraph Navigation [Navigation Algorithms] + direction LR + SLAM[SLAM] + Blob[Blob Detection] + Brushfire[Brushfire] + Autopilot[Autopilot] + end + +end + +%% -------------------- +%% EXECUTION +%% -------------------- + subgraph Execution [Execution Systems] + direction LR + Racecar[Racecar] + Gazebo[Gazebo Simulation] + end +%% -------------------- +%% MONITORING INTERFACES +%% -------------------- + + subgraph Monitoring [Monitoring and Tools] + direction LR + RViz[RViz] + RQt[RQt] + ROS2Bag[ROS2Bag] + end + + ROS --> Monitoring + +%% -------------------- +%% FLOW +%% -------------------- + +%% Inputs into system + User --> Input + Input --> ROS + +%% Sensor pipeline + State --> Navigation + State --> Controls + Perception --> Navigation + + +%% Navigation feeds control + Navigation --> Controls + +%% Brushfire separate (map-level) + +%% Control outputs + ROS --> Execution diff --git a/doc/architecture/context.md b/doc/architecture/context.md new file mode 100644 index 0000000..9aee402 --- /dev/null +++ b/doc/architecture/context.md @@ -0,0 +1,39 @@ + +# System Context + +This diagram shows how the system interacts with external actors such as the user and the simulation environment. + +```mermaid + +flowchart LR + + User[User] + + subgraph Input [Input Interfaces] + Control["(Joystick / Web Interface)"] + end + + subgraph Core [ROS2 System] + ROS[ROS2 Nodes] + end + + subgraph Execution [Execution Systems] + Gazebo["Simulation (Gazebo)"] + Hardware[Racecar] + end + + User --> Control + Control --> ROS + ROS --> Gazebo + ROS --> Hardware + + + + + + + + + + + diff --git a/doc/architecture/sequences.md b/doc/architecture/sequences.md new file mode 100644 index 0000000..39f42de --- /dev/null +++ b/doc/architecture/sequences.md @@ -0,0 +1,39 @@ +# Sequence Diagram + +This diagram illustrates the most complex core logic flow of the system during autonomous operation. + +```mermaid +sequenceDiagram + + participant Sensors + participant ROS2 + participant Navigation as Navigation and SLAM + participant Blob as Blob Detection + participant Autopilot + participant Arduino + + %% Initialization + ROS2->>Navigation: load map and initialize path + + %% Continuous loop + loop Autonomous Navigation + + Sensors->>ROS2: publish sensor data (lidar, camera, imu, encoder) + + %% Localization and navigation + ROS2->>Navigation: send lidar and odometry + Navigation->>ROS2: position estimate + + %% Blob detection + ROS2->>Blob: send lidar and camera data + Blob->>ROS2: detected balloons + + %% Autopilot (reactive wall avoidance) + ROS2->>Autopilot: send lidar data + Autopilot->>ROS2: generate steering and speed commands + + %% Execution + ROS2->>Arduino: send control commands + Arduino-->>ROS2: odometry feedback + + end