diff --git a/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py b/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py index 3149250b..bd931698 100644 --- a/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py +++ b/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py @@ -64,19 +64,26 @@ def __init__( self.__container_name = container_name self.__namespace = namespace - # This is here to allow using strings or booleans as values for boolean variables when the Action is used from Python - # i.e., this allows users to do: + # This is here to allow using strings or booleans as values for boolean variables when + # the Action is used from Python i.e., this allows users to do: # RosGzBridge(bridge_name='bridge1', use_composition='true', create_own_container=True) - # Note that use_composition is set to a string while create_own_container is set to a boolean. The reverse would also work. - # At some point, we might want to deprecate this and only allow setting booleans since that's - # what users would expect when calling this from Python + # Note that use_composition is set to a string while create_own_container is set to a + # boolean. The reverse would also work. + # At some point, we might want to deprecate this and only allow setting booleans since + # that's what users would expect when calling this from Python if isinstance(create_own_container, str): - self.__create_own_container = normalize_typed_substitution(TextSubstitution(text=create_own_container), bool) + self.__create_own_container = normalize_typed_substitution( + TextSubstitution(text=create_own_container), bool + ) else: - self.__create_own_container = normalize_typed_substitution(create_own_container, bool) + self.__create_own_container = normalize_typed_substitution( + create_own_container, bool + ) if isinstance(use_composition, str): - self.__use_composition = normalize_typed_substitution(TextSubstitution(text=use_composition), bool) + self.__use_composition = normalize_typed_substitution( + TextSubstitution(text=use_composition), bool + ) else: self.__use_composition = normalize_typed_substitution(use_composition, bool) @@ -87,7 +94,7 @@ def __init__( @classmethod def parse(cls, entity: Entity, parser: Parser): """Parse ros_gz_bridge.""" - kwargs:Dict = super().parse(entity, parser)[1] + kwargs: Dict = super().parse(entity, parser)[1] bridge_name = entity.get_attr( 'bridge_name', data_type=str, @@ -183,8 +190,12 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: bridge_params_pairs = simplified_bridge_params.split(',') parsed_bridge_params = dict(pair.split(':') for pair in bridge_params_pairs) - use_composition_eval = perform_typed_substitution(context, self.__use_composition, bool) - create_own_container_eval = perform_typed_substitution(context, self.__create_own_container, bool) + use_composition_eval = perform_typed_substitution( + context, self.__use_composition, bool + ) + create_own_container_eval = perform_typed_substitution( + context, self.__create_own_container, bool + ) launch_descriptions: List[Action] = [] diff --git a/ros_gz_sim/ros_gz_sim/actions/gzserver.py b/ros_gz_sim/ros_gz_sim/actions/gzserver.py index 975a7883..7e3ee3d3 100644 --- a/ros_gz_sim/ros_gz_sim/actions/gzserver.py +++ b/ros_gz_sim/ros_gz_sim/actions/gzserver.py @@ -114,23 +114,28 @@ def __init__( self.__world_sdf_string = world_sdf_string self.__container_name = container_name - - # This is here to allow using strings or booleans as values for boolean variables when the Action is used from Python - # See the RosGzBridge.__init__ function for more details. + # This is here to allow using strings or booleans as values for boolean variables when + # the Action is used from Python See the RosGzBridge.__init__ function for more details. if isinstance(create_own_container, str): - self.__create_own_container = normalize_typed_substitution(TextSubstitution(text=create_own_container), bool) + self.__create_own_container = normalize_typed_substitution( + TextSubstitution(text=create_own_container), bool + ) else: - self.__create_own_container = normalize_typed_substitution(create_own_container, bool) + self.__create_own_container = normalize_typed_substitution( + create_own_container, bool + ) if isinstance(use_composition, str): - self.__use_composition = normalize_typed_substitution(TextSubstitution(text=use_composition), bool) + self.__use_composition = normalize_typed_substitution( + TextSubstitution(text=use_composition), bool + ) else: self.__use_composition = normalize_typed_substitution(use_composition, bool) @classmethod def parse(cls, entity: Entity, parser: Parser): """Parse gz_server.""" - kwargs:Dict = super().parse(entity, parser)[1] + kwargs: Dict = super().parse(entity, parser)[1] world_sdf_file = entity.get_attr( 'world_sdf_file', data_type=str, @@ -177,7 +182,6 @@ def parse(cls, entity: Entity, parser: Parser): def execute(self, context: LaunchContext) -> Optional[List[Action]]: """Execute the action.""" - launch_descriptions: List[Action] = [] model_paths, plugin_paths = GazeboRosPaths.get_paths() @@ -195,8 +199,12 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: model_paths, ]))) - use_composition_eval = perform_typed_substitution(context, self.__use_composition, bool) - create_own_container_eval = perform_typed_substitution(context, self.__create_own_container, bool) + use_composition_eval = perform_typed_substitution( + context, self.__use_composition, bool + ) + create_own_container_eval = perform_typed_substitution( + context, self.__create_own_container, bool + ) if not use_composition_eval: # Standard node configuration launch_descriptions.append(Node(