16 from launch
import LaunchContext
17 from launch.substitutions
import LaunchConfiguration
18 from launch.utilities
import perform_substitutions
23 Converts a LaunchConfiguration value into a normalized boolean string: 'true' or 'false'.
25 Allows CLI arguments like 'True', 'true', '1', 'yes' and 'False', 'false', '0', 'no'.
26 Returns a string 'true' or 'false' for use in PythonExpression and IfCondition contexts.
29 def __init__(self, name: str) ->
None:
31 self.
_config_config = LaunchConfiguration(name)
33 def perform(self, context: LaunchContext) -> str:
34 value = perform_substitutions(context, [self.
_config_config])
35 if value.strip().lower()
in [
'true',
'1',
'yes',
'on']:
39 def describe(self) -> str:
40 return f
'LaunchConfigAsBool({self._config.describe()})'