Skip to content

Sentor and State Machine

Jonathan Cox edited this page Dec 9, 2025 · 3 revisions

Sentor

ROS topic and node monitoring.

Launch

ros2 launch sentor sentor_launch.py

https://github.com/LCAS/sentor/tree/master/src/sentor/launch

Launch Arguments

  • config_file: Path to the YAML configuration file for sentor monitoring

    • Default: $(find-pkg-share sentor)/config/test_monitor_config.yaml
    • Type: string
  • log_level: Log level for the sentor node

    • Default: info
    • Valid values: debug, info, warn, error, fatal
    • Type: string

Basic Config

The default configuration file is located at:

src/sentor/config/test_monitor_config.yaml

https://github.com/LCAS/sentor/tree/master/src/sentor/config

After installation, it will be available at:

install/sentor/share/sentor/config/test_monitor_config.yaml

Heartbeats

Senator publishes two heartbeats.

Safety heartbeat (safety/heartbeat)

  • Publishes std_msgs/Bool
  • TRUE when all safety-critical monitors are satisfied for safe_operation_timeout
  • FALSE immediately on first safety-critical failure

Warning heartbeat (warning/heartbeat)

  • Publishes std_msgs/Bool
  • TRUE when all autonomy-critical monitors are satisfied
  • FALSE on first autonomy-critical failure
    (use for degradations that allow limp-home operation)

Robot State Machine

Launch

ros2 run robot_state_machine robot_state_machine_sentor

https://github.com/LCAS/sentor/blob/master/src/robot_state_machine/robot_state_machine/robot_state_machine_sentor.py

Robot States

The state machine switches between four states.

start-up  →  disabled  ↔  enabled  →  active

Topics

Subscribes:

  /safety/heartbeat  (Bool)  — TRUE when all safety critical heartbeats are fresh.
                                        — Depending on SENTOR policy, this may publish only when healthy.
  /warning/heartbeat (Bool)  — TRUE/FALSE indicates non-critical warning health.
  /set_mode          (String:'manual'|'autonomous')
  /set_state         (String:'disabled'|'enabled'|'active')  — for debugging/legal transitions.
  /deadman_button    (Bool)   — operator hold in MANUAL mode.

Publishes:

  /robot_state     (String) — one of 'start-up'|'disabled'|'enabled'|'active'
  /autonomous_mode (Bool)   — TRUE in autonomous, FALSE in manual

Example joy controller interface with the state machine

This example node uses the joy controller buttons to interface with the sata machine to change autonomous mode and for the deadman's button.

Launch

ros2 run robot_state_machine joy_robot_state_machine

https://github.com/LCAS/sentor/blob/master/src/robot_state_machine/robot_state_machine/joy_robot_state_machine.py

Logitech Controller Buttons (when launched in joy_config:='xbox')

  • X button - switch to manual mode
  • Y button - switch to autonomous mode
  • LB (Left bumper) - hold for manual movement (deadman button)
  • RB (Right bumper) - enable/activate button

Sentor Guard

The guard allows or stops topics such as the cmd_vel from being published to the robot's motors.

Launch

ros2 launch sentor_guard guard_example.launch.py

https://github.com/LCAS/sentor/blob/master/src/sentor_guard/launch/guard_example.launch.py

Config

In the launch file the guard parameters can be defined, the input cmd_vel topic and the republished cmd_vel topic to publish to the motors.

https://github.com/LCAS/sentor/blob/master/src/sentor_guard/config/guard_params.yaml

'input_topic': '/cmd_vel',
output_topic': '/guard/cmd_vel',
'message_type': 'geometry_msgs/msg/Twist',

The cmd_vel topic will only be republished once the conditions in the config file have been met.

/**:
  ros__parameters:
    # Topics to monitor from RobotStateMachine
    state_topic: "/robot_state"
    mode_topic: "/autonomous_mode" # true (autonomous) or false (manual)
    
    # Guard conditions
    required_state: "active"  # One of: 'start-up', 'disabled', 'enabled', 'active'
    update_timeout: 1.0  # Maximum age of messages in seconds
    
    # Which conditions to enforce
    require_autonomous_mode: true

In the example, the guard monitors the robot state (/robot_state) and mode (/autonomous_mode) topics from the robot state machine. Only when the /robot_state is active and if require_autonomous_mode=true and /autonomous_mode is true will the cmd_vel be republished.

Quick Start

Run sentor and state machine on any machine

  • Start joystick package
ros2 launch teleop_twist_joy teleop-launch.py joy_config:='xbox'
  • Launch sentor
ros2 launch sentor sentor_launch.py
  • Publish example topic, in the exmaple sentor config sentor listens to this topic at 10Hz
ros2 topic pub --rate 10 /chatter_autonomy_critical std_msgs/msg/String "{data: 'hello'}"
  • Launch state machine
ros2 run robot_state_machine robot_state_machine_sentor
  • Launch joy state machine node
ros2 run robot_state_machine joy_robot_state_machine
  • Launch ardunio bridge (only on real robot with Arduinolights)
ros2 run robot_state_machine bridge_to_arduino
  • Launch sentor guard
ros2 launch sentor_guard guard_example.launch.py

Logitech buttons

  • X button - switch to manual mode
  • Y button - switch to autonomous mode
  • LB (Left bumper) - hold for manual movement (deadman button)
  • RB (Right bumper) - enable/activate button

Topics to monitor

Sentor:

  • ros2 topic echo /safety/heartbeat
  • ros2 topic echo /warning/heartbeat

State Machine:

  • ros2 topic echo /robot_state
  • ros2 topic echo /autonomous_mode