發表文章

目前顯示的是 2025的文章

ROS1 vs ROS2 Comprehensive Comparison (5)

Parameter Usage Comparison Feature ROS1 ROS2 Parameter Storage Global parameter server (centralized) Node-specific parameters (distributed) Lifetime Exists as long as ROS master is running Exists only as long as the node is running Parameter Namespacing /global_param # Global parameter /node_name/param_name # Node parameter # All parameters are node-specific # Access using node name and parameter name /node_name: # Node param_name # Parameter Declaring Parameters Not required, parameters can be created on-the-fly Must be declared before use (with exceptions) C++ API (Setting Parameters) // Global parameter ros::param::set("/global_param", value); // Node parameter ros::NodeHandle nh; nh.setParam("param_name", value); // Must declare first t...

ROS1 vs ROS2 Comprehensive Comparison (4)

Creating Custom Interfaces (Messages and Services) Comparison Feature ROS1 ROS2 Package Type Any catkin package can contain messages Must be an ament_cmake package (even for Python nodes) Directory Structure my_package/ ├── msg/ │ └── MyMessage.msg ├── srv/ │ └── MyService.srv ├── CMakeLists.txt └── package.xml my_package/ ├── msg/ │ └── MyMessage.msg ├── srv/ │ └── MyService.srv ├── CMakeLists.txt └── package.xml Best Practice Often mixed with node code in the same package Create a dedicated *_interfaces package (separate from node code) Naming Convention Often named *_msgs for message packages Preferably named *_interfaces for interface packages File Format (.msg) # MyMessage.msg Header header # Optional standard header int32 my_int # Fields with their types string my_string ...

ROS1 vs ROS2 Comprehensive Comparison (3)

Package Configuration Files package.xml Examples ROS1 package.xml (Format 2) ROS2 package.xml (Format 3) <?xml version="1.0"?> <package format="2"> <name>my_ros1_package</name> <version>0.1.0</version> <description> A package for ROS1 </description> <maintainer email="user@example.com">Your Name</maintainer> <license>BSD</license> <url type="website">http://wiki.ros.org/my_ros1_package</url> <author email="user@example.com">Your Name</author> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>std_msgs</build_depend> <exec_depend>roscpp</exec_depend> <exec_depend>rospy</exec_depend> <exec_depend>std_msgs</exec...

ROS1 vs ROS2 Comprehensive Comparison (2)

Introspection Commands Comparison Task ROS1 Command ROS2 Command Notes Node Introspection List all nodes rosnode list ros2 node list The functionality is similar, but in ROS2 all command line tools use the ros2 prefix Get node information rosnode info /node_name ros2 node info /node_name Shows publishers, subscribers, services, and actions associated with the node Ping a node rosnode ping /node_name ros2 node ping /node_name Test connectivity to a specific node Kill a node rosnode kill /node_name Not directly available In ROS2, you typically use Ctrl+C or task/process management Run a node rosrun package_name node_name ros2 run package_name node_name The core functionality is the same Topic Introspection List all topics rostopic list ros2 topic list Lists all active topics L...

ROS1 vs ROS2 Comprehensive Comparison (1)

Basic Architecture and Concepts Feature ROS1 ROS2 Communication Middleware Custom TCPROS/UDPROS DDS (Data Distribution Service) Master Node Required ( roscore ) No master needed (distributed discovery) Operating Systems Primary: Ubuntu Linux Limited: Windows, macOS Full support for Linux, Windows, macOS Real-time Support Limited Improved with DDS and QoS policies Multi-robot Systems Requires network configuration Native multi-domain support Security Limited Built-in security with DDS (authentication, encryption) Scalability Limited by single master Improved with distributed architecture Package Management and Creation Feature ROS1 ROS2 Package Creation Command catkin_create_pkg <pkg_name> [dependencies] ros2 pkg create --build-type ament_cmake/ament_python <pkg_nam...