Useful Debugging Tips - SFU-MARS/ros2_tutorial GitHub Wiki
The following saves stdout to a log file while still having the log display in terminal:
-
ros2 launch <package> <launch file> | tee <log file>
- e.g.
ros2 launch nav2_bringup tb3_simulation_launch.py | tee tb3_bringup_debug.log
- e.g.
- This can be useful for closely inspecting the logs, or to copy content from the logs
- Print transformations
ros2 run tf2_ros tf2_echo laser_link map
- Visualize transformations in real time
-
ros2 run rqt_tf_tree rqt_tf_tree
(need to install it first)
-
- Visualize transformations once
ros2 run tf2_tools view_frames
- List parameters
ros2 launch <package> <launch file> -s
- More detailed outputs for debugging
ros2 launch <package> <launch file> -d -a
-
It can be helpful to run a new node by itself outside of any launch file first. Parameters and topic mapping can be set from the commandline:
ros2 run <package> <executable> --ros-args -p some_param:=some_value -p other_param:=other_value -r old_topic:=new_topic -r other_old_topic:=other_new_topic
-
Interact with parameters from commandline
ros2 param list
ros2 param get <node> <parameter>
-
ros2 param set <node> <parameter> <value>
- Use parameter callback to allow parameter setting while node is running.