ROS2 launch FindPackageShare vs get_package_share_directory
I've noticed 2 possible ways to get the share
directory of a package from within a launch.py
file:
from ament_index_python.packages import get_package_share_directory
get_package_share_directory("package_a")
versus
from launch_ros.substitutions import FindPackageShare
FindPackageShare("package_a")
The former returns a string directly, the latter will be evaluated to a string when passed into a LaunchDescription
somewhere.
Which one is recommended?