Skip to content

Commit

Permalink
Remove default_value for required arguments (gazebosim#602)
Browse files Browse the repository at this point in the history
* Remove default_value for config_file
Signed-off-by: Aarav Gupta <[email protected]>
  • Loading branch information
Amronos committed Sep 12, 2024
1 parent 9fae54b commit e4b4871
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion ros_gz_bridge/launch/ros_gz_bridge.launch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<launch>
<arg name="bridge_name" />
<arg name="config_file" default="" />
<arg name="config_file" />
<arg name="container_name" default="ros_gz_container" />
<arg name="namespace" default="" />
<arg name="use_composition" default="True" />
Expand Down
2 changes: 1 addition & 1 deletion ros_gz_bridge/launch/ros_gz_bridge.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def generate_launch_description():
)

declare_config_file_cmd = DeclareLaunchArgument(
'config_file', default_value='', description='YAML config file'
'config_file', description='YAML config file'
)

declare_container_name_cmd = DeclareLaunchArgument(
Expand Down
4 changes: 2 additions & 2 deletions ros_gz_sim/launch/gz_spawn_model.launch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<arg name="world" default="" />
<arg name="file" default="" />
<arg name="xml_string" default="" />
<arg name="world_string" default="" />
<arg name="topic" default="" />
<arg name="entity_name" default="" />
<arg name="allow_renaming" default="False" />
Expand All @@ -14,7 +14,7 @@
<gz_spawn_model
world="$(var world)"
file="$(var file)"
xml_string="$(var xml_string)"
world_string="$(var world_string)"
topic="$(var topic)"
entity_name="$(var entity_name)"
allow_renaming="$(var allow_renaming)"
Expand Down
10 changes: 5 additions & 5 deletions ros_gz_sim/launch/gz_spawn_model.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def generate_launch_description():

world = LaunchConfiguration('world')
file = LaunchConfiguration('file')
xml_string = LaunchConfiguration('string')
world_string = LaunchConfiguration('world_string')
topic = LaunchConfiguration('topic')
entity_name = LaunchConfiguration('entity_name')
allow_renaming = LaunchConfiguration('allow_renaming')
Expand All @@ -41,8 +41,8 @@ def generate_launch_description():
declare_file_cmd = DeclareLaunchArgument(
'file', default_value=TextSubstitution(text=''),
description='SDF filename')
declare_xml_string_cmd = DeclareLaunchArgument(
'string',
declare_world_string_cmd = DeclareLaunchArgument(
'world_string',
default_value='',
description='XML string',
)
Expand All @@ -65,7 +65,7 @@ def generate_launch_description():
output='screen',
parameters=[{'world': world,
'file': file,
'string': xml_string,
'string': world_string,
'topic': topic,
'name': entity_name,
'allow_renaming': allow_renaming,
Expand All @@ -84,7 +84,7 @@ def generate_launch_description():
# Declare the launch options
ld.add_action(declare_world_cmd)
ld.add_action(declare_file_cmd)
ld.add_action(declare_xml_string_cmd)
ld.add_action(declare_world_string_cmd)
ld.add_action(declare_topic_cmd)
ld.add_action(declare_entity_name_cmd)
ld.add_action(declare_allow_renaming_cmd)
Expand Down
2 changes: 1 addition & 1 deletion ros_gz_sim/launch/ros_gz_sim.launch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<launch>
<arg name="bridge_name" />
<arg name="config_file" default="" />
<arg name="config_file" />
<arg name="container_name" default="ros_gz_container" />
<arg name="namespace" default="" />
<arg name="use_composition" default="True" />
Expand Down
4 changes: 2 additions & 2 deletions ros_gz_sim/launch/ros_gz_sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def generate_launch_description():
world_sdf_string = LaunchConfiguration('world_sdf_string')

declare_bridge_name_cmd = DeclareLaunchArgument(
'bridge_name', default_value='', description='Name of the bridge'
'bridge_name', description='Name of the bridge'
)

declare_config_file_cmd = DeclareLaunchArgument(
'config_file', default_value='', description='YAML config file'
'config_file', description='YAML config file'
)

declare_container_name_cmd = DeclareLaunchArgument(
Expand Down
14 changes: 7 additions & 7 deletions ros_gz_sim/launch/ros_gz_spawn_model.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_launch_description():

world = LaunchConfiguration('world')
file = LaunchConfiguration('file')
xml_string = LaunchConfiguration('string')
world_string = LaunchConfiguration('world_string')
topic = LaunchConfiguration('topic')
entity_name = LaunchConfiguration('entity_name')
allow_renaming = LaunchConfiguration('allow_renaming')
Expand All @@ -45,11 +45,11 @@ def generate_launch_description():
yaw = LaunchConfiguration('Y', default='0.0')

declare_bridge_name_cmd = DeclareLaunchArgument(
'bridge_name', default_value='', description='Name of the bridge'
'bridge_name', description='Name of the bridge'
)

declare_config_file_cmd = DeclareLaunchArgument(
'config_file', default_value='', description='YAML config file'
'config_file', description='YAML config file'
)

declare_container_name_cmd = DeclareLaunchArgument(
Expand Down Expand Up @@ -84,8 +84,8 @@ def generate_launch_description():
'file', default_value=TextSubstitution(text=''),
description='SDF filename')

declare_xml_string_cmd = DeclareLaunchArgument(
'string',
declare_world_string_cmd = DeclareLaunchArgument(
'world_string',
default_value='',
description='XML string',
)
Expand Down Expand Up @@ -125,7 +125,7 @@ def generate_launch_description():
'gz_spawn_model.launch.py'])]),
launch_arguments=[('world', world),
('file', file),
('xml_string', xml_string),
('world_string', world_string),
('topic', topic),
('entity_name', entity_name),
('allow_renaming', allow_renaming),
Expand All @@ -149,7 +149,7 @@ def generate_launch_description():
ld.add_action(declare_log_level_cmd)
ld.add_action(declare_world_cmd)
ld.add_action(declare_file_cmd)
ld.add_action(declare_xml_string_cmd)
ld.add_action(declare_world_string_cmd)
ld.add_action(declare_topic_cmd)
ld.add_action(declare_entity_name_cmd)
ld.add_action(declare_allow_renaming_cmd)
Expand Down
18 changes: 9 additions & 9 deletions ros_gz_sim/ros_gz_sim/actions/gz_spawn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
*,
world: Optional[SomeSubstitutionsType] = None,
file: Optional[SomeSubstitutionsType] = None,
xml_string: Optional[SomeSubstitutionsType] = None,
world_string: Optional[SomeSubstitutionsType] = None,
topic: Optional[SomeSubstitutionsType] = None,
entity_name: Optional[SomeSubstitutionsType] = None,
allow_renaming: Optional[SomeSubstitutionsType] = None,
Expand All @@ -56,7 +56,7 @@ def __init__(
:param: world World name.
:param: file SDF filename.
:param: xml_string XML string.
:param: world_string XML string.
:param: topic Get XML from this topic.
:param: entity_name Name of the entity.
:param: allow_renaming Whether the entity allows renaming or not.
Expand All @@ -70,7 +70,7 @@ def __init__(
super().__init__(**kwargs)
self.__world = world
self.__file = file
self.__xml_string = xml_string
self.__world_string = world_string
self.__topic = topic
self.__entity_name = entity_name
self.__allow_renaming = allow_renaming
Expand All @@ -94,8 +94,8 @@ def parse(cls, entity: Entity, parser: Parser):
'file', data_type=str,
optional=True)

xml_string = entity.get_attr(
'xml_string', data_type=str,
world_string = entity.get_attr(
'world_string', data_type=str,
optional=True)

topic = entity.get_attr(
Expand Down Expand Up @@ -142,9 +142,9 @@ def parse(cls, entity: Entity, parser: Parser):
file = parser.parse_substitution(file)
kwargs['file'] = file

if isinstance(xml_string, str):
xml_string = parser.parse_substitution(xml_string)
kwargs['xml_string'] = xml_string
if isinstance(world_string, str):
world_string = parser.parse_substitution(world_string)
kwargs['world_string'] = world_string

if isinstance(topic, str):
topic = parser.parse_substitution(topic)
Expand Down Expand Up @@ -193,7 +193,7 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
'gz_spawn_model.launch.py'])]),
launch_arguments=[('world', self.__world),
('file', self.__file),
('xml_string', self.__xml_string),
('world_string', self.__world_string),
('topic', self.__topic),
('entity_name', self.__entity_name),
('allow_renaming', self.__allow_renaming),
Expand Down

0 comments on commit e4b4871

Please sign in to comment.