Skip to content

Commit

Permalink
Simplify use of argument paused
Browse files Browse the repository at this point in the history
... avoiding code duplication
  • Loading branch information
rhaschke committed Oct 27, 2021
1 parent 7c14577 commit 716277c
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions franka_gazebo/launch/panda.launch
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

<include file="$(find gazebo_ros)/launch/empty_world.launch" if="$(arg gazebo)">
<arg name="world_name" value="$(arg world)"/>
<!-- Always start in paused mode, and only unpause when spawning the model -->
<arg name="paused" value="true"/>
<arg name="gui" value="$(eval not arg('headless'))"/>
<arg name="use_sim_time" value="true"/>
Expand All @@ -49,23 +50,10 @@
<rosparam file="$(find franka_gazebo)/config/franka_hw_sim.yaml" subst_value="true" />
<rosparam file="$(find franka_gazebo)/config/sim_controllers.yaml" subst_value="true" />

<node name="$(arg arm_id)_model_spawner"
pkg="gazebo_ros"
type="spawn_model"
if="$(arg paused)"
args="-param robot_description -urdf -model $(arg arm_id)
$(arg initial_joint_positions)
">
</node>
<node name="$(arg arm_id)_model_spawner"
pkg="gazebo_ros"
type="spawn_model"
unless="$(arg paused)"
args="-param robot_description -urdf -model $(arg arm_id) -unpause
$(arg initial_joint_positions)
">
</node>

<arg name="unpause" value="$(eval '' if arg('paused') else '-unpause')" />
<node name="model_spawner" pkg="gazebo_ros" type="spawn_model"
args="-param robot_description -urdf -model $(arg arm_id) $(arg unpause)
$(arg initial_joint_positions)"/>

<!-- Spawn required ROS controllers -->
<node pkg="controller_manager"
Expand Down

0 comments on commit 716277c

Please sign in to comment.