Show EOL distros: 

Package Summary

The robot_activity package implements ROS node lifecycle

Package Summary

The robot_activity package implements ROS node lifecycle

Package Summary

The robot_activity package implements ROS node lifecycle

Package Summary

The robot_activity package implements ROS node lifecycle

Node lifecycle is coming to ROS 2.0 in form of managed nodes, why not bring it to ROS already?

robot_activity is a ROS package, which implements node lifecycle. The idea is that you don't have to write a lot of bolier-plate code in C++ when making a new ROS node and you get a lot of features for free!

A minimal example using robot_activity is available in the robot_activity_tutorials package. Check the robot_activity_tutorials_minimal_node.cpp

The main features of the package are:

  1. Controllable node lifecycle - nodes automatically expose ROS services that allow you to pause, stop, restart, reconfigure and terminate a given node

  2. ROS subscribers and services are automatically managed for you during the lifecycle. Services and callbacks will not be called if you request your node to exit RUNNING state. This means that you can now safely reconfigure your nodes without relaunching!

  3. Creation of super-nodes, multiple ROS nodes in a single process (similar to nodelets)
  4. Easy integration with a node supervisor using heartbeat and error messages.

The node lifecycle can be represented as a Finite State Machine (FSM): robot_activity-FSM When you inherit from robot_activity::ManagedRobotActivity, the subscribers and services are managed for you, meaning that they will only be executed in the RUNNING state.

  1. In PAUSED state, they are invoked, but immediately return without executing the actual body of the callback (services return false).

  2. In STOPPED state, all registered subscribers and services are shutdown, so that no IPC or TCP/IP traffic occurs.

  3. When transitioning back to PAUSED state from STOPPED, the subscribers and services are once again advertised for you (with the same arguments), but still not yet fully executed

  4. When transitioning back to RUNNING state from PAUSED, the subscibers and services are now functional. However, all callback invocation that occured out of RUNNING state are lost.

Library

API

When you inherit from robot_activity::RobotActivity or robot_activity::ManagedRobotActivity, the following node API will be automatically exposed

Published Topics

/heartbeat (robot_activity_msgs/State)
  • Heartbeat msg is send to a global topic (usually listened to by a node supervisor)
/error (robot_activity_msgs/Error)
  • User can easily raise errors from the inherited class, which will be published on the global /error topic (usually listened to by a node supervisor). This is done by calling RobotActivity::notifyError

Services

~name_space/start (std_srvs/Empty)
  • Transitions from current state to RUNNING
~name_space/stop (std_srvs/Empty)
  • Transitions from current state to STOPPED
~name_space/pause (std_srvs/Empty)
  • Transitions from current state to PAUSED
~name_space/restart (std_srvs/Empty)
  • Transitions from current state to STOPPED and then to RUNNING
~name_space/reconfigure (std_srvs/Empty)
  • Transitions from current state to UNCONFIGURED and then to RUNNING if param ~autostart_after_reconfigure is set to True, otherwise transitions to STOPPED
~name_space/terminate (std_srvs/Empty)
  • Transitions from current state to TERMINATED

Parameters

'~wait_for_supervisor' (boolean, default: True)
  • If set to True, the node upon initialization will immediately pause its execution and wait until there is at least on subscriber on the global \heartbeat topic
'~autostart_after_reconfigure' (boolean, default: False)
  • If set to True, upon calling ~reconfigure service the node will transtition to UNCONFIGURED and then to RUNNING, otherwise it will only reach STOPPED state
'~heartbeat_rate' (float, default: 1.0f)
  • Heartbeat rate in Hz published on /heartbeat

Use GitHub to report bugs or submit feature requests. [View active issues]

Wiki: robot_activity (last edited 2018-05-29 18:33:34 by MaciejZurad)