rclcpp_lifecycle  master
C++ ROS Lifecycle Library API
lifecycle_node_interface.hpp
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP_LIFECYCLE__NODE_INTERFACES__LIFECYCLE_NODE_INTERFACE_HPP_
16 #define RCLCPP_LIFECYCLE__NODE_INTERFACES__LIFECYCLE_NODE_INTERFACE_HPP_
17 
18 #include "lifecycle_msgs/msg/transition.hpp"
19 
20 #include "rcl_lifecycle/rcl_lifecycle.h"
21 
24 
25 namespace rclcpp_lifecycle
26 {
27 namespace node_interfaces
28 {
30 
43 {
44 protected:
47 
48 public:
49  enum class CallbackReturn : uint8_t
50  {
51  SUCCESS = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_SUCCESS,
52  FAILURE = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_FAILURE,
53  ERROR = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_ERROR
54  };
55 
57  /*
58  * \return true by default
59  */
61  virtual CallbackReturn
62  on_configure(const State & previous_state);
63 
65  /*
66  * \return true by default
67  */
69  virtual CallbackReturn
70  on_cleanup(const State & previous_state);
71 
73  /*
74  * \return true by default
75  */
77  virtual CallbackReturn
78  on_shutdown(const State & previous_state);
79 
81  /*
82  * \return true by default
83  */
85  virtual CallbackReturn
86  on_activate(const State & previous_state);
87 
89  /*
90  * \return true by default
91  */
93  virtual CallbackReturn
94  on_deactivate(const State & previous_state);
95 
97  /*
98  * \return false by default
99  */
101  virtual CallbackReturn
102  on_error(const State & previous_state);
103 
105  virtual
107 };
108 
109 } // namespace node_interfaces
110 } // namespace rclcpp_lifecycle
111 #endif // RCLCPP_LIFECYCLE__NODE_INTERFACES__LIFECYCLE_NODE_INTERFACE_HPP_
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::ERROR
@ ERROR
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_configure
virtual CallbackReturn on_configure(const State &previous_state)
Callback function for configure transition.
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::~LifecycleNodeInterface
virtual ~LifecycleNodeInterface()
Definition: lifecycle_node_interface.hpp:106
rclcpp_lifecycle::State
Abstract class for the Lifecycle's states.
Definition: state.hpp:34
rclcpp_lifecycle
Definition: lifecycle_node.hpp:92
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
CallbackReturn
Definition: lifecycle_node_interface.hpp:49
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_cleanup
virtual CallbackReturn on_cleanup(const State &previous_state)
Callback function for cleanup transition.
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_error
virtual CallbackReturn on_error(const State &previous_state)
Callback function for errorneous transition.
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_activate
virtual CallbackReturn on_activate(const State &previous_state)
Callback function for activate transition.
visibility_control.h
RCLCPP_LIFECYCLE_PUBLIC
#define RCLCPP_LIFECYCLE_PUBLIC
Definition: visibility_control.h:50
state.hpp
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::LifecycleNodeInterface
LifecycleNodeInterface()
Definition: lifecycle_node_interface.hpp:46
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_deactivate
virtual CallbackReturn on_deactivate(const State &previous_state)
Callback function for deactivate transition.
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
Interface class for a managed node.
Definition: lifecycle_node_interface.hpp:42
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS
@ SUCCESS
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::FAILURE
@ FAILURE
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::on_shutdown
virtual CallbackReturn on_shutdown(const State &previous_state)
Callback function for shutdown transition.