# ieee-sb-uniwa/lidar-cane architecture

> Architecture diagram of the GitHub repository ieee-sb-uniwa/lidar-cane, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ieee-sb-uniwa/lidar-cane
- Repository: https://github.com/ieee-sb-uniwa/lidar-cane

## Overview

#### Purpose and Scope
Kana Fotilo is an IEEE UNIWA assistive smart cane intended to help users with limited vision navigate autonomously. Its intended loop is environmental sensing, obstacle analysis, safe-direction selection, physical cane steering, and audible feedback. The repository primarily contains a Raspberry Pi prototype, a small educational sensor example, mechanical assets, and a deprecated simulator.

#### Primary Hardware Runtime
The active implementation appears to be the Raspberry Pi communication/control script at `raspberry pi/comms.py`. This is the likely device-side entry point coordinating attached sensors and actuators. The target hardware includes ranging sensors (ultrasound/LIDAR/ToF), a servo, buzzer/speaker, and planned IMU/GPS integration.

#### Perception and Obstacle Data
The design scans the surrounding area by sectors, storing distance readings in an array for subsequent analysis. An educational ultrasonic-sensing implementation is present at `educational/ultrasound.py`; it likely serves as an isolated prototype/reference for the ranging stage rather than the complete application. Sensor readings form the boundary between physical-world inputs and navigation decisions.

#### Guidance and User Feedback
After interpreting scan data, the system chooses a safe direction when an obstacle is detected. That decision should drive:
- Servo output: mechanically points/steers the cane toward a selected course.
- Buzzer/speaker output: warns or guides the user audibly.

These actuator responsibilities are expected to converge in `raspberry pi/comms.py`, keeping hardware-specific I/O separate from sensor interpretation and direction-selection policy.

#### Navigation Extension Boundary
The README identifies IMU and GPS for outdoor guidance and an application that configures destinations through OpenStreetMap API. No corresponding application, mapping client, or GPS/IMU implementation is present in the tree. Treat external routing/mapping as planned integration rather than an implemented runtime dependency.

#### Simulation and Validation Prototype
`simulator_deprecated/` is an explicitly deprecated Godot/.NET 3D simulation project, not the current production path. Its simulator entry scene and orchestration are represented by:
- `simulator_deprecated/project.godot`
- `simulator_deprecated/main.tscn`
- `simulator_deprecated/main.gd`

Raycasting and obstacle-world behavior are modeled in `simulator_deprecated/RayCast3d.cs`, `simulator_deprecated/ray_cast_3d.gd`, and `simulator_deprecated/boxes.gd`. It provides historical validation of sensing/navigation concepts but should not be coupled to Raspberry Pi deployment.

#### Physical and Presentation Assets
The cane’s mechanical model is available as `assets/kane.stl`, with a Blender source model at `new_cane.blend`. Project communication artifacts are separate from runtime code, notably `presentations/index.html` and `presentations/ieee day presentation.pptx`.

Main entry points: [`raspberry pi/comms.py`](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/raspberry%20pi/comms.py) (Device controller), [`simulator_deprecated/main.tscn`](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.tscn) (Simulator main scene), [`simulator_deprecated/main.gd`](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.gd) (Simulator orchestration), [`simulator_deprecated/RayCast3d.cs`](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/RayCast3d.cs) (Raycast sensing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Raspberry Pi Runtime"]
  node_comms["Device controller<br/>Python runtime<br/>[comms.py]"]
  node_ranging{{"Ranging sensors<br/>hardware input"}}
  node_scan[("Sector scan data<br/>distance array")]
  node_obstacle["Obstacle analysis<br/>navigation policy"]
  node_safe_direction(("Safe direction<br/>guidance decision"))
  node_servo{{"Servo steering<br/>actuator"}}
  node_audio{{"Buzzer / speaker<br/>actuator"}}
  node_ultrasound_example["Ultrasonic example<br/>educational prototype<br/>[ultrasound.py]"]
  node_imu_gps{{"IMU / GPS<br/>planned hardware"}}
  node_routing["Mapping &amp; destinations<br/>planned integration"]
end

subgraph group_simulator["Deprecated Simulator"]
  node_godot_project["Godot project config<br/>simulator configuration<br/>[project.godot]"]
  node_sim_scene["Simulator main scene<br/>Godot scene<br/>[main.tscn]"]
  node_sim_orchestrator["Simulator orchestration<br/>Godot script<br/>[main.gd]"]
  node_sim_raycast["Raycast sensing<br/>simulation sensing<br/>[RayCast3d.cs]"]
  node_sim_world["Obstacle world<br/>simulation environment<br/>[boxes.gd]"]
end

subgraph group_assets["Physical &amp; Project Assets"]
  node_cane_model["Cane mechanical model<br/>STL asset<br/>[kane.stl]"]
  node_blender_model["Cane source model<br/>Blender asset<br/>[new_cane.blend]"]
  node_presentation["Project presentation<br/>communication artifact<br/>[index.html]"]
end

node_ranging -->|"reads"| node_comms
node_comms -->|"stores sectors"| node_scan
node_scan -->|"analyzes"| node_obstacle
node_obstacle -->|"selects"| node_safe_direction
node_safe_direction -->|"returns course"| node_comms
node_comms -->|"drives"| node_servo
node_comms -->|"signals"| node_audio
node_ultrasound_example -.->|"references"| node_ranging
node_imu_gps -.->|"future position input"| node_routing
node_routing -.->|"future destination guidance"| node_safe_direction
node_godot_project -->|"loads"| node_sim_scene
node_sim_scene -->|"runs"| node_sim_orchestrator
node_sim_orchestrator -->|"uses"| node_sim_raycast
node_sim_world -->|"intersects"| node_sim_raycast
node_blender_model -.->|"source for"| node_cane_model

click node_comms "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/raspberry%20pi/comms.py"
click node_ultrasound_example "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/educational/ultrasound.py"
click node_godot_project "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/project.godot"
click node_sim_scene "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.tscn"
click node_sim_orchestrator "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.gd"
click node_sim_raycast "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/RayCast3d.cs"
click node_sim_world "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/boxes.gd"
click node_cane_model "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/assets/kane.stl"
click node_blender_model "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/new_cane.blend"
click node_presentation "https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/presentations/index.html"

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_comms,node_ranging,node_scan,node_obstacle,node_safe_direction,node_servo,node_audio,node_ultrasound_example,node_imu_gps,node_routing toneBlue
class node_godot_project,node_sim_scene,node_sim_orchestrator,node_sim_raycast,node_sim_world toneAmber
class node_cane_model,node_blender_model,node_presentation toneMint
```

## Components

### Raspberry Pi Runtime

Active smart-cane control path.

- [Device controller](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/raspberry%20pi/comms.py): Python runtime · Coordinates scanning, guidance, and hardware outputs. · `raspberry pi/comms.py`
- **Ranging sensors**: hardware input · Ultrasound, LIDAR, or ToF distance sources.
- **Sector scan data**: distance array · Sector readings retained for obstacle analysis.
- **Obstacle analysis**: navigation policy
- **Safe direction**: guidance decision
- **Servo steering**: actuator · Physically points the cane toward the selected course.
- **Buzzer / speaker**: actuator · Delivers obstacle warnings and guidance.
- [Ultrasonic example](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/educational/ultrasound.py): educational prototype · Isolated reference implementation for ranging. · `educational/ultrasound.py`
- **IMU / GPS**: planned hardware · Planned outdoor-positioning integration.
- **Mapping & destinations**: planned integration · Future application and OpenStreetMap routing boundary.

### Deprecated Simulator

Historical Godot validation prototype.

- [Godot project config](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/project.godot): simulator configuration · `simulator_deprecated/project.godot`
- [Simulator main scene](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.tscn): Godot scene · `simulator_deprecated/main.tscn`
- [Simulator orchestration](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/main.gd): Godot script · `simulator_deprecated/main.gd`
- [Raycast sensing](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/RayCast3d.cs): simulation sensing · Models obstacle-distance sensing. · `simulator_deprecated/RayCast3d.cs`
- [Obstacle world](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/simulator_deprecated/boxes.gd): simulation environment · `simulator_deprecated/boxes.gd`

### Physical & Project Assets

- [Cane mechanical model](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/assets/kane.stl): STL asset · `assets/kane.stl`
- [Cane source model](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/new_cane.blend): Blender asset · `new_cane.blend`
- [Project presentation](https://github.com/ieee-sb-uniwa/lidar-cane/blob/main/presentations/index.html): communication artifact · `presentations/index.html`

## Connections

- Ranging sensors → Device controller: reads
- Device controller → Sector scan data: stores sectors
- Sector scan data → Obstacle analysis: analyzes
- Obstacle analysis → Safe direction: selects
- Safe direction → Device controller: returns course
- Device controller → Servo steering: drives
- Device controller → Buzzer / speaker: signals
- Ultrasonic example → Ranging sensors: references
- IMU / GPS → Mapping & destinations: future position input
- Mapping & destinations → Safe direction: future destination guidance
- Godot project config → Simulator main scene: loads
- Simulator main scene → Simulator orchestration: runs
- Simulator orchestration → Raycast sensing: uses
- Obstacle world → Raycast sensing: intersects
- Cane source model → Cane mechanical model: source for
