11#include "protective_stop_machine/backend.hpp"
13namespace protective_stop_machine
47 const char *
name()
const override
61 bool http_get(
const std::string & path, std::string & body,
long & status);
63 bool http_post(
const std::string & path,
const std::string & json, std::string & body,
long & status);
66 std::thread poll_thread_;
67 std::atomic<bool> running_{
false};
68 mutable std::mutex snapshot_mutex_;
HardwareMachineBackend(const HardwareConfig &config)
Copies config; no I/O until start().
const char * name() const override
Backend kind, "software" or "hardware".
Definition hardware_backend.hpp:47
void stop() override
Stops servicing and leaves the machine in its SAFE state.
MachineSnapshot snapshot() const override
Thread-safe copy of the latest state.
static void parse_state(const std::string &body, MachineSnapshot &out_snapshot)
Maps a /state.json body onto a snapshot.
bool configure(const MachineTiming &timing, std::string &error) override
Applies an already safety-validated timing change.
bool start() override
Begins servicing: software binds UDP and runs the machine loop, hardware starts polling.
Backend seam the node depends on, implemented by SoftwareMachineBackend (hosts pstop_c) and HardwareM...
Definition backend.hpp:113
Deployment values for the hardware backend.
Definition hardware_backend.hpp:18
double http_timeout_s
HTTP request timeout, in seconds.
Definition hardware_backend.hpp:28
std::string device_url
ESP32 machn admin/state URL.
Definition hardware_backend.hpp:20
std::string admin_user
Admin API user name.
Definition hardware_backend.hpp:22
double poll_hz
/state.json polling rate, in hertz.
Definition hardware_backend.hpp:26
std::string admin_pass
Read from PSTOP_MACHINE_ADMIN_PASS, never a param file.
Definition hardware_backend.hpp:24
One immutable read of machine state, mapped straight onto the ROS messages.
Definition backend.hpp:64
Runtime-settable timing envelope.
Definition backend.hpp:100