has_parameter() in callback throws exception
I am not sure how this is supposed to be done:
I have a parameter client and the node which is passed to the client spins ...
rclcpp::spin( paramServer.get_node_base_interface() );
Now when I get a service callback, and I call the function has_parameter():
paramClient.has_parameter( paramName )
I get the exception Node has already been added to an executor
because inside has_parameter() it does spin_node_until_future_complete
.
Only solution I can think of is to do it like that:
rclcpp::WallRate rate(5);
while( rclcpp::ok() )
{
rclcpp::spin_some( paramServer.get_node_base_interface() );
rate.sleep();
}
So is it correct that I am not allowed to just spin the node if I want to do such things inside a subclassed node ( class ParamServer : public rclcpp::Node
)?