# iamhaadicool/probabilistic_robotics_lab_code architecture

> Architecture diagram of the GitHub repository iamhaadicool/probabilistic_robotics_lab_code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamhaadicool/probabilistic_robotics_lab_code
- Repository: https://github.com/iamhaadicool/probabilistic_robotics_lab_code

## Overview

This repository is a teaching lab for differential-drive simulation and dead-reckoning localization. The principal workflow starts in `main.py`, which creates a simulated robot and a dead-reckoning estimator, then runs the localization loop: simulate motion, obtain encoder readings, estimate pose, and plot the estimated trajectory. Pose composition supports both motion models. The README also describes simulated compass and feature-sensor capabilities, though they are not used in the lab workflow. Relationships below are based on the README and shown source excerpts; unsampled implementation details are omitted.

Main entry points: [`PR_LAB1/DifferentialDriveSimulatedRobot.py`](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DifferentialDriveSimulatedRobot.py) (Differential-drive simulator), [`PR_LAB1/main.py`](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/main.py) (Simulation setup), [`PR_LAB1/Localization.py`](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/Localization.py) (Localization loop), [`PR_LAB1/DR_3DOFDifferentialDrive.py`](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DR_3DOFDifferentialDrive.py) (Encoder odometry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Lab entry"]
  node_main["Simulation setup<br/>[main.py]"]
  node_index["State index<br/>[IndexStruct.py]"]
end

subgraph group_simulation["Robot simulation"]
  node_robot["Differential-drive simulator"]
  node_robot_base["Simulator base<br/>[SimulatedRobot.py]"]
end

subgraph group_localization["Localization"]
  node_loop["Localization loop<br/>[Localization.py]"]
  node_dead_reckoning["Encoder odometry"]
  node_pose["Pose operations<br/>[Pose3D.py]"]
end

node_user(("Lab runner"))

node_user -->|"runs"| node_main
node_main -->|"creates"| node_robot
node_main -->|"creates"| node_dead_reckoning
node_main -->|"defines indices"| node_index
node_main -->|"starts loop"| node_loop
node_robot -->|"inherits"| node_robot_base
node_loop -->|"simulates motion"| node_robot
node_loop -->|"requests estimate"| node_dead_reckoning
node_dead_reckoning -->|"reads encoders"| node_robot
node_dead_reckoning -->|"composes pose"| node_pose
node_robot -->|"composes motion"| node_pose
node_loop -->|"plots estimate"| node_robot

click node_main "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/main.py"
click node_robot "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DifferentialDriveSimulatedRobot.py"
click node_robot_base "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/SimulatedRobot.py"
click node_index "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/IndexStruct.py"
click node_loop "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/Localization.py"
click node_dead_reckoning "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DR_3DOFDifferentialDrive.py"
click node_pose "https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/Pose3D.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_index toneBlue
class node_robot,node_robot_base toneAmber
class node_loop,node_dead_reckoning,node_pose toneMint
class node_user toneIndigo
```

## Components

### Lab entry

- [Simulation setup](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/main.py): `PR_LAB1/main.py`
- [State index](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/IndexStruct.py): `PR_LAB1/IndexStruct.py`

### Robot simulation

- [Differential-drive simulator](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DifferentialDriveSimulatedRobot.py): `PR_LAB1/DifferentialDriveSimulatedRobot.py`
- [Simulator base](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/SimulatedRobot.py): `PR_LAB1/SimulatedRobot.py`

### Localization

- [Localization loop](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/Localization.py): `PR_LAB1/Localization.py`
- [Encoder odometry](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/DR_3DOFDifferentialDrive.py): `PR_LAB1/DR_3DOFDifferentialDrive.py`
- [Pose operations](https://github.com/iamhaadicool/probabilistic_robotics_lab_code/blob/lab1/PR_LAB1/Pose3D.py): `PR_LAB1/Pose3D.py`

### Other components

- **Lab runner**

## Connections

- Lab runner → Simulation setup: runs (evidence: `README.md`)
- Simulation setup → Differential-drive simulator: creates (evidence: `PR_LAB1/main.py`)
- Simulation setup → Encoder odometry: creates (evidence: `PR_LAB1/main.py`)
- Simulation setup → State index: defines indices (evidence: `PR_LAB1/main.py`)
- Simulation setup → Localization loop: starts loop (evidence: `PR_LAB1/main.py`)
- Differential-drive simulator → Simulator base: inherits (evidence: `PR_LAB1/DifferentialDriveSimulatedRobot.py`)
- Localization loop → Differential-drive simulator: simulates motion (evidence: `PR_LAB1/Localization.py`)
- Localization loop → Encoder odometry: requests estimate (evidence: `PR_LAB1/Localization.py`)
- Encoder odometry → Differential-drive simulator: reads encoders (evidence: `PR_LAB1/DR_3DOFDifferentialDrive.py`)
- Encoder odometry → Pose operations: composes pose (evidence: `PR_LAB1/DR_3DOFDifferentialDrive.py`)
- Differential-drive simulator → Pose operations: composes motion (evidence: `PR_LAB1/DifferentialDriveSimulatedRobot.py`)
- Localization loop → Differential-drive simulator: plots estimate (evidence: `PR_LAB1/Localization.py`)
