1
$\begingroup$

Is there a reason that a lot of constructors in ROS based code take in tf2_ros::TransformListener as one of the input? I want to get an idea from the design perspective.

$\endgroup$
1
$\begingroup$

The tf2_ros::TransformListener takes up a relatively high amount of processing power because it subscribes to the publications of the high volume /tf topics and caches the results locally in memory. It's much more efficient to have one copy which you access from multiple places in your code by passing a reference to it and querying it directly rather than instantiating multiple instances which will increasing network traffic, memory usage, and cpu usage for each instance.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.