Skip to content

PID Class Implementation #16

@samuelnguyen999

Description

@samuelnguyen999

The PID class provides a wrapper around the Arduino PID_v1 library. This issue outlines the work needed to complete functionality, improve maintainability, and ensure correct behavior across the device.

Goals

  • Fully validate and refine PID functionality provided by PID_TC.
  • Ensure proper handling of tunings, modes, and computation flow.
  • Confirm compatibility with the Arduino PID_v1 library and target MCU constraints (e.g., 4-byte double on Mega2560).
  • Review singleton implementation details for correctness and safety.

Reference: PID_TC Public Operations

computeOutput()
getKd()
getKi()
getKp()
getMode()
logToSerial()
setKd()
setKi()
setKp()
setTunings()

Singleton lifecycle:

instance()
reset()

Internal/Private Components for Review

  • Constructor / destructor correctness
  • input, output, and set_point variable handling
  • PID window size management (WINDOW_SIZE)
  • Proper initialization and ownership of the PID* pPID instance
  • Type limitations on AVR (double being 4 bytes) and impact on tuning precision

Additional Items for Refinement

  • Ensure computeOutput() correctly updates input, set_point, and output before/after PID calculation
  • Validate PID mode transitions (Automatic vs. Manual)
  • Evaluate logging strategy in logToSerial()
  • Confirm singleton memory handling and test behavior (reset() vs. destructor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions