9namespace protective_stop_machine
13enum class MachineState : uint8_t
90 return MachineState::UNSTABLE;
92 return running ? MachineState::ACTIVE : MachineState::DEACTIVATED;
137 virtual const char *
name()
const = 0;
Backend seam the node depends on, implemented by SoftwareMachineBackend (hosts pstop_c) and HardwareM...
Definition backend.hpp:113
virtual MachineSnapshot snapshot() const =0
Thread-safe copy of the latest state.
virtual bool configure(const MachineTiming &timing, std::string &error)=0
Applies an already safety-validated timing change.
virtual void stop()=0
Stops servicing and leaves the machine in its SAFE state.
virtual bool start()=0
Begins servicing: software binds UDP and runs the machine loop, hardware starts polling.
virtual const char * name() const =0
Backend kind, "software" or "hardware".
One immutable read of machine state, mapped straight onto the ROS messages.
Definition backend.hpp:64
std::string status_reason
Human-readable cause of the current state.
Definition backend.hpp:72
bool need_stop
Machine awaits a STOP before it can be re-armed.
Definition backend.hpp:70
std::vector< RemoteInfo > remotes
Known remotes.
Definition backend.hpp:76
bool reachable
Backend can reach the machine.
Definition backend.hpp:66
RelayInfo relay
Relay state.
Definition backend.hpp:74
uint32_t heartbeat_timeout_stops
Stops caused by a remote missing its heartbeats, since the backend started.
Definition backend.hpp:81
MachineState state() const
State derived from reachable and running.
Definition backend.hpp:87
bool running
Machine is cleared to run.
Definition backend.hpp:68
uint32_t bonds_refused
Bonds refused by the allow/denylist, since the backend started.
Definition backend.hpp:84
uint32_t active_remotes
Number of bonded remotes.
Definition backend.hpp:78
Runtime-settable timing envelope.
Definition backend.hpp:100
uint16_t max_missed
Heartbeats that may be missed before the machine stops.
Definition backend.hpp:104
uint64_t min_stop_ms
Minimum time between STOP and OK, in milliseconds.
Definition backend.hpp:106
uint64_t heartbeat_ms
Heartbeat interval, in milliseconds.
Definition backend.hpp:102
Relay and fault state of a hardware machine.
Definition backend.hpp:46
bool fault_b
Fault flag of channel B.
Definition backend.hpp:56
uint32_t mismatch
Count of A/B channel mismatches.
Definition backend.hpp:58
bool relay_stop
Stop relay asserted.
Definition backend.hpp:52
bool applicable
Set by the hardware backend; the software backend has no relays.
Definition backend.hpp:48
bool run
Run relay energized.
Definition backend.hpp:50
bool fault_a
Fault flag of channel A.
Definition backend.hpp:54
State of one remote as seen by the machine.
Definition backend.hpp:25
uint32_t loop_rtt_ms
Loop round-trip time, in milliseconds.
Definition backend.hpp:37
uint32_t disco_rtt_ms
Discovery round-trip time, in milliseconds.
Definition backend.hpp:39
std::string device_id
8 hex digits, e.g. "01d7eed0".
Definition backend.hpp:27
uint32_t reply_age_ms
Milliseconds since the last reply from the remote.
Definition backend.hpp:35
bool stop_only
Remote may stop but not re-arm.
Definition backend.hpp:33
uint32_t rebonds
Number of times the remote has re-bonded.
Definition backend.hpp:41
uint8_t bond_state
0 empty, 1 connecting, 2 bonded, 3 stopped.
Definition backend.hpp:29
bool in_use
Owns the current arming cycle.
Definition backend.hpp:31