From 2d96be59be47a912dbfdfc16b7aa8128d105723a Mon Sep 17 00:00:00 2001
From: Johannes Mey <johannes.mey@tu-dresden.de>
Date: Fri, 15 May 2020 09:15:29 +0200
Subject: [PATCH] simplify launch files with reuse, fix README

---
 README.md                                     |  4 +-
 launch/constraint_simulation.launch           | 11 ++++
 launch/minimal_simulation.launch              |  7 +++
 launch/sample_constraint_simulation.launch    | 63 -------------------
 launch/sample_minimal_simulation.launch       | 57 -----------------
 launch/sample_simple_simulation.launch        | 63 -------------------
 .../sample_timed_cartesian_simulation.launch  | 63 -------------------
 launch/simple_simulation.launch               | 11 ++++
 launch/simulation.launch                      |  9 +++
 launch/timed_cartesian_simulation.launch      | 11 ++++
 10 files changed, 51 insertions(+), 248 deletions(-)
 create mode 100644 launch/constraint_simulation.launch
 create mode 100644 launch/minimal_simulation.launch
 delete mode 100644 launch/sample_constraint_simulation.launch
 delete mode 100644 launch/sample_minimal_simulation.launch
 delete mode 100644 launch/sample_simple_simulation.launch
 delete mode 100644 launch/sample_timed_cartesian_simulation.launch
 create mode 100644 launch/simple_simulation.launch
 create mode 100644 launch/simulation.launch
 create mode 100644 launch/timed_cartesian_simulation.launch

diff --git a/README.md b/README.md
index 74f4865..788e53d 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ In this example, an object can be observed in the RViz planning window. This obj
 
 ### Execution of a Velocity Constraint Cartesian Trajectory
 
-- Command: `roslaunch sample_applications simulation.launch`
+- Command: `roslaunch sample_applications timed_cartesian_simulation.launch`
 - Expected results:
     - A Gazebo window to observe the executed robot motion opens
     - An rqt window to show log messages opens
@@ -58,7 +58,7 @@ In this example, an object can be observed in the RViz planning window. This obj
 
 This is an example to use RViz and Gazebo interactively. Motions can be planned and executed from the RViz GUI.
 
-- Command: `roslaunch panda_simulation simulation.launch`
+- Command: `roslaunch sample_applications simulation.launch`
 - Expected results:
     - RViz window to control the robot
     - Gazebo window to observe the executed robot motion
diff --git a/launch/constraint_simulation.launch b/launch/constraint_simulation.launch
new file mode 100644
index 0000000..238a49a
--- /dev/null
+++ b/launch/constraint_simulation.launch
@@ -0,0 +1,11 @@
+<launch>
+
+    <include file="$(find panda_simulation)/launch/simulation.launch"/>
+
+    <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
+
+    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
+
+    <node pkg="sample_applications" type="SampleConstraintPlanner" name="SampleConstraintPlanner" />
+
+</launch>
diff --git a/launch/minimal_simulation.launch b/launch/minimal_simulation.launch
new file mode 100644
index 0000000..89e4593
--- /dev/null
+++ b/launch/minimal_simulation.launch
@@ -0,0 +1,7 @@
+<launch>
+
+    <include file="$(find panda_simulation)/launch/simulation.launch"/>
+
+    <node pkg="sample_applications" type="MinimalSimpleMotion" name="MinimalSimpleMotion" />
+
+</launch>
diff --git a/launch/sample_constraint_simulation.launch b/launch/sample_constraint_simulation.launch
deleted file mode 100644
index 6b03481..0000000
--- a/launch/sample_constraint_simulation.launch
+++ /dev/null
@@ -1,63 +0,0 @@
-<launch>
-    <param name="robot_description" command="$(find xacro)/xacro $(find franka_description)/robots/panda_arm_hand.urdf.xacro" />
-
-    <!-- GAZEBO arguments -->
-    <arg name="paused" default="false" />
-    <arg name="use_sim_time" default="true" />
-    <arg name="gui" default="true" />
-    <arg name="headless" default="false" />
-    <arg name="debug" default="false" />
-    <arg name="load_gripper" default="true" />
-
-    <!--launch GAZEBO with own world configuration -->
-    <include file="$(find gazebo_ros)/launch/empty_world.launch">
-        <!-- <arg name="world_name" value="$(find robotics_assisted_tomography)/worlds/tomography.world"/> -->
-        <arg name="debug" value="$(arg debug)" />
-        <arg name="gui" value="$(arg gui)" />
-        <arg name="paused" value="$(arg paused)" />
-        <arg name="use_sim_time" value="$(arg use_sim_time)" />
-        <arg name="headless" value="$(arg headless)" />
-    </include>
-
-    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
-    <!-- <node name="rqt_logger_level" pkg="rqt_logger_level" type="rqt_logger_level" /> -->
-
-    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model panda" />
-
-    <!-- Load joint controller configurations from YAML file to parameter server -->
-    <rosparam file="$(find panda_simulation)/config/panda_control.yaml" command="load" />
-
-
-    <!-- load the controllers -->
-    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller panda_arm_controller" />
-    <node if="$(arg load_gripper)" name="controller_spawner_hand" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="panda_hand_controller" />
-
-
-    <!-- convert joint states to TF transforms for rviz, etc -->
-    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
-
-    <include file="$(find panda_moveit_config)/launch/planning_context.launch">
-        <arg name="load_robot_description" value="true" />
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <include file="$(find panda_moveit_config)/launch/move_group.launch">
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <group if="$(arg gui)">
-        <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
-    </group>
-
-    <node name="joint_state_desired_publisher" pkg="topic_tools" type="relay" args="joint_states joint_states_desired" />
-
-    <!-- launch robot control node for moveit motion planning -->
-    <node pkg="panda_simulation" type="robot_control_node" name="robot_control_node" output="screen" />
-
-    <!-- load (not start!) custom joint position controller -->
-    <node pkg="controller_manager" type="spawner" name="joint_position_launcher" args="--stopped joint_position_controller" />
-
-    <!-- run custom node for automatic intialization -->
-    <node pkg="panda_simulation" type="robot_state_initializer_node" name="robot_state_initializer_node" />
-
-    <node pkg="sample_applications" type="SampleConstraintPlanner" name="SampleConstraintPlanner" />
-
-</launch>
diff --git a/launch/sample_minimal_simulation.launch b/launch/sample_minimal_simulation.launch
deleted file mode 100644
index f999a38..0000000
--- a/launch/sample_minimal_simulation.launch
+++ /dev/null
@@ -1,57 +0,0 @@
-<launch>
-    <param name="robot_description" command="$(find xacro)/xacro $(find franka_description)/robots/panda_arm_hand.urdf.xacro" />
-
-    <!-- GAZEBO arguments -->
-    <arg name="paused" default="false" />
-    <arg name="use_sim_time" default="true" />
-    <arg name="gui" default="true" />
-    <arg name="headless" default="false" />
-    <arg name="debug" default="false" />
-    <arg name="load_gripper" default="true" />
-
-    <!--launch GAZEBO with own world configuration -->
-    <include file="$(find gazebo_ros)/launch/empty_world.launch">
-        <!-- <arg name="world_name" value="$(find robotics_assisted_tomography)/worlds/tomography.world"/> -->
-        <arg name="debug" value="$(arg debug)" />
-        <arg name="gui" value="$(arg gui)" />
-        <arg name="paused" value="$(arg paused)" />
-        <arg name="use_sim_time" value="$(arg use_sim_time)" />
-        <arg name="headless" value="$(arg headless)" />
-    </include>
-
-    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model panda" />
-
-    <!-- Load joint controller configurations from YAML file to parameter server -->
-    <rosparam file="$(find panda_simulation)/config/panda_control.yaml" command="load" />
-
-
-    <!-- load the controllers -->
-    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller panda_arm_controller" />
-    <node if="$(arg load_gripper)" name="controller_spawner_hand" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="panda_hand_controller" />
-
-
-    <!-- convert joint states to TF transforms for rviz, etc -->
-    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
-
-    <include file="$(find panda_moveit_config)/launch/planning_context.launch">
-        <arg name="load_robot_description" value="true" />
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <include file="$(find panda_moveit_config)/launch/move_group.launch">
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-
-    <node name="joint_state_desired_publisher" pkg="topic_tools" type="relay" args="joint_states joint_states_desired" />
-
-    <!-- launch robot control node for moveit motion planning -->
-    <node pkg="panda_simulation" type="robot_control_node" name="robot_control_node" output="screen" />
-
-    <!-- load (not start!) custom joint position controller -->
-    <node pkg="controller_manager" type="spawner" name="joint_position_launcher" args="--stopped joint_position_controller" />
-
-    <!-- run custom node for automatic intialization -->
-    <node pkg="panda_simulation" type="robot_state_initializer_node" name="robot_state_initializer_node" />
-
-    <node pkg="sample_applications" type="SampleSimpleMotion" name="SampleSimpleMotion" />
-
-</launch>
diff --git a/launch/sample_simple_simulation.launch b/launch/sample_simple_simulation.launch
deleted file mode 100644
index a935914..0000000
--- a/launch/sample_simple_simulation.launch
+++ /dev/null
@@ -1,63 +0,0 @@
-<launch>
-    <param name="robot_description" command="$(find xacro)/xacro $(find franka_description)/robots/panda_arm_hand.urdf.xacro" />
-
-    <!-- GAZEBO arguments -->
-    <arg name="paused" default="false" />
-    <arg name="use_sim_time" default="true" />
-    <arg name="gui" default="true" />
-    <arg name="headless" default="false" />
-    <arg name="debug" default="false" />
-    <arg name="load_gripper" default="true" />
-
-    <!--launch GAZEBO with own world configuration -->
-    <include file="$(find gazebo_ros)/launch/empty_world.launch">
-        <!-- <arg name="world_name" value="$(find robotics_assisted_tomography)/worlds/tomography.world"/> -->
-        <arg name="debug" value="$(arg debug)" />
-        <arg name="gui" value="$(arg gui)" />
-        <arg name="paused" value="$(arg paused)" />
-        <arg name="use_sim_time" value="$(arg use_sim_time)" />
-        <arg name="headless" value="$(arg headless)" />
-    </include>
-
-    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
-    <!-- <node name="rqt_logger_level" pkg="rqt_logger_level" type="rqt_logger_level" /> -->
-
-    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model panda" />
-
-    <!-- Load joint controller configurations from YAML file to parameter server -->
-    <rosparam file="$(find panda_simulation)/config/panda_control.yaml" command="load" />
-
-
-    <!-- load the controllers -->
-    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller panda_arm_controller" />
-    <node if="$(arg load_gripper)" name="controller_spawner_hand" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="panda_hand_controller" />
-
-
-    <!-- convert joint states to TF transforms for rviz, etc -->
-    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
-
-    <include file="$(find panda_moveit_config)/launch/planning_context.launch">
-        <arg name="load_robot_description" value="true" />
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <include file="$(find panda_moveit_config)/launch/move_group.launch">
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <group if="$(arg gui)">
-        <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
-    </group>
-
-    <node name="joint_state_desired_publisher" pkg="topic_tools" type="relay" args="joint_states joint_states_desired" />
-
-    <!-- launch robot control node for moveit motion planning -->
-    <node pkg="panda_simulation" type="robot_control_node" name="robot_control_node" output="screen" />
-
-    <!-- load (not start!) custom joint position controller -->
-    <node pkg="controller_manager" type="spawner" name="joint_position_launcher" args="--stopped joint_position_controller" />
-
-    <!-- run custom node for automatic intialization -->
-    <node pkg="panda_simulation" type="robot_state_initializer_node" name="robot_state_initializer_node" />
-
-    <node pkg="sample_applications" type="SampleSimpleMotion" name="SampleSimpleMotion" />
-
-</launch>
diff --git a/launch/sample_timed_cartesian_simulation.launch b/launch/sample_timed_cartesian_simulation.launch
deleted file mode 100644
index e018620..0000000
--- a/launch/sample_timed_cartesian_simulation.launch
+++ /dev/null
@@ -1,63 +0,0 @@
-<launch>
-    <param name="robot_description" command="$(find xacro)/xacro $(find franka_description)/robots/panda_arm_hand.urdf.xacro" />
-
-    <!-- GAZEBO arguments -->
-    <arg name="paused" default="false" />
-    <arg name="use_sim_time" default="true" />
-    <arg name="gui" default="true" />
-    <arg name="headless" default="false" />
-    <arg name="debug" default="false" />
-    <arg name="load_gripper" default="true" />
-
-    <!--launch GAZEBO with own world configuration -->
-    <include file="$(find gazebo_ros)/launch/empty_world.launch">
-        <!-- <arg name="world_name" value="$(find robotics_assisted_tomography)/worlds/tomography.world"/> -->
-        <arg name="debug" value="$(arg debug)" />
-        <arg name="gui" value="$(arg gui)" />
-        <arg name="paused" value="$(arg paused)" />
-        <arg name="use_sim_time" value="$(arg use_sim_time)" />
-        <arg name="headless" value="$(arg headless)" />
-    </include>
-
-    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
-    <!-- <node name="rqt_logger_level" pkg="rqt_logger_level" type="rqt_logger_level" /> -->
-
-    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model panda" />
-
-    <!-- Load joint controller configurations from YAML file to parameter server -->
-    <rosparam file="$(find panda_simulation)/config/panda_control.yaml" command="load" />
-
-
-    <!-- load the controllers -->
-    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller panda_arm_controller" />
-    <node if="$(arg load_gripper)" name="controller_spawner_hand" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="panda_hand_controller" />
-
-
-    <!-- convert joint states to TF transforms for rviz, etc -->
-    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
-
-    <include file="$(find panda_moveit_config)/launch/planning_context.launch">
-        <arg name="load_robot_description" value="true" />
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <include file="$(find panda_moveit_config)/launch/move_group.launch">
-        <arg name="load_gripper" value="$(arg load_gripper)" />
-    </include>
-    <group if="$(arg gui)">
-        <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
-    </group>
-
-    <node name="joint_state_desired_publisher" pkg="topic_tools" type="relay" args="joint_states joint_states_desired" />
-
-    <!-- launch robot control node for moveit motion planning -->
-    <node pkg="panda_simulation" type="robot_control_node" name="robot_control_node" output="screen" />
-
-    <!-- load (not start!) custom joint position controller -->
-    <node pkg="controller_manager" type="spawner" name="joint_position_launcher" args="--stopped joint_position_controller" />
-
-    <!-- run custom node for automatic intialization -->
-    <node pkg="panda_simulation" type="robot_state_initializer_node" name="robot_state_initializer_node" />
-
-    <node pkg="sample_applications" type="SampleTimedCartesianPlanner" name="SampleTimedCartesianPlanner" />
-
-</launch>
diff --git a/launch/simple_simulation.launch b/launch/simple_simulation.launch
new file mode 100644
index 0000000..46e9206
--- /dev/null
+++ b/launch/simple_simulation.launch
@@ -0,0 +1,11 @@
+<launch>
+
+    <include file="$(find panda_simulation)/launch/simulation.launch"/>
+
+    <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
+
+    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
+
+    <node pkg="sample_applications" type="SampleSimpleMotion" name="SampleSimpleMotion" />
+
+</launch>
diff --git a/launch/simulation.launch b/launch/simulation.launch
new file mode 100644
index 0000000..adb361e
--- /dev/null
+++ b/launch/simulation.launch
@@ -0,0 +1,9 @@
+<launch>
+
+    <include file="$(find panda_simulation)/launch/simulation.launch"/>
+
+    <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
+
+    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
+
+</launch>
diff --git a/launch/timed_cartesian_simulation.launch b/launch/timed_cartesian_simulation.launch
new file mode 100644
index 0000000..d688ff0
--- /dev/null
+++ b/launch/timed_cartesian_simulation.launch
@@ -0,0 +1,11 @@
+<launch>
+
+    <include file="$(find panda_simulation)/launch/simulation.launch"/>
+
+    <include file="$(find panda_moveit_config)/launch/moveit_rviz.launch" />
+
+    <node name="rqt_console" pkg="rqt_console" type="rqt_console" />
+
+    <node pkg="sample_applications" type="SampleTimedCartesianPlanner" name="SampleTimedCartesianPlanner" />
+
+</launch>
-- 
GitLab