From 7d79e31a4f6b15ac14761194ad3313da5514eaf2 Mon Sep 17 00:00:00 2001
From: CS <christoph.schroeter1@mailbox.tu-dresden.de>
Date: Fri, 6 Aug 2021 13:19:55 +0200
Subject: [PATCH]

---
 cobot1.xml | 336 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 282 insertions(+), 54 deletions(-)

diff --git a/cobot1.xml b/cobot1.xml
index 94d8152..3fe4ed2 100644
--- a/cobot1.xml
+++ b/cobot1.xml
@@ -4,36 +4,59 @@
 	<declaration>// Place global declarations here.
 int retry_count = 0;
 int init_retry_count = 0;
+int place_glass_retry = 0;
 chan pressed;
-chan pickup_fail, pickup_success, move_fail, move_success;</declaration>
+chan pickup_fail, pickup_success;
+chan move_fail, move_success;
+chan place_fail, place_success;</declaration>
 	<template>
-		<name>press</name>
-		<location id="id0" x="-3153" y="-3026">
-		</location>
-		<location id="id1" x="-3017" y="-2983">
+		<name>place</name>
+		<location id="id0" x="0" y="0">
 		</location>
 		<init ref="id0"/>
 		<transition>
 			<source ref="id0"/>
-			<target ref="id1"/>
+			<target ref="id0"/>
+			<label kind="synchronisation" x="-76" y="110">place_success!</label>
+			<nail x="-86" y="102"/>
+			<nail x="118" y="119"/>
+		</transition>
+		<transition>
+			<source ref="id0"/>
+			<target ref="id0"/>
+			<label kind="synchronisation" x="-67" y="-72">place_fail!</label>
+			<nail x="-85" y="-110"/>
+			<nail x="170" y="-68"/>
+		</transition>
+	</template>
+	<template>
+		<name>press</name>
+		<location id="id1" x="-3153" y="-3026">
+		</location>
+		<location id="id2" x="-3017" y="-2983">
+		</location>
+		<init ref="id1"/>
+		<transition>
+			<source ref="id1"/>
+			<target ref="id2"/>
 			<label kind="synchronisation" x="-3119" y="-3034">pressed!</label>
 		</transition>
 	</template>
 	<template>
 		<name>move</name>
-		<location id="id2" x="-612" y="-68">
+		<location id="id3" x="-612" y="-68">
 		</location>
-		<init ref="id2"/>
+		<init ref="id3"/>
 		<transition>
-			<source ref="id2"/>
-			<target ref="id2"/>
+			<source ref="id3"/>
+			<target ref="id3"/>
 			<label kind="synchronisation" x="-646" y="51">move_fail!</label>
 			<nail x="-663" y="42"/>
 			<nail x="-535" y="59"/>
 		</transition>
 		<transition>
-			<source ref="id2"/>
-			<target ref="id2"/>
+			<source ref="id3"/>
+			<target ref="id3"/>
 			<label kind="synchronisation" x="-653" y="-237">move_success!</label>
 			<nail x="-671" y="-229"/>
 			<nail x="-501" y="-212"/>
@@ -41,19 +64,19 @@ chan pickup_fail, pickup_success, move_fail, move_success;</declaration>
 	</template>
 	<template>
 		<name>pickup</name>
-		<location id="id3" x="0" y="0">
+		<location id="id4" x="0" y="0">
 		</location>
-		<init ref="id3"/>
+		<init ref="id4"/>
 		<transition>
-			<source ref="id3"/>
-			<target ref="id3"/>
+			<source ref="id4"/>
+			<target ref="id4"/>
 			<label kind="synchronisation" x="-34" y="102">pickup_fail!</label>
 			<nail x="-76" y="93"/>
 			<nail x="110" y="76"/>
 		</transition>
 		<transition>
-			<source ref="id3"/>
-			<target ref="id3"/>
+			<source ref="id4"/>
+			<target ref="id4"/>
 			<label kind="synchronisation" x="-109" y="-93">pickup_success!</label>
 			<nail x="-127" y="-153"/>
 			<nail x="136" y="-102"/>
@@ -62,43 +85,248 @@ chan pickup_fail, pickup_success, move_fail, move_success;</declaration>
 	<template>
 		<name x="5" y="5">Cobot</name>
 		<declaration>// Place local declarations here.</declaration>
-		<location id="id4" x="-102" y="42">
+		<location id="id5" x="-102" y="42">
 			<name x="-112" y="8">waiting</name>
 		</location>
-		<location id="id5" x="204" y="68">
-			<name x="170" y="85">pick_bottle</name>
+		<location id="id6" x="204" y="68">
+			<name x="229" y="76">pick_bottle</name>
 		</location>
-		<location id="id6" x="595" y="42">
+		<location id="id7" x="595" y="42">
 			<name x="544" y="59">move_to_glass</name>
 		</location>
-		<location id="id7" x="1020" y="59">
+		<location id="id8" x="1020" y="59">
 			<name x="926" y="68">start_pour</name>
 		</location>
-		<location id="id8" x="442" y="-119">
+		<location id="id9" x="442" y="-119">
 			<name x="399" y="-153">shut_down</name>
 		</location>
-		<location id="id9" x="918" y="289">
+		<location id="id10" x="918" y="289">
 			<name x="867" y="314">stop_pour</name>
 		</location>
-		<location id="id10" x="442" y="289">
-			<name x="399" y="314">place_bottle</name>
+		<location id="id11" x="442" y="289">
+			<name x="348" y="263">place_bottle</name>
 		</location>
-		<init ref="id4"/>
+		<location id="id12" x="17" y="357">
+			<name x="17" y="365">pick_glass</name>
+		</location>
+		<location id="id13" x="833" y="493">
+			<name x="790" y="501">place_glass_target</name>
+		</location>
+		<location id="id14" x="850" y="637">
+			<name x="799" y="654">place_glass_orig</name>
+		</location>
+		<location id="id15" x="1105" y="561">
+			<name x="1096" y="527">goto_last_state</name>
+		</location>
+		<location id="id16" x="663" y="586">
+			<name x="501" y="569">goto_last_state_orig</name>
+		</location>
+		<location id="id17" x="1156" y="391">
+			<name x="1105" y="365">move_to_start_pos</name>
+		</location>
+		<location id="id18" x="1317" y="425">
+			<name x="1307" y="391">finished_success</name>
+		</location>
+		<init ref="id5"/>
 		<transition>
-			<source ref="id9"/>
-			<target ref="id10"/>
+			<source ref="id17"/>
+			<target ref="id18"/>
+			<label kind="synchronisation" x="1190" y="391">move_success?</label>
+		</transition>
+		<transition>
+			<source ref="id13"/>
+			<target ref="id17"/>
+			<label kind="synchronisation" x="1028" y="408">place_success?</label>
+		</transition>
+		<transition>
+			<source ref="id16"/>
+			<target ref="id9"/>
+			<nail x="714" y="-93"/>
+		</transition>
+		<transition>
+			<source ref="id14"/>
+			<target ref="id16"/>
+			<label kind="guard" x="681" y="577">retry_count == 1</label>
+			<label kind="synchronisation" x="681" y="594">place_fail?</label>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id9"/>
+			<label kind="guard" x="459" y="416">place_glass_retry == 0</label>
+			<label kind="synchronisation" x="467" y="433">pickup_success?</label>
+			<nail x="603" y="467"/>
+			<nail x="663" y="-59"/>
+		</transition>
+		<transition>
+			<source ref="id14"/>
+			<target ref="id12"/>
+			<label kind="synchronisation" x="255" y="620">place_success?</label>
+			<label kind="assignment" x="255" y="637">place_glass_retry--</label>
+			<nail x="238" y="620"/>
+		</transition>
+		<transition>
+			<source ref="id14"/>
+			<target ref="id14"/>
+			<label kind="guard" x="808" y="556">retry_count &gt; 1</label>
+			<label kind="synchronisation" x="808" y="573">place_fail?</label>
+			<label kind="assignment" x="808" y="590">retry_count--</label>
+			<nail x="790" y="595"/>
+			<nail x="867" y="586"/>
+		</transition>
+		<transition>
+			<source ref="id15"/>
+			<target ref="id14"/>
+			<label kind="synchronisation" x="960" y="569">move_success?</label>
+			<label kind="assignment" x="918" y="586">retry_count = init_retry_count</label>
+		</transition>
+		<transition>
+			<source ref="id14"/>
+			<target ref="id14"/>
+			<label kind="synchronisation" x="979" y="633">move_fail?</label>
+			<nail x="1071" y="629"/>
+			<nail x="1080" y="663"/>
+		</transition>
+		<transition>
+			<source ref="id14"/>
+			<target ref="id14"/>
+			<label kind="synchronisation" x="909" y="680">move_success?</label>
+			<nail x="926" y="671"/>
+			<nail x="901" y="697"/>
+		</transition>
+		<transition>
+			<source ref="id13"/>
+			<target ref="id15"/>
+			<label kind="guard" x="960" y="518">retry_count == 1</label>
+			<label kind="synchronisation" x="969" y="535">place_fail?</label>
+		</transition>
+		<transition>
+			<source ref="id13"/>
+			<target ref="id13"/>
+			<label kind="guard" x="909" y="433">retry_count &gt; 1</label>
+			<label kind="synchronisation" x="926" y="450">place_fail?</label>
+			<label kind="assignment" x="935" y="467">retry_count--</label>
+			<nail x="994" y="450"/>
+			<nail x="994" y="510"/>
+		</transition>
+		<transition>
+			<source ref="id13"/>
+			<target ref="id13"/>
+			<label kind="synchronisation" x="850" y="408">move_fail?</label>
+			<nail x="833" y="416"/>
+			<nail x="892" y="433"/>
+		</transition>
+		<transition>
+			<source ref="id13"/>
+			<target ref="id13"/>
+			<label kind="synchronisation" x="723" y="442">move_success?</label>
+			<nail x="705" y="425"/>
+			<nail x="799" y="425"/>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id13"/>
+			<label kind="guard" x="263" y="476">place_glass_retry &gt; 0</label>
+			<label kind="synchronisation" x="263" y="459">pickup_success?</label>
+			<label kind="assignment" x="263" y="493">retry_count = init_retry_count</label>
+			<nail x="493" y="510"/>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id9"/>
+			<label kind="guard" x="204" y="221">retry_count == 1</label>
+			<label kind="synchronisation" x="221" y="238">pickup_fail?</label>
+			<nail x="348" y="221"/>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id12"/>
+			<label kind="guard" x="-85" y="433">retry_count &gt; 1</label>
+			<label kind="synchronisation" x="-85" y="450">pickup_fail?</label>
+			<label kind="assignment" x="-85" y="467">retry_count--</label>
+			<nail x="-103" y="518"/>
+			<nail x="-10" y="543"/>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id12"/>
+			<label kind="synchronisation" x="-102" y="340">move_fail?</label>
+			<nail x="-68" y="340"/>
+			<nail x="-76" y="357"/>
+		</transition>
+		<transition>
+			<source ref="id12"/>
+			<target ref="id12"/>
+			<label kind="synchronisation" x="1" y="293">move_success?</label>
+			<nail x="51" y="306"/>
+			<nail x="-17" y="314"/>
+		</transition>
+		<transition>
+			<source ref="id11"/>
+			<target ref="id12"/>
+			<label kind="synchronisation" x="212" y="306">place_success?</label>
+			<label kind="assignment" x="51" y="323">retry_count = init_retry_count, place_glass_retry = init_retry_count</label>
+		</transition>
+		<transition>
+			<source ref="id11"/>
+			<target ref="id9"/>
+			<label kind="guard" x="374" y="110">retry_count == 1</label>
+			<label kind="synchronisation" x="391" y="93">place_fail?</label>
+			<nail x="382" y="161"/>
+		</transition>
+		<transition>
+			<source ref="id11"/>
+			<target ref="id11"/>
+			<label kind="guard" x="450" y="161">retry_count &gt; 1</label>
+			<label kind="synchronisation" x="434" y="182">place_fail?</label>
+			<label kind="assignment" x="434" y="199">retry_count--</label>
+			<nail x="416" y="195"/>
+			<nail x="552" y="204"/>
+		</transition>
+		<transition>
+			<source ref="id11"/>
+			<target ref="id11"/>
+			<label kind="synchronisation" x="460" y="306">move_success?</label>
+			<nail x="459" y="374"/>
+			<nail x="510" y="357"/>
+		</transition>
+		<transition>
+			<source ref="id11"/>
+			<target ref="id11"/>
+			<label kind="synchronisation" x="374" y="382">move_fail?</label>
+			<nail x="365" y="399"/>
+			<nail x="433" y="408"/>
+			<nail x="442" y="306"/>
+		</transition>
+		<transition>
+			<source ref="id6"/>
+			<target ref="id6"/>
+			<label kind="synchronisation" x="272" y="136">move_fail?</label>
+			<nail x="229" y="153"/>
+			<nail x="280" y="161"/>
+		</transition>
+		<transition>
+			<source ref="id6"/>
+			<target ref="id6"/>
+			<label kind="synchronisation" x="51" y="85">move_success?</label>
+			<nail x="119" y="119"/>
+			<nail x="178" y="127"/>
+		</transition>
+		<transition>
+			<source ref="id10"/>
+			<target ref="id11"/>
 			<label kind="synchronisation" x="595" y="263">move_success?</label>
+			<label kind="assignment" x="603" y="289">retry_count = init_retry_count</label>
 		</transition>
 		<transition>
-			<source ref="id9"/>
-			<target ref="id8"/>
+			<source ref="id10"/>
+			<target ref="id9"/>
 			<label kind="guard" x="1181" y="0">retry_count == 1</label>
 			<label kind="synchronisation" x="1232" y="-25">pickup_fail?</label>
 			<nail x="1436" y="-93"/>
 		</transition>
 		<transition>
-			<source ref="id9"/>
-			<target ref="id9"/>
+			<source ref="id10"/>
+			<target ref="id10"/>
 			<label kind="guard" x="1071" y="323">retry_count &gt; 1</label>
 			<label kind="synchronisation" x="1079" y="306">move_fail?</label>
 			<label kind="assignment" x="1062" y="340">retry_count--</label>
@@ -106,44 +334,44 @@ chan pickup_fail, pickup_success, move_fail, move_success;</declaration>
 			<nail x="1037" y="382"/>
 		</transition>
 		<transition>
-			<source ref="id7"/>
-			<target ref="id9"/>
+			<source ref="id8"/>
+			<target ref="id10"/>
 			<label kind="synchronisation" x="884" y="102">move_success?</label>
 			<label kind="assignment" x="765" y="119">retry_count = init_retry_count</label>
 		</transition>
 		<transition>
-			<source ref="id7"/>
-			<target ref="id7"/>
+			<source ref="id8"/>
+			<target ref="id8"/>
 			<label kind="synchronisation" x="969" y="-42">move_fail?</label>
 			<nail x="918" y="-25"/>
 			<nail x="1139" y="-25"/>
 		</transition>
 		<transition>
-			<source ref="id6"/>
-			<target ref="id7"/>
+			<source ref="id7"/>
+			<target ref="id8"/>
 			<label kind="synchronisation" x="714" y="25">move_success?</label>
 		</transition>
 		<transition>
-			<source ref="id6"/>
-			<target ref="id6"/>
+			<source ref="id7"/>
+			<target ref="id7"/>
 			<label kind="synchronisation" x="544" y="-51">move_fail?</label>
 			<nail x="518" y="-8"/>
 			<nail x="637" y="-25"/>
 		</transition>
 		<transition>
-			<source ref="id5"/>
-			<target ref="id8"/>
+			<source ref="id6"/>
+			<target ref="id9"/>
 			<label kind="guard" x="280" y="-102">retry_count == 1</label>
 			<label kind="synchronisation" x="306" y="-119">pickup_fail?</label>
 		</transition>
 		<transition>
-			<source ref="id5"/>
-			<target ref="id6"/>
+			<source ref="id6"/>
+			<target ref="id7"/>
 			<label kind="synchronisation" x="365" y="25">pickup_success?</label>
 		</transition>
 		<transition>
-			<source ref="id5"/>
-			<target ref="id5"/>
+			<source ref="id6"/>
+			<target ref="id6"/>
 			<label kind="guard" x="110" y="-102">retry_count &gt; 1</label>
 			<label kind="synchronisation" x="110" y="-85">pickup_fail?</label>
 			<label kind="assignment" x="110" y="-68">retry_count--</label>
@@ -151,16 +379,16 @@ chan pickup_fail, pickup_success, move_fail, move_success;</declaration>
 			<nail x="289" y="-42"/>
 		</transition>
 		<transition>
-			<source ref="id4"/>
-			<target ref="id5"/>
-			<label kind="select" x="-85" y="68">i : int[1,5]</label>
-			<label kind="synchronisation" x="-85" y="102">pressed?</label>
-			<label kind="assignment" x="-85" y="119">init_retry_count = i, retry_count = init_retry_count</label>
+			<source ref="id5"/>
+			<target ref="id6"/>
+			<label kind="select" x="-102" y="144">i : int[1,5]</label>
+			<label kind="synchronisation" x="-102" y="161">pressed?</label>
+			<label kind="assignment" x="-102" y="178">init_retry_count = i, retry_count = init_retry_count</label>
 		</transition>
 	</template>
 	<system>// Place template instantiations here.
 // List one or more processes to be composed into a system.
-system Cobot, press, move, pickup;
+system Cobot, press, move, pickup, place;
     </system>
 	<queries>
 		<query>
-- 
GitLab