Welcome to ROSMASTER X3 repository
16.ROS2 common command tools
16. ROS2 Common Command Tools
1. Package Management Tool ros2 pkg
1.1. ros2 pkg create
Function: Creates a package. When creating a package, you must specify the package name, compilation method, dependencies, etc.
Format:
xxxxxxxxxxros2 pkg create <package_name> --build-type <build-type> --dependencies <dependencies>In the ros2 command:
- pkg: Indicates the functions associated with the package;
- create: Indicates the creation of a package;
- package_name: Required: The name of the new package;
- build-type: Required: Indicates whether the newly created package is C++ or Python. If using C++ or C, follow ament_cmake; if using Python, follow ament_python;
- dependencies: Optional: Indicates the package's dependencies. C++ packages must include rclcpp; Python packages must include rclpy, as well as other required dependencies.
1.2, ros2 pkg list
Function: View the list of packages in the system
Format:
xxxxxxxxxxros2 pkg list
1.3. ros2 pkg executables
Function: View all executable files in a package
Format:
xxxxxxxxxxros2 pkg executables pkg_name
2. Node Run ros2 run
Function: Run the node program in the package
Format:
xxxxxxxxxxros2 run pkg_name node_name- pkg_name: Package name
- node_name: The name of the executable program

3. Node-Related Tools: ros2 node
3.1. ros2 node list
Function: Lists all node names in the current domain
Format:
xxxxxxxxxxros2 node list

3.2. ros2 node info
Function: View detailed node information, including subscriptions, published messages, enabled services, and actions.
Format:
xxxxxxxxxxros2 node info node_name
- node_name: The name of the node to be viewed.

4. Topic-Related Tools: ros2 topic
4.1. ros2 topic list
Function: List all topics in the current domain
Format:
xxxxxxxxxxros2 topic list