@@ -34,7 +34,8 @@ CallbackReturnT CognitiveModule::on_configure(const rclcpp_lifecycle::State & st
3434 (void )state;
3535
3636 get_parameter (" core" , core_name_);
37- auto [core_, error_core] = load_component<Core>(core_name_, shared_from_this ());
37+ std::string error_core;
38+ std::tie (core_, error_core) = load_component<Core>(core_name_, shared_from_this ());
3839 if (core_ == nullptr || !core_->configure ()) {
3940 RCLCPP_ERROR (
4041 get_logger (), " Error configuring core at %s with name %s: %s" ,
@@ -43,7 +44,9 @@ CallbackReturnT CognitiveModule::on_configure(const rclcpp_lifecycle::State & st
4344 }
4445
4546 get_parameter (" efferent" , efferent_name_);
46- auto [efferent_, error_efferent] = load_component<Efferent>(efferent_name_, shared_from_this ());
47+ std::string error_efferent;
48+ std::tie (efferent_, error_efferent) = load_component<Efferent>(efferent_name_,
49+ shared_from_this ());
4750 if (efferent_ == nullptr || !efferent_->configure ()) {
4851 RCLCPP_ERROR (
4952 get_logger (), " Error configuring efferent at %s with name %s: %s" ,
@@ -52,16 +55,22 @@ CallbackReturnT CognitiveModule::on_configure(const rclcpp_lifecycle::State & st
5255 }
5356
5457 get_parameter (" afferent" , afferent_name_);
55- auto [afferent_, error_afferent] = load_component<Afferent>(afferent_name_, shared_from_this ());
58+ std::string error_afferent;
59+ std::tie (afferent_, error_afferent) = load_component<Afferent>(afferent_name_,
60+ shared_from_this ());
5661 if (afferent_ == nullptr || !afferent_->configure ()) {
5762 RCLCPP_ERROR (
5863 get_logger (), " Error configuring afferent at %s with name %s: %s" ,
5964 get_name (), afferent_name_.c_str (), error_afferent.c_str ());
6065 return CallbackReturnT::FAILURE;
6166 }
6267
68+ core_->set_afferent (afferent_);
69+ core_->set_efferent (efferent_);
70+
6371 get_parameter (" meta" , meta_name_);
64- auto [meta_, error_meta] = load_component<Meta>(meta_name_, shared_from_this ());
72+ std::string error_meta;
73+ std::tie (meta_, error_meta) = load_component<Meta>(meta_name_, shared_from_this ());
6574 if (meta_ == nullptr || !meta_->configure ()) {
6675 RCLCPP_ERROR (
6776 get_logger (), " Error configuring efferent at %s with name %s: %s" ,
@@ -70,7 +79,9 @@ CallbackReturnT CognitiveModule::on_configure(const rclcpp_lifecycle::State & st
7079 }
7180
7281 get_parameter (" coupling" , coupling_name_);
73- auto [coupling_, error_coupling] = load_component<Coupling>(coupling_name_, shared_from_this ());
82+ std::string error_coupling;
83+ std::tie (coupling_, error_coupling) = load_component<Coupling>(coupling_name_,
84+ shared_from_this ());
7485 if (coupling_ == nullptr || !coupling_->configure ()) {
7586 RCLCPP_ERROR (
7687 get_logger (), " Error configuring efferent at %s with name %s: %s" ,
@@ -85,13 +96,23 @@ CallbackReturnT CognitiveModule::on_activate(const rclcpp_lifecycle::State & sta
8596{
8697 (void )state;
8798
99+ if (!core_->activate ()) {
100+ RCLCPP_ERROR (get_logger (), " Unable to activate Core" );
101+ return CallbackReturnT::FAILURE;
102+ }
103+
88104 return CallbackReturnT::SUCCESS;
89105}
90106
91107CallbackReturnT CognitiveModule::on_deactivate (const rclcpp_lifecycle::State & state)
92108{
93109 (void )state;
94110
111+ if (!core_->deactivate ()) {
112+ RCLCPP_ERROR (get_logger (), " Unable to activate Core" );
113+ return CallbackReturnT::FAILURE;
114+ }
115+
95116 return CallbackReturnT::SUCCESS;
96117}
97118
0 commit comments