15#ifndef CONTROLLER_INTERFACE__TEST_UTILS_HPP_
16#define CONTROLLER_INTERFACE__TEST_UTILS_HPP_
22#include "lifecycle_msgs/msg/state.hpp"
24namespace controller_interface
26using lifecycle_msgs::msg::State;
42bool configure_succeeds(
const std::unique_ptr<T> & controller)
44 auto state = controller->configure();
48 case State::PRIMARY_STATE_INACTIVE:
50 case State::PRIMARY_STATE_UNCONFIGURED:
53 throw std::runtime_error(
54 "Unexpected controller state in configure_succeeds: " + std::to_string(state.id()));
68bool activate_succeeds(
const std::unique_ptr<T> & controller)
70 auto state = controller->get_node()->activate();
74 case State::PRIMARY_STATE_ACTIVE:
76 case State::PRIMARY_STATE_INACTIVE:
81 throw std::runtime_error(
82 "Unexpected controller state in activate_succeeds: " + std::to_string(state.id()));
96bool deactivate_succeeds(
const std::unique_ptr<T> & controller)
98 auto state = controller->get_node()->deactivate();
102 case State::PRIMARY_STATE_INACTIVE:
104 case State::PRIMARY_STATE_ACTIVE:
107 throw std::runtime_error(
108 "Unexpected controller state in deactivate_succeeds: " + std::to_string(state.id()));
122bool cleanup_succeeds(
const std::unique_ptr<T> & controller)
124 auto state = controller->get_node()->cleanup();
128 case State::PRIMARY_STATE_UNCONFIGURED:
130 case State::PRIMARY_STATE_INACTIVE:
133 throw std::runtime_error(
134 "Unexpected controller state in cleanup_succeeds: " + std::to_string(state.id()));
147bool shutdown_succeeds(
const std::unique_ptr<T> & controller)
149 auto state = controller->get_node()->shutdown();
160 case State::PRIMARY_STATE_FINALIZED:
165 throw std::runtime_error(
166 "Unexpected controller state in shutdown_succeeds: " + std::to_string(state.id()));