Smart Camera ESP32
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
Controller Class Reference

Handles logic for object detection and movement calculations. More...

#include <controller.h>

Public Member Functions

Lifecycle Management
 Controller (BaseMovementManager &movement_manager, BaseDetectionModule &detection_module, Joystick &joystick, Camera &camera)
 Construct a new Controller object.
 
 ~Controller ()
 Destroy the Controller object.
 
Core Execution
void run ()
 Main processing cycle for the turret system.
 
const std::tuple< MoveX, MoveYuser_mode () const
 

Detailed Description

Handles logic for object detection and movement calculations.

The Controller implements a State-Driven architecture. It acts as the bridge between the Computer Vision pipeline and the physical servos.

  • Control Arbitration Logic:
  • AI_MODE: The controller requests a frame from the Camera, passes it to the BaseDetectionModule, and calculates the error vector to center the target.
  • USER_MODE: The controller bypasses the CV pipeline and maps Joystick input directly to the BaseMovementManager.

Constructor & Destructor Documentation

◆ Controller()

Controller::Controller ( BaseMovementManager & movement_manager,
BaseDetectionModule & detection_module,
Joystick & joystick,
Camera & camera )
inline

Construct a new Controller object.

Parameters
movement_managerReference to the movement implementation.
detection_moduleReference to the detection implementation.
joystickReference to the Joystick input handler.
cameraReference to the Camera object.
Note
Defaults to AI_MODE upon initialization.

◆ ~Controller()

Controller::~Controller ( )
inline

Destroy the Controller object.

Ensures the turret is safely parked and motor signals are neutralized.

Member Function Documentation

◆ run()

void Controller::run ( )

Main processing cycle for the turret system.

This method should be called inside the primary loop() of the application.

  • Workflow:
  1. Check current SystemControl state.
  2. If USER_MODE:
  • Poll _joystick for X/Y offsets.
  • Call _movement_manager.move().
  1. If AI_MODE:
  • Capture frame from _camera.
  • Perform inference via _detection_module.
  • Translate target coordinates to motor pulses.
  • Warning
    This function is blocking relative to the frame-rate of the camera.

THIS is my problem and I need to find a way to solve it, too tired though :X


The documentation for this class was generated from the following files: