#include "env_interface/env_interface_base.hpp" namespace env_interface { CallbackReturn EnvInterfaceBase::init( const std::string& t_env_name, const std::string & t_namespace, const rclcpp::NodeOptions & t_node_options) { m_node = std::make_shared( t_env_name, t_namespace, t_node_options, false); if (on_init() == CallbackReturn::FAILURE) { return CallbackReturn::FAILURE; } m_node->register_on_configure( std::bind(&EnvInterfaceBase::on_configure, this, std::placeholders::_1) ); m_node->register_on_activate( std::bind(&EnvInterfaceBase::on_activate, this, std::placeholders::_1) ); m_node->register_on_cleanup( std::bind(&EnvInterfaceBase::on_cleanup, this, std::placeholders::_1) ); m_node->register_on_deactivate( std::bind(&EnvInterfaceBase::on_deactivate, this, std::placeholders::_1) ); m_node->register_on_error( std::bind(&EnvInterfaceBase::on_error, this, std::placeholders::_1) ); m_node->register_on_shutdown( std::bind(&EnvInterfaceBase::on_shutdown, this, std::placeholders::_1) ); return CallbackReturn::SUCCESS; } const rclcpp_lifecycle::State& EnvInterfaceBase::configure() { return getNode()->configure(); } std::shared_ptr EnvInterfaceBase::getNode() { if (!m_node.get()) { throw std::runtime_error("Lifecycle node hasn't been initialized yet"); } return m_node; } const rclcpp_lifecycle::State & EnvInterfaceBase::getState() const { return m_node->get_current_state(); } } // namespace env_interface