# ethanjoyner/cornholerobotsoftware architecture

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

- Interactive diagram: https://gitdiagram.com/ethanjoyner/cornholerobotsoftware
- Repository: https://github.com/ethanjoyner/cornholerobotsoftware

## Overview

CornHoleRobotSoftware is a browser-based control system for CHR robots: operators use controller and sequence pages, a Flask-Socket.IO server exchanges commands and telemetry with an Arduino over serial, and robot firmware drives actuators and gathers sensor readings. The README describes the robots as using call-and-response. The Python and browser excerpts show the server and manual-control exchange; Arduino firmware and several browser modules were not sampled, so firmware connections and some feature wiring remain unverified.

Main entry points: [`AudrinoCode/CHR-RobotCode/CHR-RobotCode.ino`](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/CHR-RobotCode.ino) (Robot controller), [`chr.py`](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/chr.py) (Flask server), [`socketio3-0-4.js`](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/socketio3-0-4.js) (Socket.IO client), [`static/js/seqSensorController.js`](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seqSensorController.js) (Sensor controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Operator Web UI"]
  node_control_page["Manual control<br/>[ctrl.js]"]
  node_legacy_control["Legacy control<br/>[OLDctrl.js]"]
  node_sensor_control["Sensor controller"]
  node_sequence_editor["Sequence editor<br/>[seq.js]"]
  node_sequence_sensor["Sequence sensors"]
  node_web_pages["Robot pages"]
  node_socket_client["Socket.IO client<br/>[socketio3-0-4.js]"]
end

subgraph group_server["Control Server"]
  node_server["Flask server<br/>[chr.py]"]
  node_serial_link["Serial interface<br/>[chr.py]"]
end

subgraph group_firmware["Robot Firmware"]
  node_robot_firmware["Robot controller<br/>[CHR-RobotCode.ino]"]
  node_motor_control["Motor control<br/>[motor.ino]"]
  node_arm_control["Arm control<br/>[arm.ino]"]
  node_pressure_system["Pressure system<br/>[pnuSys.ino]"]
  node_sequence_runtime["Sequence runtime<br/>[sequence.ino]"]
  node_sensor_acquisition["Sensor acquisition<br/>[aquireSensors.ino]"]
  node_gyro["Gyroscope readings<br/>[gryo.ino]"]
  node_teleoperation["Teleoperation<br/>[teleop.ino]"]
end

subgraph group_hardware["Robot Hardware"]
  node_robot_hardware{{"Robot electronics"}}
end

node_operator(("Robot operator"))

node_operator -->|"opens pages"| node_web_pages
node_web_pages -->|"requests pages"| node_server
node_control_page -.->|"uses client"| node_socket_client
node_legacy_control -.->|"uses client"| node_socket_client
node_sensor_control -->|"uses client"| node_socket_client
node_sequence_editor -.->|"sends commands"| node_server
node_server -->|"handles serial"| node_serial_link
node_serial_link -.->|"exchanges commands"| node_robot_firmware
node_robot_firmware -.->|"dispatches"| node_motor_control
node_robot_firmware -.->|"dispatches"| node_arm_control
node_robot_firmware -.->|"dispatches"| node_pressure_system
node_robot_firmware -.->|"dispatches"| node_sequence_runtime
node_robot_firmware -.->|"dispatches"| node_sensor_acquisition
node_robot_firmware -.->|"dispatches"| node_gyro
node_robot_firmware -.->|"dispatches"| node_teleoperation
node_motor_control -.->|"actuates"| node_robot_hardware
node_arm_control -.->|"actuates"| node_robot_hardware
node_pressure_system -.->|"controls"| node_robot_hardware
node_sensor_acquisition -.->|"reads sensors"| node_robot_hardware
node_serial_link -->|"returns telemetry"| node_server
node_server -->|"sends telemetry"| node_sensor_control

click node_control_page "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/ctrl.js"
click node_legacy_control "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/OLDctrl.js"
click node_sensor_control "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seqSensorController.js"
click node_sequence_editor "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seq.js"
click node_sequence_sensor "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seqSensorController.js"
click node_web_pages "https://github.com/ethanjoyner/cornholerobotsoftware/tree/main/templates"
click node_socket_client "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/socketio3-0-4.js"
click node_server "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/chr.py"
click node_serial_link "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/chr.py"
click node_robot_firmware "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/CHR-RobotCode.ino"
click node_motor_control "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/motor.ino"
click node_arm_control "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/arm.ino"
click node_pressure_system "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/pnuSys.ino"
click node_sequence_runtime "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/sequence.ino"
click node_sensor_acquisition "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/aquireSensors.ino"
click node_gyro "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/gryo.ino"
click node_teleoperation "https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/teleop.ino"

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_control_page,node_legacy_control,node_sensor_control,node_sequence_editor,node_sequence_sensor,node_web_pages,node_socket_client toneBlue
class node_server,node_serial_link toneAmber
class node_robot_firmware,node_motor_control,node_arm_control,node_pressure_system,node_sequence_runtime,node_sensor_acquisition,node_gyro,node_teleoperation toneMint
class node_robot_hardware toneRose
class node_operator toneIndigo
```

## Components

### Operator Web UI

- [Manual control](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/ctrl.js): `static/js/ctrl.js`
- [Legacy control](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/OLDctrl.js): `static/js/OLDctrl.js`
- [Sensor controller](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seqSensorController.js): `static/js/seqSensorController.js`
- [Sequence editor](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seq.js): `static/js/seq.js`
- [Sequence sensors](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/static/js/seqSensorController.js): `static/js/seqSensorController.js`
- [Robot pages](https://github.com/ethanjoyner/cornholerobotsoftware/tree/main/templates): `templates`
- [Socket.IO client](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/socketio3-0-4.js): `socketio3-0-4.js`

### Control Server

- [Flask server](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/chr.py): `chr.py`
- [Serial interface](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/chr.py): `chr.py`

### Robot Firmware

- [Robot controller](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/CHR-RobotCode.ino): `AudrinoCode/CHR-RobotCode/CHR-RobotCode.ino`
- [Motor control](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/motor.ino): `AudrinoCode/CHR-RobotCode/motor.ino`
- [Arm control](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/arm.ino): `AudrinoCode/CHR-RobotCode/arm.ino`
- [Pressure system](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/pnuSys.ino): `AudrinoCode/CHR-RobotCode/pnuSys.ino`
- [Sequence runtime](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/sequence.ino): `AudrinoCode/CHR-RobotCode/sequence.ino`
- [Sensor acquisition](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/aquireSensors.ino): `AudrinoCode/CHR-RobotCode/aquireSensors.ino`
- [Gyroscope readings](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/gryo.ino): `AudrinoCode/CHR-RobotCode/gryo.ino`
- [Teleoperation](https://github.com/ethanjoyner/cornholerobotsoftware/blob/main/AudrinoCode/CHR-RobotCode/teleop.ino): `AudrinoCode/CHR-RobotCode/teleop.ino`

### Robot Hardware

- **Robot electronics**

### Other components

- **Robot operator**

## Connections

- Robot operator → Robot pages: opens pages
- Robot pages → Flask server: requests pages (evidence: `chr.py`)
- Manual control → Socket.IO client: uses client
- Legacy control → Socket.IO client: uses client
- Sensor controller → Socket.IO client: uses client (evidence: `static/js/seqSensorController.js`)
- Sequence editor → Flask server: sends commands
- Flask server → Serial interface: handles serial (evidence: `chr.py`)
- Serial interface → Robot controller: exchanges commands
- Robot controller → Motor control: dispatches
- Robot controller → Arm control: dispatches
- Robot controller → Pressure system: dispatches
- Robot controller → Sequence runtime: dispatches
- Robot controller → Sensor acquisition: dispatches
- Robot controller → Gyroscope readings: dispatches
- Robot controller → Teleoperation: dispatches
- Motor control → Robot electronics: actuates
- Arm control → Robot electronics: actuates
- Pressure system → Robot electronics: controls
- Sensor acquisition → Robot electronics: reads sensors
- Serial interface → Flask server: returns telemetry (evidence: `chr.py`)
- Flask server → Sensor controller: sends telemetry (evidence: `static/js/seqSensorController.js`)
