小技巧

Difference between DeclareLaunchArgument and LaunchConfiguration

https://answers.ros.org/question/322874/ros2-what-is-different-between-declarelaunchargument-and-launchconfiguration/

LaunchConfiguration is local to the launch file and scoped.

DeclareLaunchArgument allows you to expose the argument outside of your launch file. Allowing them to be listed, set, or marked as required when a user launches it from the command line (using ros2 launch) or when including it from another launch file (using IncludeLaunchDescription).

"right way" to delete a subcriber/publisher in rclpy

https://answers.ros.org/question/366778/how-to-delete-a-subcriberpublisher-in-rclpy/

Using node.destroy_subscription(subscription) is the "right way" to do things.

这个函数在内部将被 destory 的目标从 nodeexecutor 中移除, 避免在 executor.spin() 时继续调用已经被 destory 的对象。 因此不要使用 subscription.destory()

Difference between ament_export_dependencies and ament_export_interfaces

https://answers.ros.org/question/331277/ament_cmake-confused-about-ament_export_dependencies-and-ament_export_interfaces/

In short, ament_target_dependencies() sets up stuff for your package, ament_export_dependencies() and ament_export_interfaces() set up stuff for packages that depend on your package.