22#include < future>
33#include < QTimer>
44#include < QDebug>
5+ #include < QCoreApplication>
6+
57#include < QTime>
68#include < iostream>
79#include < QStateMachine>
@@ -40,10 +42,18 @@ T convert(const std::string& str) {
4042 /* DATAMODEL*/ m_stateMachine.setDataModel (&m_dataModel);/* END_DATAMODEL*/
4143}
4244
45+ $className$::~$className$()
46+ {
47+ // std::cout << "DEBUG: Invoked destructor of $className$" << std::endl;
48+ m_threadSpin->join ();
49+ }
50+
4351void $className$::spin(std::shared_ptr<rclcpp::Node> node)
4452{
45- rclcpp::spin (node);
46- rclcpp::shutdown ();
53+ rclcpp::spin (node);
54+ rclcpp::shutdown ();
55+ QCoreApplication::quit ();
56+ // std::cout << "DEBUG: $className$::spin successfully ended" << std::endl;
4757}
4858
4959bool $className$::start(int argc, char *argv[])
@@ -55,7 +65,7 @@ bool $className$::start(int argc, char*argv[])
5565
5666 m_node = rclcpp::Node::make_shared (m_name + " Skill" );
5767 RCLCPP_DEBUG_STREAM (m_node->get_logger (), " $className$::start" );
58- std::cout << " $className$::start" ;
68+ std::cout << " DEBUG: $className$::start" << std::endl ;
5969
6070 /* TICK*/
6171 m_tickService = m_node->create_service <bt_interfaces_dummy::srv::Tick$skillType$>(m_name + " Skill/tick" ,
@@ -188,7 +198,7 @@ bool $className$::start(int argc, char*argv[])
188198
189199 m_stateMachine.start ();
190200 m_threadSpin = std::make_shared<std::thread>(spin, m_node);
191-
201+
192202 return true ;
193203}
194204/* TICK_CMD*/
@@ -332,4 +342,4 @@ void $className$::result_callback(const rclcpp_action::ClientGoalHandle<$eventD
332342 data.insert (" is_ok" , result.result ->is_ok );
333343 m_stateMachine.submitEvent (" $eventData.componentName$.$eventData.functionName$.ResultResponse" , data);
334344 RCLCPP_INFO (rclcpp::get_logger (" rclcpp" ), " $eventData.componentName$.$eventData.functionName$.ResultResponse" );
335- }/* END_ACTION_RESULT_CALLBACK_FNC*/
345+ }/* END_ACTION_RESULT_CALLBACK_FNC*/
0 commit comments