Skip to content

[launch] add concept of Conditions #105

@wjwwood

Description

@wjwwood

The concept of a "Condition" is a predicate that applies to certain kinds of entities like (but not exclusively) launch.Action.

This is the equivalent of if and unless attributes in roslaunch from ROS 1:

https://wiki.ros.org/roslaunch/XML#if_and_unless_attributes

The proposed launch.Condition would:

  • take a predicate which would be a list of substitutions
  • convert the list of substitutions into a string when the associated entity is visited
  • evaluate the resulting predicate string for true/false

There could be sub classes for convenience like launch.IfCondition and launch.UnlessCondition.

Conditions will need to be part of the interface of any entity which can be affected by them (i.e. either Action or LaunchDescriptionEntity should have a condition argument to the constructor.

One thing I haven't decided on is how to combine multiple conditions, the options are:

  • only ever take one condition, require compound conditions to be evaluated with Substitutions like launch.substitutions.PythonExpression
  • take a list of conditions, and do a boolean 'and' across all of them
  • take only one condition, but have additional convenience classes based on Condition, like CompoundCondition or AndCondition/OrCondition.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions