@@ -96,6 +96,7 @@ def __init__(
9696 create_own_container : Union [bool , SomeSubstitutionsType ] = False ,
9797 use_composition : Union [bool , SomeSubstitutionsType ] = False ,
9898 initial_sim_time : Union [float , SomeSubstitutionsType ] = 0.0 ,
99+ verbosity_level : Union [int , SomeSubstitutionsType ] = 4 ,
99100 ** kwargs
100101 ) -> None :
101102 """
@@ -109,6 +110,8 @@ def __init__(
109110 :param: container_name Name of container that nodes will load in if use composition.
110111 :param: create_own_container Whether to start a ROS container when using composition.
111112 :param: use_composition Use composed bringup if True.
113+ :param: initial_sim_time: The initial simulation time.
114+ :param: verbosity_level: The verbosity level of the Gazebo server (0=FATAL, 4=DEBUG).
112115 """
113116 super ().__init__ (** kwargs )
114117 self .__world_sdf_file = world_sdf_file
@@ -140,6 +143,13 @@ def __init__(
140143 else :
141144 self .__initial_sim_time = normalize_typed_substitution (initial_sim_time , float )
142145
146+ if isinstance (verbosity_level , str ):
147+ self .__verbosity_level = normalize_typed_substitution (
148+ TextSubstitution (text = verbosity_level ), int
149+ )
150+ else :
151+ self .__verbosity_level = normalize_typed_substitution (verbosity_level , int )
152+
143153 @classmethod
144154 def parse (cls , entity : Entity , parser : Parser ):
145155 """Parse gz_server."""
@@ -169,6 +179,10 @@ def parse(cls, entity: Entity, parser: Parser):
169179 'initial_sim_time' , data_type = str ,
170180 optional = True )
171181
182+ verbosity_level = entity .get_attr (
183+ 'verbosity_level' , data_type = str ,
184+ optional = True )
185+
172186 if isinstance (world_sdf_file , str ):
173187 world_sdf_file = parser .parse_substitution (world_sdf_file )
174188 kwargs ['world_sdf_file' ] = world_sdf_file
@@ -194,6 +208,10 @@ def parse(cls, entity: Entity, parser: Parser):
194208 initial_sim_time = parser .parse_substitution (initial_sim_time )
195209 kwargs ['initial_sim_time' ] = initial_sim_time
196210
211+ if isinstance (verbosity_level , str ):
212+ verbosity_level = parser .parse_substitution (verbosity_level )
213+ kwargs ['verbosity_level' ] = verbosity_level
214+
197215 return cls , kwargs
198216
199217 def execute (self , context : LaunchContext ) -> Optional [List [Action ]]:
@@ -229,7 +247,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
229247 output = 'screen' ,
230248 parameters = [{'world_sdf_file' : self .__world_sdf_file ,
231249 'world_sdf_string' : self .__world_sdf_string ,
232- 'initial_sim_time' : self .__initial_sim_time }],
250+ 'initial_sim_time' : self .__initial_sim_time ,
251+ 'verbosity_level' : self .__verbosity_level }],
233252 ))
234253
235254 # Composable node with container configuration
@@ -246,7 +265,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
246265 name = 'gz_server' ,
247266 parameters = [{'world_sdf_file' : self .__world_sdf_file ,
248267 'world_sdf_string' : self .__world_sdf_string ,
249- 'initial_sim_time' : self .__initial_sim_time }],
268+ 'initial_sim_time' : self .__initial_sim_time ,
269+ 'verbosity_level' : self .__verbosity_level }],
250270 extra_arguments = [{'use_intra_process_comms' : True }],
251271 ),
252272 ],
@@ -264,7 +284,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
264284 name = 'gz_server' ,
265285 parameters = [{'world_sdf_file' : self .__world_sdf_file ,
266286 'world_sdf_string' : self .__world_sdf_string ,
267- 'initial_sim_time' : self .__initial_sim_time }],
287+ 'initial_sim_time' : self .__initial_sim_time ,
288+ 'verbosity_level' : self .__verbosity_level }],
268289 extra_arguments = [{'use_intra_process_comms' : True }],
269290 ),
270291 ],
0 commit comments