I'm trying to run a LiDar driver from my robot bringup launch file, I ofcourse need to give the launch file arguments: hostname and frame id, when running this from CLI it works fine and when I'm trying to pass the arguments with launch_arguments then it doesn't work.

            os.path.join(lidar_dir, "launch", "sick_nav_350.launch.py")
            "frame_id" : 'lidar',
            'hostname' : '',

Not sure what goes wrong but I think it has something to do with the implementation of the Lidar launch file where it passes the arguments to another yaml launch file it checks for the usage of := which is only used in CLI

ld = LaunchDescription()
sick_scan_pkg_prefix = get_package_share_directory('sick_scan_xd')
launchfile = os.path.basename(__file__)[:-3] # convert "<lidar_name>.launch.py" to "<lidar_name>.launch"
launch_file_path = os.path.join(sick_scan_pkg_prefix, 'launch/' + launchfile) # 'launch/sick_nav_350.launch')

# append optional commandline arguments in name:=value syntax
for arg in sys.argv:
    if len(arg.split(":=")) == 2:

ROS_DISTRO = os.environ.get('ROS_DISTRO') # i.e. 'eloquent', 'foxy', etc.
if ROS_DISTRO[0] <= "e": # ROS versions eloquent and earlier require "node_executable", ROS foxy and later use "executable"
    node = Node(
        remappings=[ ('/sick_nav_350/scan', '/scan'), ], # remap laserscan messages to topic /scan, required for slam_toolbox

Any quick solution for this?


1 Answer 1


I think the question is similar to this, you have to declare the launch arguments before to pass it to the launch file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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