-
Notifications
You must be signed in to change notification settings - Fork 9
Sentor and State Machine
ROS topic and node monitoring.
ros2 launch sentor sentor_launch.py
https://github.com/LCAS/sentor/tree/master/src/sentor/launch
-
config_file: Path to the YAML configuration file for sentor monitoring- Default:
$(find-pkg-share sentor)/config/test_monitor_config.yaml - Type: string
- Default:
-
log_level: Log level for the sentor node- Default:
info - Valid values:
debug,info,warn,error,fatal - Type: string
- Default:
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
Senator publishes two heartbeats.
- Publishes
std_msgs/Bool -
TRUE when all safety-critical monitors are satisfied for
safe_operation_timeout - FALSE immediately on first safety-critical failure
- 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)
ros2 run robot_state_machine robot_state_machine_sentor
The state machine switches between four states.
start-up → disabled ↔ enabled → active
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
This example node uses the joy controller buttons to interface with the sata machine to change autonomous mode and for the deadman's button.
ros2 run robot_state_machine joy_robot_state_machine
- 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
The guard allows or stops topics such as the cmd_vel from being published to the robot's motors.
ros2 launch sentor_guard guard_example.launch.py
https://github.com/LCAS/sentor/blob/master/src/sentor_guard/launch/guard_example.launch.py
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.
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
Sentor:
ros2 topic echo /safety/heartbeatros2 topic echo /warning/heartbeat
State Machine:
ros2 topic echo /robot_stateros2 topic echo /autonomous_mode