Protective Stop
Loading...
Searching...
No Matches
protective_stop_machine::HardwareMachineBackend Class Reference

HTTP client to the ESP32 machn, which is itself the machine. More...

#include <hardware_backend.hpp>

Inheritance diagram for protective_stop_machine::HardwareMachineBackend:
[legend]
Collaboration diagram for protective_stop_machine::HardwareMachineBackend:
[legend]

Public Member Functions

 HardwareMachineBackend (const HardwareConfig &config)
 Copies config; no I/O until start().
bool start () override
 Begins servicing: software binds UDP and runs the machine loop, hardware starts polling.
void stop () override
 Stops servicing and leaves the machine in its SAFE state.
MachineSnapshot snapshot () const override
 Thread-safe copy of the latest state.
bool configure (const MachineTiming &timing, std::string &error) override
 Applies an already safety-validated timing change.
const char * name () const override
 Backend kind, "software" or "hardware".

Static Public Member Functions

static void parse_state (const std::string &body, MachineSnapshot &out_snapshot)
 Maps a /state.json body onto a snapshot.

Detailed Description

HTTP client to the ESP32 machn, which is itself the machine.

Polls /state.json for state and proxies runtime config to the device admin API. The ESP32 enforces STOP independently of ROS 2, so an unreachable device costs visibility only: state() reports UNSTABLE.

Member Function Documentation

◆ configure()

bool protective_stop_machine::HardwareMachineBackend::configure ( const MachineTiming & timing,
std::string & error )
overridevirtual

Applies an already safety-validated timing change.

Parameters
timingTiming to apply.
errorSet when the backend cannot honour the change.
Returns
False on an error or a refusal.

Implements protective_stop_machine::IMachineBackend.

◆ name()

const char * protective_stop_machine::HardwareMachineBackend::name ( ) const
inlineoverridevirtual

Backend kind, "software" or "hardware".

Implements protective_stop_machine::IMachineBackend.

◆ parse_state()

void protective_stop_machine::HardwareMachineBackend::parse_state ( const std::string & body,
MachineSnapshot & out_snapshot )
static

Maps a /state.json body onto a snapshot.

No HTTP, no threading. A parse error sets reachable=false. Ref: SR-M-03 / FMEA DU-9.

◆ snapshot()

MachineSnapshot protective_stop_machine::HardwareMachineBackend::snapshot ( ) const
overridevirtual

Thread-safe copy of the latest state.

Implements protective_stop_machine::IMachineBackend.

◆ start()

bool protective_stop_machine::HardwareMachineBackend::start ( )
overridevirtual

Begins servicing: software binds UDP and runs the machine loop, hardware starts polling.

Returns
False on a fatal setup error.

Implements protective_stop_machine::IMachineBackend.

◆ stop()

void protective_stop_machine::HardwareMachineBackend::stop ( )
overridevirtual

Stops servicing and leaves the machine in its SAFE state.

Software stops the loop so remotes fail-safe; hardware stops polling while the ESP32 keeps enforcing. Idempotent.

Implements protective_stop_machine::IMachineBackend.


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