ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
It has been more than 2 years, but I came across this exact same issue.
The problem seems to be associated with
rclcpp::callback_group::CallbackGroup::SharedPtr update_group
getting destroyed after the constructor ends, at it is a local variable. The timer then has an invalid reference to non-existent callback group.
Fix this by making rclcpp::callback_group::CallbackGroup::SharedPtr update_group
a class member of ControllerNode., and initialising it in the constructor.
The ROS2 tutorial seem slightly misleading, with the callback group looking like a local variable, but this of course depends on the user's context.
2 | No.2 Revision |
It has been more than 2 years, but I came across this exact same issue.
The problem seems to be associated with
rclcpp::callback_group::CallbackGroup::SharedPtr update_group
getting destroyed after the constructor ends, at it is a local variable. The timer then has an invalid reference to non-existent callback group.
Fix this by making rclcpp::callback_group::CallbackGroup::SharedPtr update_group
a class member of ControllerNode., and initialising it in the constructor.
The ROS2 tutorial seem slightly misleading, with the callback group looking like a local variable, but this of course depends on the user's context.
EDIT:
I just realised this was answered on a duplicate on Stack Overflow
3 | No.3 Revision |
It has been more than 2 years, but I came across this exact same issue.
The problem seems to be associated with
rclcpp::callback_group::CallbackGroup::SharedPtr update_group
getting destroyed after the constructor ends, at it is a local variable. The timer then has an invalid reference to non-existent callback group.variable.
Fix this by making rclcpp::callback_group::CallbackGroup::SharedPtr update_group
a class member of ControllerNode., and initialising it in the constructor.
The ROS2 tutorial seem slightly misleading, with the callback group looking like a local variable, but this of course depends on the user's context.
EDIT:
I just realised this was answered on a duplicate on Stack Overflow