Class GPIOController

Inheritance Relationships

Base Type

Class Documentation

class GPIOController : public husarion_ugv_hardware_interfaces::GPIOControllerInterface

Public Functions

GPIOController(std::shared_ptr<GPIODriverInterface> gpio_driver)

Constructor for GPIOController class.

Parameters:

gpio_driver – Pointer to the GPIODriver object.

Throws:

<tt>std::runtime_error</tt> – When the GPIO driver is not initialized.

virtual void Start() override

Initializes the GPIODriver, Watchdog, and powers on the motors.

virtual void EStopTrigger() override

Disables the Watchdog thread for E-stop mechanism trigger.

Throws:

std::runtime_error – when the Watchdog thread fails to stop.

Returns:

true if the Watchdog thread is successfully disabled.

virtual void EStopReset() override

Resets the E-stop.

This method verifies the status of the E_STOP_RESET pin, which is configured as an input. If the pin is active, it attempts to reset the E-stop by momentarily setting it to an inactive state. During this reset process, the pin is configured as an output for a specific duration. If the attempt to reset the E-stop fails (the pin reads its value as an input again), it throws a runtime error. The Watchdog thread is temporarily activated during the E-stop reset process.

Throws:

std::runtime_error – when the E-stop reset fails.

Returns:

true if the E-stop is successfully reset.

virtual bool MotorPowerEnable(const bool enable) override

Controls the motor power by enabling or disabling them based on the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable the motors, ‘false’ to disable.

Returns:

‘true’ if the motor control pin value is successfully set, ‘false’ otherwise.

virtual bool FanEnable(const bool enable) override

Controls the fan based on the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable the fan, ‘false’ to disable.

Returns:

‘true’ if the fan control pin value is successfully set, ‘false’ otherwise.

virtual bool AUXPowerEnable(const bool enable) override

Controls AUX power source based on the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable the AUX power, ‘false’ to disable.

Returns:

‘true’ if the AUX control pin value is successfully set, ‘false’ otherwise.

virtual bool DigitalPowerEnable(const bool enable) override

Controls the digital power source based on the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable the VDIG, ‘false’ to disable.

Returns:

‘true’ if the VDIG control pin value is successfully set, ‘false’ otherwise.

virtual bool ChargerEnable(const bool enable) override

Enables or disables the use of an external charger according to the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable external charger, ‘false’ to disable.

Returns:

‘true’ if the charger control pin value is successfully set, ‘false’ otherwise.

virtual bool LEDControlEnable(const bool enable) override

Enables or disables the LED control based on the ‘enable’ parameter.

Parameters:

enable – Set to ‘true’ to enable the LED control, ‘false’ to disable.

Returns:

‘true’ if the LED control pin value is successfully set, ‘false’ otherwise.

virtual std::unordered_map<GPIOPin, bool> QueryControlInterfaceIOStates() const override

Queries the current IO states of the control interface.

Returns:

An unordered map containing the GPIOPin as the key and its active state as the value.

virtual void InterruptEStopReset() override

Public Static Functions

static const std::vector<GPIOInfo> &GetGPIOConfigInfoStorage()

Returns the GPIO pin configuration information for the PTH12X.

Protected Attributes

std::unique_ptr<Watchdog> watchdog_