Easy Navigation
Loading...
Searching...
No Matches
SafetySupervisor Class Reference

What SystemNode does for safety, kept out of the navigation logic. More...

#include <SafetySupervisor.hpp>

Public Member Functions

bool allows_reconfiguration (const std::string &reason) const
 Whether a reconfiguration may be requested; logs why not.
bool check_controller (ControllerNode &controller) const
 Checks controller against "safety.plc_limits" and what "safety.mode" requires.
bool check_system (rclcpp_lifecycle::LifecycleNode &node, rclcpp::CallbackGroup::SharedPtr rt_group=nullptr)
 Reads node's safety parameters and checks them, before the subnodes configure.
bool cycle_rt (NavState &nav_state, RtMonitor::Clock::time_point now)
 At the start of each RT cycle, at now: monitors it, publishes the heartbeat when due, and writes the safety channel's state to NavState.
void declare_parameters (rclcpp_lifecycle::LifecycleNode &node)
 Declares the "safety.*" parameters in node (SystemNode).
const std::string & failure () const
 Why cycle_rt() asked to stop.
std::string get_configuration_hash () const
 SHA-256 (hex) of every EasyNav parameter, as of the last configure.
const RtMonitor & get_rt_monitor () const
bool is_memory_lock_requested () const
 "safety.lock_memory", as of the last configure.
bool is_safety_mode () const
 "safety.mode", as of the last configure.
bool is_safety_status_enabled () const
 Whether the safety status is received ("safety.status.timeout" > 0).
void on_activate ()
 On activation: the RT monitor starts over.
void on_configured (const Nodes &nodes, NavState &nav_state)
 After a successful configure: fingerprints and, in safety mode, freezes nodes.

Detailed Description

What SystemNode does for safety, kept out of the navigation logic.

Its parameters, in SystemNode:

  • "safety.plc_limits.*": the limits configured in the safety channel (e.g. the PLC's safely limited speed). Not applied to the commands (controller_node's "robot_limits" are, in any mode): "robot_limits" may not exceed them.
  • "safety.mode" (default false) makes EasyNav stricter: "safety.plc_limits.*", the command keepalive and timeout, and real-time scheduling (checked on configure) are required; the configuration is frozen once configured, and reconfiguration requests are rejected.
  • "safety.lock_memory" (default false, any mode): system_main locks the process memory; if RLIMIT_MEMLOCK does not allow it, configuring fails.
  • "safety.heartbeat.period" (s, default 0: off; required in safety mode): a Heartbeat is published on "easynav_heartbeat" from the RT cycle, so it stops if that cycle does.
  • "safety.rt_monitor.*": an RT cycle starting more than "max_period_factor" periods after the previous one is late; "max_late_cycles" in a row are reported ("diagnostics.rt_cycle"): a WARN, or in safety mode an ERROR that stops EasyNav (the RT cycle receives the sensors and publishes the commands). Whether each component keeps its own frequency is reported separately, as a WARN ("diagnostics.<plugin>.rt_rate" / ".rate", see MethodBase).
  • "safety.status.timeout" (s, default 0: off; required in safety mode): the safety channel's state (SafetyStatus) is received on "easynav_safety_status" and applied every RT cycle through NavState ("safety_status"): during a protective stop EasyNav commands zero and keeps the mission; a safely limited speed cuts the robot limits down. With no valid status within the timeout, it is a protective stop.
  • "safety.max_pose_age" (s, default 1.0; 0: off): a "robot_pose" older than this (its stamp, ROS time), or not finite, is an ERROR ("diagnostics.robot_pose"); in safety mode, motion is also inhibited ("inhibit_motion": the robot brakes to zero) until it is usable again.

Every configure, it fingerprints the configuration: a SHA-256 of every parameter, logged and shared in NavState ("configuration_hash"), with the parameters saved in the ROS log directory ("easynav_configuration_[<ns>_]<hash>.txt") and published, latched, on "easynav_configuration".

Member Function Documentation

◆ allows_reconfiguration()

bool allows_reconfiguration ( const std::string & reason) const

Whether a reconfiguration may be requested; logs why not.

◆ check_controller()

bool check_controller ( ControllerNode & controller) const

Checks controller against "safety.plc_limits" and what "safety.mode" requires.

◆ check_system()

bool check_system ( rclcpp_lifecycle::LifecycleNode & node,
rclcpp::CallbackGroup::SharedPtr rt_group = nullptr )

Reads node's safety parameters and checks them, before the subnodes configure.

The safety status is received in rt_group (SystemNode's RT callback group), if given.

◆ cycle_rt()

bool cycle_rt ( NavState & nav_state,
RtMonitor::Clock::time_point now )

At the start of each RT cycle, at now: monitors it, publishes the heartbeat when due, and writes the safety channel's state to NavState.

Returns
false if EasyNav must stop (see failure()), until on_activate().

◆ declare_parameters()

void declare_parameters ( rclcpp_lifecycle::LifecycleNode & node)

Declares the "safety.*" parameters in node (SystemNode).

◆ failure()

const std::string & failure ( ) const
nodiscard

Why cycle_rt() asked to stop.

◆ get_configuration_hash()

std::string get_configuration_hash ( ) const
nodiscard

SHA-256 (hex) of every EasyNav parameter, as of the last configure.

◆ get_rt_monitor()

const RtMonitor & get_rt_monitor ( ) const
nodiscard

◆ is_memory_lock_requested()

bool is_memory_lock_requested ( ) const
nodiscard

"safety.lock_memory", as of the last configure.

◆ is_safety_mode()

bool is_safety_mode ( ) const
nodiscard

"safety.mode", as of the last configure.

◆ is_safety_status_enabled()

bool is_safety_status_enabled ( ) const
nodiscard

Whether the safety status is received ("safety.status.timeout" > 0).

◆ on_activate()

void on_activate ( )

On activation: the RT monitor starts over.

◆ on_configured()

void on_configured ( const Nodes & nodes,
NavState & nav_state )

After a successful configure: fingerprints and, in safety mode, freezes nodes.


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