You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/execute_process_refactor.md
+88-45Lines changed: 88 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -347,7 +347,7 @@ It would not inherit from any other class, and would have a subset of the fields
347
347
348
348
#### Constructor
349
349
350
-
These parameters are drawn from the shared parameters of the current `launch_ros.actions.Node` and `launch_ros.descriptions.ComposableNode`.
350
+
These parameters are drawn from the shared parameters of the current `launch_ros.actions.Node` and `launch_ros.descriptions.ComposableNode`, and introduces a new collection of `traits`, described in following classes.
@@ -357,10 +357,11 @@ These parameters are drawn from the shared parameters of the current `launch_ros
357
357
| parameters | List of either paths to yaml files or dictionaries of parameters |
358
358
| remappings | List of from/to pairs for remapping names |
359
359
| arguments | Container specific arguments to be passed to the node |
360
+
| traits | Additional features of the node, specifically Lifecycle or Composable information|
360
361
361
362
#### Properties
362
363
363
-
Accessors would be provided for the various constructor parameters: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, and `arguments`.
364
+
Accessors would be provided for the various constructor parameters: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`, and `traits`.
364
365
365
366
#### Methods
366
367
@@ -369,26 +370,75 @@ To support better isolation of class functionality, substitutions will be perfor
| prepare | Takes a given LaunchContext and Action, and performs actions necessary to prepare the node for execution in that context. This will primarily consist of expanding various substitutions, but may additionally add event handlers related to the Action which will be invoked. |
373
+
| prepare | Takes a given LaunchContext and Action, and performs actions necessary to prepare the node for execution in that context. This will primarily consist of expanding various substitutions, but may additionally add event handlers related to the Action which will be invoked. Additionally, this will call the `prepare()` method of any defined traits. |
373
374
374
375
This function would match that of the current `launch_ros.actions.Node` internal method `_perform_substitutions`.
375
376
376
377
#### Events
377
378
378
379
No events would be handled or emitted.
379
380
380
-
### launch_ros.descriptions.LifecycleNode
381
+
### launch_ros.descriptions.ComposableNode
381
382
382
-
This class would extend the `launch_ros.descriptions.Node` class, and provide the additional functionality required for managing lifecycle node events that are currently defined in `launch_ros.actions.LifecycleNode`.
383
+
This class would extend the `launch_ros.descriptions.Node` class, and provide the additional information required for defining a node which can be launched in a composable context.
383
384
384
385
#### Constructor
385
386
386
-
No additional constructor parameters are defined in this class.
387
-
All parameters which are handled by `launch_ros.descriptions.Node` may be passed to the constructor: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, and `arguments`.
387
+
Most parameters would be passed to the superclass.
388
+
389
+
|Argument|Description|
390
+
|---|---|
391
+
|node_plugin|Name of the plugin to be loaded|
392
+
393
+
Additional parameters that may be passed, which are handled by `launch_ros.descriptions.NodeBase`: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`, `traits`.
388
394
389
395
#### Properties
390
396
391
-
Constructor properties available from ``launch_ros.descriptions.Node`` are inherited: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, and `arguments`.
397
+
Accessors would be provided for the additional constructor parameter: `node_plugin`.
398
+
Inherited accessors would also be available: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`, and `traits`.
399
+
400
+
#### Methods
401
+
402
+
No methods would be defined or overridden.
403
+
404
+
#### Events
405
+
406
+
No events would be handled or emitted.
407
+
408
+
### launch_ros.traits.NodeTrait
409
+
This abstract class would not extend any others, and would provide a common interface to allow definition of traits which apply to `launch_ros.descriptions.Node` objects.
410
+
411
+
#### Constructor
412
+
413
+
This constructor would take no parameters, and should not be used directly.
414
+
415
+
#### Properties
416
+
417
+
This object would expose no properties.
418
+
419
+
#### Methods
420
+
421
+
To allow a trait to perform its actions, the `prepare()` method will be called prior to execution.
| prepare | Abstract method which takes a given Node, LaunchContext, and Action, and performs actions necessary to prepare the node for execution in that context.|
426
+
427
+
#### Events
428
+
429
+
No events would be handled or emitted.
430
+
431
+
### launch_ros.traits.HasLifecycle
432
+
433
+
This class would extend the `launch_ros.traits.NodeTrait` class, and provide the additional functionality required for managing lifecycle node events that are currently defined in `launch_ros.actions.LifecycleNode`.
434
+
435
+
#### Constructor
436
+
437
+
The constructor for this trait would take no parameters, as it serves only to assert that the ROS2 Lifecycle events are implemented by the `launch_ros.descriptions.Node`, and appropriate events should be managed.
438
+
439
+
#### Properties
440
+
441
+
This object would expose no properties.
392
442
393
443
#### Methods
394
444
@@ -410,57 +460,47 @@ Constructor properties available from ``launch_ros.descriptions.Node`` are inher
|`launch.events.lifecycle.StateTransition`| This event is emitted when a message is published to the "`/<node_name>/transition_event`" topic, indicating the lifecycle node represented by this action changed state |
412
462
413
-
### launch_ros.descriptions.ExecutableNode
463
+
### launch_ros.traits.ComposesNodes
414
464
415
-
This class would represent the information required to define a node which might be run as a single executable.
416
-
It would inherit from `launch.descriptions.Executable`, contain a `launch_ros.descriptions.Node`, and populate its fields in the same manner as the current `launch_ros.actions.Node`.
465
+
This class would extend the `launch_ros.traits.NodeTrait` class, and provide the additional information required for launching composable nodes that are currently defined in `launch_ros.descriptions.ComposableNode`.
417
466
418
467
#### Constructor
419
468
420
-
These parameters are drawn from the current `launch_ros.actions.Node`.
421
-
422
-
REQUEST FOR COMMENT: Currently, this calls out the node as a `launch_ros.descriptions.Node` object parameter; would this be better styled by accepting a flat list to make the inner Node less visible to users?
| node_executable | The name of the executable to find if a package is provided or otherwise a path to the executable to run. |
427
-
| node | The `launch_ros.descriptions.Node` (or subclass thereof) which is being run. |
469
+
Most parameters would be passed to the new superclass.
428
470
429
-
Most parameters which are handled by `launch.descriptions.Executable` may be passed to the constructor: `name`, `cwd`, `env`, and `additional_env`.
430
-
Note that the `cmd` parameter would *not* be passed through; the command would be constructed per ROS Node execution context.
471
+
|Argument|Description|
472
+
|---|---|
473
+
|nodes|Collection of `launch_ros.descriptions.ComposableNode` objects that should be launched inside the `launch_ros.descriptions.Node` with this trait.|
431
474
432
475
#### Properties
433
476
434
-
Accessors would be provided for the various constructor parameters: `node_executable` and `node`.
435
-
Inherited accessors would also be available: `cmd`, `name`, `cwd`, `env`, and `additional_env`.
477
+
Accessors would be provided for the constructor parameter: `nodes`.
436
478
437
479
#### Methods
438
480
439
-
This class would override the `apply_context` method of `launch.descriptions.Executable` to additionally invoke the `apply_context` method of the `launch_ros.descriptions.Node`, then invoke the superclass method itself.
440
-
This function would match that of the current `launch_ros.actions.Node` internal method `_perform_substitutions`.
| prepare | Overridden. Adds an event handler to launch the defined composable nodes in the container once the container is started. |
441
484
442
485
#### Events
443
486
444
487
No events would be handled or emitted.
445
488
446
-
### launch_ros.descriptions.ComposableNode
489
+
### launch_ros.traits.IsExecutable
447
490
448
-
This class would be modified to inherit from `launch_ros.descriptions.Node`.
491
+
This class would extend the `launch_ros.traits.NodeTrait` class, and provide the additional information required for launching executable nodes that are currently defined in `launch_ros.actions.Node`.
449
492
450
493
#### Constructor
451
494
452
495
Most parameters would be passed to the new superclass.
453
496
454
497
|Argument|Description|
455
498
|---|---|
456
-
|node_plugin|Name of the plugin to be loaded|
457
-
458
-
Additional parameters that may be passed, which are handled by `launch_ros.descriptions.Node`: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, `arguments`.
499
+
|node_executable|Name of the executable to find|
459
500
460
501
#### Properties
461
502
462
-
Accessors would be provided for the additional constructor parameter: `node_plugin`.
463
-
Inherited accessors would also be available: `package`, `node_name`, `node_namespace`, `parameters`, `remappings`, and `arguments`.
503
+
Accessors would be provided for the constructor parameter: `node_exectuable`.
464
504
465
505
#### Methods
466
506
@@ -470,33 +510,36 @@ No custom methods would be defined or overridden.
This class would extend the `launch_ros.descriptions.ExecutableNode` class, and provide the additional functionality required for loading multiple nodes into a single container.
515
+
This class would represent the information required to run a ROS-aware process and inherit from `launch.descriptions.Executable`.
516
+
It would not include execution-time details, nor provide monitoring of the process after launch.
476
517
477
518
#### Constructor
478
519
479
-
The description of the composable node container itself should be provided as the parameters passed to ``launch_ros.descriptions.ExecutableNode``; child nodes would be provided as an additional constructor parameter.
| nodes | A list of `launch_ros.descriptions.Node` objects which are part of the executable. |
484
523
485
-
All parameters which are handled by ``launch_ros.descriptions.ExecutableNode`` may be passed to the constructor: `node_executable`, `node`, `name`, `cwd`, `env`, and `additional_env`.
524
+
Additional parameters that may be passed, which are handled by `launch.actions.ExecuteProcess`: `cmd`, `name`, `cwd`, `env`, `additional_env`.
525
+
NOTE: To allow ROS to determine the appropriate executable based on the package and executable name, the `cmd` parameter should *NOT* be specified. When `cmd` is not specified, this class will determine the appropriate executable if and only if exactly one of the nodes it contains has the `launch_ros.traits.IsExecutable` trait.
486
526
487
527
#### Properties
488
528
489
-
Properties available from ``launch_ros.descriptions.ExecutableNode`` are inherited: `process_details`, along with constructor parameters for `process_description`, `shell`, and `output`.
529
+
Accessors would be provided for the constructor parameter: `nodes`.
530
+
Inherited accessors would also be available: `cmd`, `name`, `cwd`, `env`, and `additional_env`.
| prepare | Overridden. Calls the superclass to prepare node-related information, calls `prepare` on each composable node, and adds actions to the target Action to load the contained nodes once the process is started, then calls the superclass to execute the parsed command. |
| apply\_context | Overridden. Calls `prepare()` on each `launch_ros.descriptions.Node`, and determines the appropriate executable if necessary. |
537
+
538
+
In constructing the command line parameters for execution, if more than one node is defined, all appropriate parameters will be prefixed with the node name as necessary.
496
539
497
540
#### Events
498
541
499
-
Inherits events from `launch.actions.ExecuteLocalProcess`, but does not define any additional events.
0 commit comments