Skip to content

[TASK] Gripper MCU #27

@forrisdahl

Description

@forrisdahl

Description

Develop firmware for the Gripper MCU responsible for receiving control commands, generating PWM outputs to drive the gripper, and monitoring system health. The MCU shall interface with the main control system over CAN and respond in real time to command messages.

Note: Some existing code is available as a starting point:
[Gripper MCU firmware (PIC18F)](https://github.com/vortexntnu/vortex-auv-embedded/tree/main/gripper_17.X)


Requirements

  • CAN communication

    • Receive gripper control commands over CAN (e.g., open/close, PWM duty cycle, force control).
    • Parse frames per the gripper CAN message specification.
    • Optionally transmit status frames (e.g., current draw, position, fault status).
    • Support configurable message IDs.
  • Serial communication

    • Interface with sensors using UART, I²C, or SPI (depending on hardware).
    • Ensure correct initialization and error handling for all sensors.
    • Provide scaling and conversion for sensor data.
  • PWM control

    • Generate PWM signals to actuate the gripper motor/servo.
    • Ensure safe start-up/shutdown (no spurious pulses, defined idle state).
    • Support configurable PWM frequency and duty cycle limits.
  • Safety & fault handling

    • Implement timeout/watchdog—stop gripper actuation if no valid CAN command is received within the configured window.
    • Detect and report possible faults (overcurrent, undervoltage, communication loss, mechanical jam).
    • Provide fault-latching and clear mechanisms.
  • Modular code structure

    • Separate CAN, PWM, serial/sensor, and control logic into dedicated .c/.h modules.
    • Define clear, reusable interfaces for portability to other actuator MCUs.

Acceptance Criteria

  • Valid CAN command frames are parsed and applied; invalid or out-of-range inputs are safely ignored or clamped.
  • PWM outputs follow commanded values within defined limits (frequency, duty cycle).
  • Serial-connected sensors are initialized correctly and return valid data during operation.
  • Missing/invalid commands beyond the timeout disable actuation and trigger a fault.
  • Faults (overcurrent, undervoltage, communication loss, jam detection) are reported over CAN.
  • Optional status frames are transmitted at the specified interval with correct IDs and formatting.
  • The firmware structure separates modules cleanly and provides a documented README.

To-Do Checklist

  • Research necessary peripherals (PWM timers, CAN transceiver, UART/I²C/SPI sensors).
  • Review existing codebase for reusable drivers and architecture.
  • Select/update drivers: CAN, PWM, serial/sensor, watchdog.
  • Implement command parser, control loop, and fault manager.
  • Integrate modules into MCU firmware with configurable parameters (IDs, thresholds, PWM limits).
  • Verify functionality on development board with simulated CAN traffic and sensor emulators.
  • Validate on final PCB hardware with gripper actuator.
  • Document configuration (CAN message specs, IDs, thresholds, scaling, PWM settings) and update README.

Contacts

Metadata

Metadata

Assignees

No one assigned

    Labels

    embeddedEmbedded team responsiblemedium~ a couple days to complete

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions