@@ -28,9 +28,13 @@ unsafe impl Send for rcl_node_t {}
2828/// Nodes are a core concept in ROS 2. Refer to the official ["Understanding ROS 2 nodes"][1]
2929/// tutorial for an introduction.
3030///
31- /// Ownership of the node is shared with all [`Publisher`]s and [`Subscription`]s created from it.
32- /// That means that even after the node itself is dropped, it will continue to exist and be
33- /// displayed by e.g. `ros2 topic` as long as its publishers and subscriptions are not dropped.
31+ /// Ownership of the node is shared with all the primitives such as [`Publisher`]s and [`Subscription`]s
32+ /// that are created from it. That means that even after the `Node` itself is dropped, it will continue
33+ /// to exist and be displayed by e.g. `ros2 topic` as long as any one of its primitives is not dropped.
34+ ///
35+ /// # Creating
36+ /// Use [`Executor::create_node`][7] to create a new node. Pass in [`NodeOptions`] to set all the different
37+ /// options for node creation, or just pass in a string for the node's name if the default options are okay.
3438///
3539/// # Naming
3640/// A node has a *name* and a *namespace*.
@@ -48,16 +52,19 @@ unsafe impl Send for rcl_node_t {}
4852/// In that sense, the parameters to the node creation functions are only the _default_ namespace and
4953/// name.
5054/// See also the [official tutorial][1] on the command line arguments for ROS nodes, and the
51- /// [`Node::namespace()`] and [`Node::name()`] functions for examples.
55+ /// [`Node::namespace()`][3] and [`Node::name()`][4 ] functions for examples.
5256///
5357/// ## Rules for valid names
5458/// The rules for valid node names and node namespaces are explained in
55- /// [`NodeBuilder ::new()`][3 ] and [`NodeBuilder ::namespace()`][4 ].
59+ /// [`NodeOptions ::new()`][5 ] and [`NodeOptions ::namespace()`][6 ].
5660///
5761/// [1]: https://docs.ros.org/en/rolling/Tutorials/Understanding-ROS2-Nodes.html
5862/// [2]: https://docs.ros.org/en/rolling/How-To-Guides/Node-arguments.html
59- /// [3]: crate::NodeBuilder::new
60- /// [4]: crate::NodeBuilder::namespace
63+ /// [3]: Node::namespace
64+ /// [4]: Node::name
65+ /// [5]: crate::NodeOptions::new
66+ /// [6]: crate::NodeOptions::namespace
67+ /// [7]: crate::Executor::create_node
6168#[ derive( Clone ) ]
6269pub struct Node {
6370 pub ( crate ) primitives : Arc < NodePrimitives > ,
@@ -213,12 +220,11 @@ impl Node {
213220 /// Creates a [`GuardCondition`][1] with no callback.
214221 ///
215222 /// A weak pointer to the `GuardCondition` is stored within this node.
216- /// When this node is added to a wait set (e.g. when calling `spin_once`[2]
217- /// with this node as an argument), the guard condition can be used to
218- /// interrupt the wait.
223+ /// When this node is added to a wait set (e.g. when its executor is [spinning][2]),
224+ /// the guard condition can be used to interrupt the wait.
219225 ///
220226 /// [1]: crate::GuardCondition
221- /// [2]: crate::spin_once
227+ /// [2]: crate::Executor::spin
222228 pub fn create_guard_condition ( & self ) -> Arc < GuardCondition > {
223229 let guard_condition = Arc :: new ( GuardCondition :: new_with_context_handle (
224230 Arc :: clone ( & self . handle . context_handle ) ,
@@ -232,12 +238,11 @@ impl Node {
232238 /// Creates a [`GuardCondition`][1] with a callback.
233239 ///
234240 /// A weak pointer to the `GuardCondition` is stored within this node.
235- /// When this node is added to a wait set (e.g. when calling `spin_once`[2]
236- /// with this node as an argument), the guard condition can be used to
237- /// interrupt the wait.
241+ /// When this node is added to a wait set (e.g. when its executor is [spinning][2]),
242+ /// the guard condition can be used to interrupt the wait.
238243 ///
239244 /// [1]: crate::GuardCondition
240- /// [2]: crate::spin_once
245+ /// [2]: crate::Executor::spin
241246 pub fn create_guard_condition_with_callback < F > ( & mut self , callback : F ) -> Arc < GuardCondition >
242247 where
243248 F : Fn ( ) + Send + Sync + ' static ,
@@ -254,7 +259,6 @@ impl Node {
254259 /// Creates a [`Publisher`][1].
255260 ///
256261 /// [1]: crate::Publisher
257- // TODO: make publisher's lifetime depend on node's lifetime
258262 pub fn create_publisher < T > (
259263 & self ,
260264 topic : & str ,
@@ -270,7 +274,6 @@ impl Node {
270274 /// Creates a [`Service`][1].
271275 ///
272276 /// [1]: crate::Service
273- // TODO: make service's lifetime depend on node's lifetime
274277 pub fn create_service < T , F > (
275278 & self ,
276279 topic : & str ,
@@ -293,7 +296,6 @@ impl Node {
293296 /// Creates a [`Subscription`][1].
294297 ///
295298 /// [1]: crate::Subscription
296- // TODO: make subscription's lifetime depend on node's lifetime
297299 pub fn create_subscription < T , Args > (
298300 & self ,
299301 topic : & str ,
0 commit comments