From 4cda3698d97e13a985b8f270dd36bd93c6d84ef3 Mon Sep 17 00:00:00 2001
From: KingMaZito <matteo.aneddama@icloud.com>
Date: Thu, 24 Nov 2022 22:03:52 +0100
Subject: [PATCH] passing results to xacro fixed

---
 .catkin_tools/profiles/default/devel_collisions.txt  | 2 +-
 src/ceti_double/launch/demo.launch                   | 3 +++
 src/ceti_double/launch/move_group.launch             | 3 +++
 src/ceti_double/launch/planning_context.launch       | 4 +++-
 src/franka_description/robots/ceti_double.urdf.xacro | 4 ++--
 src/mtc/README.md                                    | 9 ++++-----
 src/mtc/launch/cell_routine.launch                   | 5 +++--
 7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/.catkin_tools/profiles/default/devel_collisions.txt b/.catkin_tools/profiles/default/devel_collisions.txt
index 1f86b91..2c19e6d 100644
--- a/.catkin_tools/profiles/default/devel_collisions.txt
+++ b/.catkin_tools/profiles/default/devel_collisions.txt
@@ -1,4 +1,4 @@
 /home/matteo/ws_panda/devel/./cmake.lock 42
-/home/matteo/reachability/devel/./cmake.lock 26623
+/home/matteo/reachability/devel/./cmake.lock 26636
 /home/matteo/reachability/devel/lib/libmoveit_grasps.so 79
 /home/matteo/reachability/devel/lib/libmoveit_grasps_filter.so 79
diff --git a/src/ceti_double/launch/demo.launch b/src/ceti_double/launch/demo.launch
index d2c944e..bb1081d 100644
--- a/src/ceti_double/launch/demo.launch
+++ b/src/ceti_double/launch/demo.launch
@@ -23,6 +23,8 @@
   <arg name="use_gui" default="false" />
   <arg name="use_rviz" default="true" />
 
+  <arg name="scene" default="dummy/dummy.yaml" />
+
   <!-- If needed, broadcast static tf for robot root -->
   <node pkg="tf2_ros" type="static_transform_publisher" name="virtual_joint_broadcaster_0" args="0 0 0 0 0 0 world base_1" />
   <node pkg="tf2_ros" type="static_transform_publisher" name="virtual_joint_broadcaster_1" args="0 0 0 0 0 0 world base_2" />
@@ -54,6 +56,7 @@
     <arg name="debug" value="$(arg debug)"/>
     <arg name="pipeline" value="$(arg pipeline)"/>
     <arg name="load_robot_description" value="$(arg load_robot_description)"/>
+    <arg name="scene" value="$(arg scene)" />
   </include>
 
   <!-- Run Rviz and load the default config to see the state of the move_group node
diff --git a/src/ceti_double/launch/move_group.launch b/src/ceti_double/launch/move_group.launch
index 68fa8a9..3cdbfd5 100644
--- a/src/ceti_double/launch/move_group.launch
+++ b/src/ceti_double/launch/move_group.launch
@@ -21,6 +21,8 @@
 
   <arg name="capabilities" default=""/>
   <arg name="disable_capabilities" default=""/>
+  <arg name="scene" default="dummy/dummy.yaml"/>
+
   <!-- load these non-default MoveGroup capabilities (space seperated) -->
   <!--
   <arg name="capabilities" value="
@@ -41,6 +43,7 @@
   <!-- load URDF, SRDF and joint_limits configuration -->
   <include file="$(dirname)/planning_context.launch">
     <arg name="load_robot_description" value="$(arg load_robot_description)" />
+    <arg name="scene" value="$(arg scene)" />
   </include>
 
   <!-- Planning Pipelines -->
diff --git a/src/ceti_double/launch/planning_context.launch b/src/ceti_double/launch/planning_context.launch
index fac3bd8..e2672eb 100644
--- a/src/ceti_double/launch/planning_context.launch
+++ b/src/ceti_double/launch/planning_context.launch
@@ -1,12 +1,14 @@
 <launch>
   <!-- By default we do not overwrite the URDF. Change the following to true to change the default behavior -->
   <arg name="load_robot_description" default="false"/>
+  <arg name="scene" default="dummy/dummy.yaml"/>
+
 
   <!-- The name of the parameter under which the URDF is loaded -->
   <arg name="robot_description" default="robot_description"/>
 
   <!-- Load universal robot description format (URDF) -->
-  <param if="$(arg load_robot_description)" name="$(arg robot_description)" command="xacro  '$(find franka_description)/robots/ceti_double.urdf.xacro'"/>
+  <param if="$(arg load_robot_description)" name="$(arg robot_description)" command="xacro  '$(find franka_description)/robots/ceti_double.urdf.xacro' 'scene:=$(arg scene)'"/>
 
   <!-- The semantic description that corresponds to the URDF -->
   <param name="$(arg robot_description)_semantic" textfile="$(find ceti_double)/config/panda.srdf" />
diff --git a/src/franka_description/robots/ceti_double.urdf.xacro b/src/franka_description/robots/ceti_double.urdf.xacro
index 0ba1901..80f9f35 100644
--- a/src/franka_description/robots/ceti_double.urdf.xacro
+++ b/src/franka_description/robots/ceti_double.urdf.xacro
@@ -7,13 +7,13 @@
 
   <xacro:include filename="panda_arm.xacro"/>
   <xacro:include filename="hand.xacro"/>
-  <xacro:arg name="scene" default='dummy.yaml'/>
+  <xacro:arg name="scene" default='dummy/dummy.yaml'/>
 
 
   <link name="world" />
 
 
-  <xacro:property name="yaml_file" value="$(find mtc)/results/dummy/-429778748.yaml" />
+  <xacro:property name="yaml_file" value="$(find mtc)/results/$(arg scene)" />
   <xacro:property name="props" value="${xacro.load_yaml(yaml_file)}" />
 
   <xacro:property name="x1" value="${props['objects'][8]['pos']['x']}" />
diff --git a/src/mtc/README.md b/src/mtc/README.md
index a9ca686..bb2ded4 100644
--- a/src/mtc/README.md
+++ b/src/mtc/README.md
@@ -8,7 +8,6 @@ MTC consists of 3 executables, with each computing .yaml files for the next subs
 ### mtc2taskspace 
 From a Ceti dump file representing an arbitrary scene with specific locations, located in the /resources directory. Mtc2taskspace computes a taskspace.yaml file and associates each object with a drop-of-location to a robot. The shared space between robots is expressed by identical location entries for each robot involved. 
 > resulting .yaml files in /descriptions
->> file structure soon to be changed, sticking more to a struct like representation
 
 ### base_routine  
 Calculates the workspace from a /descriptions file (mtc2taskspace) and a precomputed reachability map (/map), combined with information from a dump file (/resources). Creates the directory results/${dump_file_name} with the resulting dump files as contents. 
@@ -18,11 +17,11 @@ Calculates the workspace from a /descriptions file (mtc2taskspace) and a precomp
 
 ### cell_routine  
 Designed to load a dump_file (+ with additional rpy component) and execute a task with moveit task constructor. A task description can also be the /descriptions file of mtc2taskspace, which is the case now.
-> Restricted to coop tasks, since parallel tasks capability must be included first. Also pushing results/example.yaml file into franca_description is 'ugly', since it has to be included manually. Searching for solution.
->> Christoph's parser could not be integrated because there is no way to have multiple robots compute a task.
+> Christoph's parser could not be integrated because there is no way to have multiple robots compute a task.
+
 
 ## Current state
-State: in progress. Every executable is working with some explained downfalls that should be fixed in the next days. Implementing or omitting ideas because some modules do not work as expected took a lot of time. The actual results (62 files for dummy.yaml) can be loaded and run by manually changing the path of the results file in launch/cell_routine.launch and franka_description/robots/ceti_double.urdf.xacro. I tested 10/62 myself, with surprisingly good results. The following list shows open and closed ToDos.
+State: in progress. Every executable is working with some explained downfalls that should be fixed in the next days. Implementing or omitting ideas because some modules do not work as expected took a lot of time. The actual results (62 files for dummy.yaml) can be loaded and run. I tested 10/62 myself, with surprisingly good results. The following list shows open and closed ToDos.
 
 :ballot_box_with_check: present a faster work-space execution 
 :ballot_box_with_check: generate more solutions for 1 dump file
@@ -30,7 +29,7 @@ State: in progress. Every executable is working with some explained downfalls th
 :ballot_box_with_check: elaborate the moveit task constructor 
 :ballot_box_with_check: present more general task files
 :black_square_button: include cosmetic values 
-:black_square_button: passing yaml in xacro (franca_description)
+:ballot_box_with_check: passing yaml in xacro (franca_description)
 :ballot_box_with_check: parallel tasks (Docker already downloaded, just have to try) (main focus) (with some problems of course)
 :black_square_button: include ferdinants work (main focus)
 
diff --git a/src/mtc/launch/cell_routine.launch b/src/mtc/launch/cell_routine.launch
index 71a9138..aac714e 100644
--- a/src/mtc/launch/cell_routine.launch
+++ b/src/mtc/launch/cell_routine.launch
@@ -1,9 +1,9 @@
 <launch>    
-    <arg name="result" default="dummy/dummy.yaml" />
+    <arg name="result" default="dummy/-474510554.yaml" />
     <!--<include file="$(find panda_moveit_config)/launch/demo.launch"></include> -->
 
     <!-- this is to change-->
-    <rosparam command="load" file="$(find mtc)/results/dummy/-429778748.yaml"/>
+    <rosparam command="load" file="$(find mtc)/results/$(arg result)"/>
 
 
     <rosparam command="load" file="$(find mtc)/mtc_templates/dummy.yaml" />
@@ -13,6 +13,7 @@
 
     <include file="$(find ceti_double)/launch/demo.launch"> 
         <arg name="use_rviz" value="false"/>
+        <arg name="scene" value="$(arg result)" />
     </include> 
     
     <include ns="cell_routine" file="$(find ceti_double)/launch/fake_moveit_controller_manager.launch.xml" />
-- 
GitLab