Operating modes - SergeGit/rc-tank-platform GitHub Wiki

Diagrams

3. Functional control

3.1 Commands

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart LR
 subgraph s1["Hull Controller"]
        I2CS["I2C Slave Interface"]
        CONTROL["Controller"]
        TURRET["Turret Control"]
        WEAPON["Weapon Systems"]
        AIM["Aim control"]
        MOTOR["Track Control"]
        LIGHTS["Light Control"]
  end
 subgraph s2["Physical Systems"]
        TRACKS["Track Motors (2x)"]
        TROT["Turret Rotation Motor"]
        TELEV["Turret Elevation Motor"]
        FRONTL["Front Lights"]
        BACKL["Rear Lights"]
        TURTL["Turret Light"]
        LASER["Laser"]
        IR["IR Light"]
        CANNON["Cannon"]
  end
 subgraph s3["Turret Controller"]
        I2CM["I2C Master interface"]
  end
    I2CM -- I2C Bus --> I2CS
    I2CS --> CONTROL
    CONTROL ---> TURRET & LIGHTS & MOTOR & WEAPON
    MOTOR -- PWM ---> TRACKS
    TURRET -- PWM --> TROT & TELEV
    LIGHTS -- 1/0 --> FRONTL & BACKL & TURTL
    WEAPON --> AIM
    WEAPON -- 1/0 --> CANNON
    AIM -- 1/0 --> LASER & IR
Loading

3.2 Measurements

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart RL
 subgraph s1["User Interface"]
        UI["User Interface"]
  end
 subgraph s2["Turret Controller"]
        FBPROC["Feedback Processing"]
        I2CM["I2C Master Interface"]
  end
 subgraph s3["Hull Controller"]
        I2CS["I2C Slave Interface"]
        SENSORS["Battery Supervision"]
        n4["Main program"]
        n5["Position Estimation"]
        n6["Cannon feedback"]
  end
 subgraph s4["Physical systems"]
        n1["Main battery"]
        n2["Hull rotation"]
        n3["Cannon feedback"]
  end
    SENSORS -- Processed data --> n4
    I2CS -- I2C bus --> I2CM
    I2CM -- Processed data (DTO) --> FBPROC
    FBPROC -- Visualisation --> UI
    n1 -- Voltage --> SENSORS
    n2 -- 1/0 --> n5
    n3 -- 1/0 --> n6
    n4 -- Measurements (DTO) --> I2CS
    n5 -- Processed data --> n4
    n6 -- Processed data --> n4
Loading

3.3 Telemetry

4. Operating Modes

4.1 Local / Remote Control Mode

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart TD
 subgraph s0["Local"]
        PS3["PS3 Controller"]
  end
 subgraph s1["Remote"]
        REM["Web Interface"]
  end
 subgraph s2["Turret Controller"]
        BT["Bluetooth Receiver"]
        UIP["User Input Processing"]
        CMD["Command Generator"]
        I2CM["I2C Master Interface"]
        WEB["Webserver"]
  end
 subgraph s3["Hull Controller"]
        I2CS["I2C Slave Interface"]
  end

    PS3 -- Bluetooth Commands --> BT
    BT -- Mapping --> UIP
    UIP -- Processed Commands --> CMD
    CMD -- Command Packets --> I2CM
    I2CM <-- I2C Bus --> I2CS
    REM -- TCP/IP --> WEB
    WEB -- Mapping --> UIP
Loading

Local Control Mode Key Features:

  • Direct 1:1 mapping between PS3 controller inputs and tank actions
  • Low latency response for precise control
  • All systems manually operated by the user
  • Real-time feedback through controller and visual observation

Remote Control Mode Key Features:

  • Control via web interface from any networked device
  • Video feed provides visual feedback
  • Telemetry data displayed on web interface
  • Potentially higher latency than local control
  • Same manual control capabilities as Local Mode, different interface

4.3 Semi-Automatic Mode

4.3.1 Auto-Aim Submode

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart TD
  %% Subgraph: Local Input
  subgraph s0["Local"]
      PS3["PS3 Controller"]
  end

  %% Subgraph: Remote Input
  subgraph s1["Remote"]
      n1["Web Interface"]
  end

  %% Subgraph: Turret Controller
  subgraph s2["Turret Controller"]
      BT["Bluetooth Receiver"]
      UIP["User Input Processing"]
      CV["Computer Vision System<br/>(Target Detection & Tracking)"]
      AA["Auto-Aim Processor<br/>(Semi-Automatic Aim)"]
      CMD["Command Generator"]
      I2CM["I2C Master Interface"]
      WEB["Webserver"]
      F["Firing Control<br/>(Manual Decision)"]
  end

  %% Subgraph: Hull Controller
  subgraph s3["Hull Controller"]
      I2CS["I2C Slave Interface"]
  end

  %% Data Flow Connections for Local and Remote Inputs
  PS3 -- "Bluetooth Commands" --> BT
  BT -- "Mapping" --> UIP
  n1 -- "TCP/IP" --> WEB
  WEB -- "Mapping" --> UIP
  
  %% Inserting Computer Vision into the Flow
  %% The CV system runs continuously to detect and track targets
  CV -- "Target Data" --> AA

  %% Integrating Manual and Auto-Aim Inputs
  %% Processed commands from UIP are passed for auto-aim correction when engaged
  UIP -- "Semi-Auto Commands" --> AA
  AA -- "Aimed Commands" --> CMD
  
  %% Firing remains under manual control
  CMD -- "Prepare Fire Command" --> F
  
  %% Output to Hull Controller
  F -- "User-Approved Command Packets" --> I2CM
  I2CM <-- "I2C Bus Communication" --> I2CS
Loading

Auto-Aim Submode Key Features:

  • Tank movement under manual control
  • Computer vision system automatically tracks detected targets
  • Turret automatically aims at tracked target
  • Firing remains under manual control for safety
  • Combines human decision-making with automated precision

Auto-Aim Processor (AA): This module now receives two inputs:

  • From UIP: Semi-processed commands entered by the user, such as directional or positioning commands.
  • From the CV system: Target data that allows auto-correction of the turret aim. By fusing these inputs, the AA refines the commands to adjust the turret automatically toward the tracked target, while still incorporating the user’s intent.

4.3.2 Auto-Firing Submode

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart TD
  %% Subgraph: Local Input (Manual Movement remains separate)
  subgraph s0["Local"]
      PS3["PS3 Controller"]
  end

  %% Subgraph: Remote Input
  subgraph s1["Remote"]
      n1["Web Interface"]
  end

  %% Subgraph: Turret Controller
  subgraph s2["Turret Controller"]
      BT["Bluetooth Receiver"]
      UIP["User Input Processing"]
      CV["Computer Vision System<br/>(Detect & Classify Targets)"]
      AA["Auto-Aim Processor"]
      FDL["Fire Decision Logic<br/>(Confirmation & Safety Checks)"]
      SO["Safety Override<br/>(Operator Control)"]
      CMD["Command Generator"]
      I2CM["I2C Master Interface"]
      WEB["Webserver"]
  end

  %% Subgraph: Hull Controller
  subgraph s3["Hull Controller"]
      I2CS["I2C Slave Interface"]
  end

  %% Data Flow for Local and Remote Inputs:
  PS3 -- "Bluetooth Commands" --> BT
  BT -- "Mapping" --> UIP
  n1 -- "TCP/IP Commands" --> WEB
  WEB -- "Mapping" --> UIP

  %% Auto-Firing Process Flow:
  %% The computer vision system continuously scans for targets and sends target data.
  CV -- "Target Data" --> AA
  
  %% The UIP forwards processed commands from manual and remote inputs.
  UIP -- "Processed Commands" --> AA
  
  %% Auto-aim integrates both user intent and target data.
  AA -- "Aimed Commands" --> FDL
  
  %% Fire Decision Logic verifies targets and checks safety protocols.
  FDL -- "Fire Command (if confirmed)" --> SO
  
  %% The Safety Override allows operator intervention, canceling or approving the fire command.
  SO -- "Approved Fire Command" --> CMD
  
  %% Command packets are sent to the hull controller for execution.
  CMD -- "Command Packets" --> I2CM
  I2CM <-- "I2C Bus Communication" --> I2CS
Loading

Auto-Firing Submode Key Features:

  • Tank movement under manual control
  • Computer vision identifies and classifies potential targets
  • System automatically aims and fires at confirmed targets
  • Human operator maintains override/safety control
  • Fire decision logic includes confirmation and safety checks

4.4 Automatic Mode

---
config:
  theme: base
  look: neo
  layout: dagre
---
flowchart TD
 subgraph s1["Remote"]
        n1["Web Interface"]
  end
 subgraph s2["Turret Control & Engagement"]
        CV["Targeting Tracking<br>(Computer Vision)"]
        AA["Auto-Aim Processor"]
        FDL["Fire Decision Logic<br>(Confirmation &amp; Safety Checks)"]
        SO["Safety Override<br>(Operator Control)"]
  end
 subgraph s3["Hull Controller"]
        I2CS["I2C Slave Interface"]
  end
 subgraph s4["Sensors"]
        GPS["GPS"]
  end
 subgraph s5["Autonomous Navigation"]
        NAV["Navigation Controller"]
        OA["Obstacle Avoidance System<br>(Computer Vision)"]
        MP["Mission Planner"]
  end
 subgraph s6["User Input"]
        WEB["Webserver"]
        UIP["User Input Processing"]
  end
 subgraph s7["Turret Controller"]
        CMD["Command Generator"]
        I2CM["I2C Master Interface"]
  end
    n1 -- TCP/IP Commands --> WEB
    WEB -- Mapping --> UIP
    CV -- Detect &amp;<br> Classify Targets --> AA
    UIP -- Processed Commands --> AA
    AA -- Aimed Commands --> FDL
    FDL -- Fire Command (if confirmed) --> SO
    SO -- Approved Fire Command --> CMD
    CMD -- Turret Command Packets --> I2CM
    I2CM <-- I2C Bus Communication --> I2CS
    UIP -- Setpoint --> MP
    GPS -- Coordinates --> MP
    MP -- Waypoint --> NAV
    OA -- Track movement --> CMD
    NAV --> OA
    OA -- Obstacle data &amp;<br> Avoidance --> NAV

Loading

Automatic Mode Key Features:

  • Fully autonomous operation with minimal human intervention
  • Mission defined by GPS coordinates and parameters
  • Real-time obstacle detection and avoidance
  • Autonomous target identification, tracking, and engagement
  • Decision-making hierarchy for conflict resolution
  • Emergency override capability for safety

4.5 Deep Sleep Mode

flowchart TD
    subgraph "Turret Controller (Raspberry Pi)"
        SLEEP[Power Management]
        TIMER[Wake Timer]
        CHECK[Command Check]
        WAKE[Wake-up Logic]
        I2CM[I2C Master Interface]
    end
    
    subgraph "Hull Controller (Arduino)"
        I2CS[I2C Sleep Slave]
        LOWPWR[Low Power Mode]
        SENSOR[Essential Sensors]
    end
    
    subgraph "External Triggers"
        REMOTE[Remote Wake Command]
        MOTION[Motion Detection]
        SCHEDULE[Scheduled Wake]
    end
    
    subgraph "Physical Systems"
        BATT[Battery]
    end
    
    SLEEP -->|Power Down| I2CM
    I2CM -->|Sleep Command| I2CS
    I2CS --> LOWPWR
    LOWPWR -->|Minimal Power| SENSOR
    LOWPWR -->|Power Conservation| BATT
    
    TIMER -->|Periodic Wake| SLEEP
    SLEEP -->|Temporary Wake| CHECK
    CHECK -->|No Commands| SLEEP
    
    REMOTE -->|Wake Signal| WAKE
    MOTION -->|Movement Detected| SENSOR
    SENSOR -->|Wake Trigger| I2CS
    I2CS -->|Wake Notification| I2CM
    I2CM -->|Alert| WAKE
    SCHEDULE -->|Time Reached| TIMER
    TIMER -->|Scheduled Wake| WAKE
    
    WAKE -->|Full Power Up| I2CM
    I2CM -->|Wake Command| I2CS
    I2CS -->|System Restoration| LOWPWR
Loading

Deep Sleep Mode Key Features:

  • Minimal power consumption for extended battery life
  • Periodic wake cycles to check for commands
  • Multiple wake trigger mechanisms:
    • Remote wake command
    • Motion detection
    • Scheduled wake times
  • Fast transition to operational mode when required
  • Only essential systems remain active

4.6 Mode Transition Diagram

---
config:
  theme: neo
  look: neo
  layout: dagre
---
stateDiagram
  direction TB
  state Manual {
    direction TB
    [*] --> RemoteControl
    RemoteControl --> LocalControl:Request Local
    LocalControl --> RemoteControl:Request Remote
[*]    RemoteControl
    LocalControl
  }
  state SemiAuto {
    direction TB
    [*] --> SemiAutoAim
    SemiAutoAim --> SemiAutoFire:Enable Auto-Fire
    SemiAutoFire --> SemiAutoAim:Disable Auto-Fire
[*]    SemiAutoAim
    SemiAutoFire
  }
  state Auto {
    direction TB
    AutomaticMode
  }
  [*] --> Manual:Initialization
  Manual --> SemiAuto:Enable SemiAuto
  SemiAuto --> Manual:Disable SemiAuto
  Manual --> Auto:Enable Auto
  Auto --> Manual:Disable Auto

Loading

4.7 Control Command Flow Table

Operating Mode Movement Control Turret Control Firing Control Light Control
Local Control Manual (PS3) Manual (PS3) Manual (PS3) Manual (PS3)
Remote Control Manual (Web) Manual (Web) Manual (Web) Manual (Web)
Semi-Auto (Aim) Manual (PS3/Web) Automatic Manual (PS3/Web) Manual (PS3/Web)
Semi-Auto (Fire) Manual (PS3/Web) Automatic Automatic Manual (PS3/Web)
Automatic Autonomous Autonomous Autonomous Autonomous
Deep Sleep Disabled Disabled Disabled Disabled
⚠️ **GitHub.com Fallback** ⚠️