print agruments in ROS 2 foxy launch files
I am having issues with running navigation on simulating turtlebot3 through a gazebo model I created and ran a slam with cartographer as per the emanual on robotis website. I am using a copy of turtlebot3world.launch.py that I changed to launch my model world without the robot. Then I run a robotspawnerpkg to launch the burger model in the model world at 0,0,0. Gazebo is building the model ok and sending the lidar fine. This is how I call this. ros2 launch turtlebot3gazebo turtlebot3lroom.launch.py. Then I call the navigation launch file ros2 launch turtlebot3navigation2 navigation2.launch.py usesimtime:=true map:=/home/robot/turtlebot3ws/src/turtlebot3/turtlebot3navigation2/map/newlroom.yaml newlroom.yaml is the yaml file from the slam session.
This launch file has the following LaunchConfigurations map and params Then arguments usesimtime, map, params
Then it includes bringup_launch.py and finally rviz node.
I have modified the params file that gets passed to bringup launch file with values that I optimized for burger while running ros1. However I am not seeing these values. I want to print or log the values of the arguments passed to bringup_launch.py because it is not using the correct file.
Asked by ed on 2021-02-14 17:43:58 UTC
Answers
ok Here I am again answering my own questions. I never did figure out how to print out the arguments inside a launchfile. I almost stopped doing robotics because this. The whole issue is because the navigation2.launch.py file provided by robotis in their turtlebot3_navigation package is using the WRONG parameter name
This is their code
IncludeLaunchDescription(
PythonLaunchDescriptionSource([nav2_launch_file_dir, '/bringup_launch.py']),
launch_arguments={
'map': map_dir,
'use_sim_time': use_sim_time,
'params': param_dir I think this is wrong should be params_file
}.items(),
),
This is the code that works
IncludeLaunchDescription(
PythonLaunchDescriptionSource([nav2_launch_file_dir, '/bringup_launch.py']),
launch_arguments={
'map': map_dir,
'use_sim_time': use_sim_time,
'params_file': param_dir
}.items(),
),
params Should be params_file
They never probably noticed that the local costmap parameters are not set and the default values are used. The default values work for their simulations but I had gone through extensive customizations in ros1 to to get the my burger to negotiate the tight spaces in my living room.
I wasted over 100 hours trying to track down why the robot would not go through the narrow space because I assumed the robotis packages had been fully tested. It would have helped if I could have printed the arguments being passed into the launch file so if anyone figured that out add a comment here.
Lesson learned do not assumed ros2 software has been tested. Also visually examine both side of the launch files hand off.
Asked by ed on 2021-04-11 14:14:33 UTC
Comments