transformListener constructor parameters in tf2 and related questions
Can anyone explain what node and spin _ thread parameters exactly mean in the C++ constructor of TransformListener ?
My problem is that when I create TransformListener inside the init() function of my Node with a custom QoS like this
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(
* tf_buffer_ // buffer
, this // node
, true // spin_thread
, qos
);
I get an exception
terminate called after throwing an instance of 'std::runtime_error'
what(): Node has already been added to an executor.
I guess that ROS tries to run a different copy of my node in a separate thread, which causes this exception.
But then why on earth the basic constructor
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(
* tf_buffer_
)
works correctly ? Doesn't it substitute this for node ?
This also works
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(
* tf_buffer_ // buffer
, this // node
, false // spin_thread
, qos
);
but I can't get from the documentation if this code is functional or not.
Also, what is the difference between qos and static_qos ?
Can you use static _ qos if the transformation does not depend on time ?
Will redefining the move-constructor for my Node to change its name when it is copied solve my problem ?