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 0c324a0 commit a9f5607
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 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)"
<node name="model_spawner" pkg="gazebo_ros" type="spawn_model"
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>

$(eval '' if arg('paused') else '-unpause')
$(arg initial_joint_positions)"/>

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

0 comments on commit a9f5607

Please sign in to comment.