A few useful commands and two ros2 tools: rqt, turtlesim.
Commands
checking running nodes.
# show all running nodes
ros2 node list
# show the info of the running node
ros2 node info /py_test
launch the same node for multiple times when you want to duplicate some behaviours
bad example (don’t do it):
# terminal 1
ros2 run my_py_pkg py_node
# terminal 2
ros2 run my_py_pkg py_node
# terminal 3 - WARNING: unintended side effects
ros2 node list
good example:
# terminal 1
ros2 run my_py_pkg py_node --ros-args -remap __node:=node1
# terminal 2
ros2 run my_py_pkg py_node --ros-args -remap __node:=node2
# terminal 3
ros2 node list
--ros-args -remap __node:=node1
: arguments to remap node with new name node1
new command in colcon
for building python package: --symlink-install
colcon build --packages-select my_py_pkg --symlink-install
Can modify file and run it without the need to rebuild it (only available in Python).
RQT
Used for node graph visualisation.
# terminal 1
rqt
# navigate to plugins -> introspection -> node graph
# terminal 2
ros2 run my_py_pkg py_node
# terminal 3
ros2 run my_py_pkg py_node --ros-args -r __node:=test
turtlesim
Simplified 2d simulation of a robot.
#terminal 1
sudo apt install ros-humble-turtlesim
ros2 run turtlesim turtlesim_node
# terminal 2
ros2 run turtlesim turtle_teleop_key
# rename
ros2 run turtlesim turtlesim_node --ros-args -r __node:=my_turtle
check node graph in rqt rqt_graph
: