Robotics knowledge
Blog
Technical articles on embedded programming, ROS 2, SLAM, Nav2 and AMR/AGV — written from building real robots.
34 articles · ROS / ROS2
Create a C++ package in ROS2 step by step
From the ros2 pkg create command to the first C++ node run by ros2 run — the full process to build a package ament_cmake in the ROS2 workspace.
Create a Python package in ROS2 step by step
Package Python does not need to be compiled but must still go through colcon build — entry_points in setup.py is the executable declaration, instead of CMakeLists.txt in C++.
CMakeLists.txt in a ROS2 package — understanding each line
CMakeLists.txt generated by ros2 pkg create looks confusing, but there are only a few repeating blocks of commands in a fixed pattern — understanding the correct order is enough to read/edit any C++ package.
package.xml — the manifest of a ROS2 package
package.xml is the only file that every ROS2 package is required to have — properly declaring the <depend> tags here determines whether the build colcon automatically calculates the correct build order or not.
Launch files in ROS2 — starting multiple nodes at once
A real robot running dozens of nodes at once — launch file wraps all of those discrete ros2 run commands into a single Python file, run by a single ros2 launch command.
Parameters in ROS2 — configuring nodes without changing code
Maximum speed, frame name, sensor threshold — all values that may need to be changed according to the robot or environment should be declared as parameters, not hardcoded in the node code.
ros2 node — list and inspect running nodes
Before debugging topics or services, the first question is always: which nodes are actually running? ros2 node answers that question in seconds.
ros2 topic — inspect, publish and measure topic data rates
Use echo to inspect data, pub to simulate a publisher, and hz/bw to measure its rate — ros2 topic is the most frequently used toolkit for debugging communication between nodes.
ros2 service — test services from the terminal
No need to write a dedicated client node just for testing — ros2 service call invokes any service directly from the terminal and displays the result immediately.
ros2 action — send goals and monitor progress from the terminal
Test Nav2 without opening RViz2 and clicking — ros2 action send_goal sends goal coordinates directly and prints real-time feedback in the terminal.
ros2 param — read and change parameters while a node runs
The Parameter article covered declare_parameter in code — ros2 param is the command-line tool for reading, changing and backing up those parameters while the node is running.
ros2 bag — record and replay robot data
A SLAM bug appears in only 1 out of 10 field trials — ros2 bag records all topic data from that run so you can replay and debug it at your desk without taking the robot back to the site.