From b48a15595186c6a8593c4a7b19276e7d24827944 Mon Sep 17 00:00:00 2001
From: ft-Demo <fischertechnik-team@fischer.de>
Date: Wed, 27 Oct 2021 08:54:12 +0000
Subject: [PATCH] commit by robo pro coding

---
 omniwheels_x4_soccer_goal.blockly | 364 ++++++++++++++++++++----------
 omniwheels_x4_soccer_goal.py      |  36 +--
 2 files changed, 262 insertions(+), 138 deletions(-)

diff --git a/omniwheels_x4_soccer_goal.blockly b/omniwheels_x4_soccer_goal.blockly
index 9c0d452..b38920e 100644
--- a/omniwheels_x4_soccer_goal.blockly
+++ b/omniwheels_x4_soccer_goal.blockly
@@ -576,7 +576,7 @@
                                                                                                                                                 </value>
                                                                                                                                                 <value name="ARG1">
                                                                                                                                                   <block type="math_number" id="@YEXBoGu~5nsOT/q7WTv">
-                                                                                                                                                    <field name="NUM">10</field>
+                                                                                                                                                    <field name="NUM">20</field>
                                                                                                                                                   </block>
                                                                                                                                                 </value>
                                                                                                                                                 <next>
@@ -592,7 +592,7 @@
                                                                                                                                                     </value>
                                                                                                                                                     <value name="ARG1">
                                                                                                                                                       <block type="math_number" id="gcH1Ps(J*{a)=3pi9diY">
-                                                                                                                                                        <field name="NUM">10</field>
+                                                                                                                                                        <field name="NUM">20</field>
                                                                                                                                                       </block>
                                                                                                                                                     </value>
                                                                                                                                                   </block>
@@ -653,7 +653,7 @@
                                                                                                                                                 </value>
                                                                                                                                                 <value name="ARG1">
                                                                                                                                                   <block type="math_number" id="@QQ[enP43_i]i}wq_G_L">
-                                                                                                                                                    <field name="NUM">10</field>
+                                                                                                                                                    <field name="NUM">20</field>
                                                                                                                                                   </block>
                                                                                                                                                 </value>
                                                                                                                                                 <next>
@@ -669,7 +669,7 @@
                                                                                                                                                     </value>
                                                                                                                                                     <value name="ARG1">
                                                                                                                                                       <block type="math_number" id=")k]SdR3F1bII`Mo!4Q2T">
-                                                                                                                                                        <field name="NUM">10</field>
+                                                                                                                                                        <field name="NUM">20</field>
                                                                                                                                                       </block>
                                                                                                                                                     </value>
                                                                                                                                                   </block>
@@ -1286,22 +1286,86 @@
                                                                                                                                                           <block type="procedures_callnoreturn" id="O6U,(~H4n-^0fP^x)_,{">
                                                                                                                                                             <mutation name="checkTimeoutsSetGoalBoth"/>
                                                                                                                                                             <next>
-                                                                                                                                                              <block type="util_wait_for" id="U4XL;U0gG@tD~]*kp|L{">
-                                                                                                                                                                <field name="format">ms</field>
-                                                                                                                                                                <value name="value">
-                                                                                                                                                                  <shadow type="math_number" id="E9K@*OZ(Ftp5CGt}.9cT">
-                                                                                                                                                                    <field name="NUM">10</field>
-                                                                                                                                                                  </shadow>
-                                                                                                                                                                  <block type="math_on_list" id="@13*5nlwbH6_4qGl%Fa8">
-                                                                                                                                                                    <mutation op="MIN"/>
-                                                                                                                                                                    <field name="OP">MIN</field>
-                                                                                                                                                                    <value name="LIST">
-                                                                                                                                                                      <block type="variables_get" id="*ir?dEyI42euOFBWsvl{">
-                                                                                                                                                                        <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field>
+                                                                                                                                                              <block type="controls_if" id="Z$wtxmrLE4LaAG1{sYQ-">
+                                                                                                                                                                <mutation elseif="0" else="1"/>
+                                                                                                                                                                <value name="IF0">
+                                                                                                                                                                  <block type="logic_operation" id="XJP@}}]qO=9.DRuZ6kOw" inline="false">
+                                                                                                                                                                    <field name="OP">AND</field>
+                                                                                                                                                                    <value name="A">
+                                                                                                                                                                      <block type="logic_compare" id="GV`j(N(o|%%+GzYguL?k">
+                                                                                                                                                                        <field name="OP">NEQ</field>
+                                                                                                                                                                        <value name="A">
+                                                                                                                                                                          <block type="variables_get" id="aI8GrNum0NwA4j*$vftb">
+                                                                                                                                                                            <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field>
+                                                                                                                                                                          </block>
+                                                                                                                                                                        </value>
+                                                                                                                                                                        <value name="B">
+                                                                                                                                                                          <block type="logic_null" id="Y4tx,oy!5n_pO~5Dp2,5"/>
+                                                                                                                                                                        </value>
+                                                                                                                                                                      </block>
+                                                                                                                                                                    </value>
+                                                                                                                                                                    <value name="B">
+                                                                                                                                                                      <block type="logic_operation" id="%qFLdANE2,^a9zb/tNDw" inline="false">
+                                                                                                                                                                        <field name="OP">AND</field>
+                                                                                                                                                                        <value name="A">
+                                                                                                                                                                          <block type="logic_compare" id="@3@P[D$yBYrT:0;tTPbI">
+                                                                                                                                                                            <field name="OP">NEQ</field>
+                                                                                                                                                                            <value name="A">
+                                                                                                                                                                              <block type="variables_get" id="d`]q|p5vuvo6@#Vk30I3">
+                                                                                                                                                                                <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field>
+                                                                                                                                                                              </block>
+                                                                                                                                                                            </value>
+                                                                                                                                                                            <value name="B">
+                                                                                                                                                                              <block type="logic_null" id="rDzB|:95l=q`!x,aL@3W"/>
+                                                                                                                                                                            </value>
+                                                                                                                                                                          </block>
+                                                                                                                                                                        </value>
+                                                                                                                                                                        <value name="B">
+                                                                                                                                                                          <block type="logic_compare" id="#FlkYV9:b#G6XH`-xHbp">
+                                                                                                                                                                            <field name="OP">NEQ</field>
+                                                                                                                                                                            <value name="A">
+                                                                                                                                                                              <block type="variables_get" id="0]K(_#XpH.@zCOsIXEf7">
+                                                                                                                                                                                <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field>
+                                                                                                                                                                              </block>
+                                                                                                                                                                            </value>
+                                                                                                                                                                            <value name="B">
+                                                                                                                                                                              <block type="logic_null" id="M$0*hkR:/MNk}_}~4+oB"/>
+                                                                                                                                                                            </value>
+                                                                                                                                                                          </block>
+                                                                                                                                                                        </value>
                                                                                                                                                                       </block>
                                                                                                                                                                     </value>
                                                                                                                                                                   </block>
                                                                                                                                                                 </value>
+                                                                                                                                                                <statement name="DO0">
+                                                                                                                                                                  <block type="util_wait_for" id="U4XL;U0gG@tD~]*kp|L{">
+                                                                                                                                                                    <field name="format">ms</field>
+                                                                                                                                                                    <value name="value">
+                                                                                                                                                                      <shadow type="math_number" id="E9K@*OZ(Ftp5CGt}.9cT">
+                                                                                                                                                                        <field name="NUM">10</field>
+                                                                                                                                                                      </shadow>
+                                                                                                                                                                      <block type="math_on_list" id="@13*5nlwbH6_4qGl%Fa8">
+                                                                                                                                                                        <mutation op="MIN"/>
+                                                                                                                                                                        <field name="OP">MIN</field>
+                                                                                                                                                                        <value name="LIST">
+                                                                                                                                                                          <block type="variables_get" id="*ir?dEyI42euOFBWsvl{">
+                                                                                                                                                                            <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field>
+                                                                                                                                                                          </block>
+                                                                                                                                                                        </value>
+                                                                                                                                                                      </block>
+                                                                                                                                                                    </value>
+                                                                                                                                                                  </block>
+                                                                                                                                                                </statement>
+                                                                                                                                                                <statement name="ELSE">
+                                                                                                                                                                  <block type="util_wait_for" id="qqc)duhLBbH_Hv}ao$rB">
+                                                                                                                                                                    <field name="format">ms</field>
+                                                                                                                                                                    <value name="value">
+                                                                                                                                                                      <shadow type="math_number" id="K8b0Rgu#U4v,$rBm.H7N">
+                                                                                                                                                                        <field name="NUM">10</field>
+                                                                                                                                                                      </shadow>
+                                                                                                                                                                    </value>
+                                                                                                                                                                  </block>
+                                                                                                                                                                </statement>
                                                                                                                                                               </block>
                                                                                                                                                             </next>
                                                                                                                                                           </block>
@@ -1381,110 +1445,212 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="En/f/xqq^SH?wf?Q!C!`" x="0" y="4297">
+  <block type="procedures_defnoreturn" id="En/f/xqq^SH?wf?Q!C!`" x="0" y="4467">
     <field name="NAME">stepOnlyGoal</field>
     <statement name="STACK">
-      <block type="controls_if" id="ip*`sP8:b(5pR4)~R_an">
-        <mutation elseif="2" else="1"/>
+      <block type="controls_if" id="zah5aZ58,g+zkkR*Mxzn">
+        <mutation elseif="0" else="1"/>
         <value name="IF0">
-          <block type="logic_operation" id="fn=DRPVeg$aV~zkMY*tl" inline="false">
+          <block type="logic_operation" id="|jb.F)~1:puCl!{}r6_I" inline="false">
             <field name="OP">AND</field>
             <value name="A">
-              <block type="logic_compare" id="2Q5e3vZ!5/=nainF0od+">
-                <field name="OP">GTE</field>
+              <block type="logic_compare" id="+M4sm=kRHpM(wk3]KOW|">
+                <field name="OP">NEQ</field>
                 <value name="A">
-                  <block type="variables_get" id="CDb^~4feXbvngdh004${">
-                    <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
+                  <block type="variables_get" id="R,M4RK_6eKHQ87~Hv{j^">
+                    <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field>
                   </block>
                 </value>
                 <value name="B">
-                  <block type="variables_get" id="cR*DIW$3$NL#u11S8#v,">
-                    <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field>
-                  </block>
+                  <block type="logic_null" id="+RruptQK^:Jq~)r3E@3o"/>
                 </value>
               </block>
             </value>
             <value name="B">
-              <block type="logic_compare" id="c(LuogB[ECxBtM-6/r4b">
-                <field name="OP">LTE</field>
+              <block type="logic_compare" id="_p`@6%BE*cgqgwC4*Os%">
+                <field name="OP">NEQ</field>
                 <value name="A">
-                  <block type="variables_get" id="z~zx!V^G#Ywd}HPCLcCn">
-                    <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
+                  <block type="variables_get" id="U|N/CJ:8}9nm|s_g)v.*">
+                    <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field>
                   </block>
                 </value>
                 <value name="B">
-                  <block type="variables_get" id=")0O+HGV1!`X_dJGq4=yZ">
-                    <field name="VAR" id="2G]XEQ3Lhl$dG]=:]8Ge">x_max</field>
-                  </block>
+                  <block type="logic_null" id="GwpsaRc%]ya$hNQLT~5c"/>
                 </value>
               </block>
             </value>
           </block>
         </value>
         <statement name="DO0">
-          <block type="controls_if" id="#R16p?0!Rt1}82Q_5zO2">
-            <mutation elseif="1" else="1"/>
+          <block type="controls_if" id="ip*`sP8:b(5pR4)~R_an">
+            <mutation elseif="2" else="1"/>
             <value name="IF0">
-              <block type="logic_compare" id="UzXI%rAMZA[}UE*cbXUd">
-                <field name="OP">LT</field>
+              <block type="logic_operation" id="fn=DRPVeg$aV~zkMY*tl" inline="false">
+                <field name="OP">AND</field>
                 <value name="A">
-                  <block type="variables_get" id="@5%T+t9W1)BZT@oXqnww">
-                    <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field>
+                  <block type="logic_compare" id="2Q5e3vZ!5/=nainF0od+">
+                    <field name="OP">GTE</field>
+                    <value name="A">
+                      <block type="variables_get" id="CDb^~4feXbvngdh004${">
+                        <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
+                      </block>
+                    </value>
+                    <value name="B">
+                      <block type="variables_get" id="cR*DIW$3$NL#u11S8#v,">
+                        <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field>
+                      </block>
+                    </value>
                   </block>
                 </value>
                 <value name="B">
-                  <block type="math_number" id="Wb8s[K5@WIquU`@,7c@w">
-                    <field name="NUM">130</field>
+                  <block type="logic_compare" id="c(LuogB[ECxBtM-6/r4b">
+                    <field name="OP">LTE</field>
+                    <value name="A">
+                      <block type="variables_get" id="z~zx!V^G#Ywd}HPCLcCn">
+                        <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
+                      </block>
+                    </value>
+                    <value name="B">
+                      <block type="variables_get" id=")0O+HGV1!`X_dJGq4=yZ">
+                        <field name="VAR" id="2G]XEQ3Lhl$dG]=:]8Ge">x_max</field>
+                      </block>
+                    </value>
                   </block>
                 </value>
               </block>
             </value>
             <statement name="DO0">
-              <block type="procedures_callnoreturn" id="pu3s6{_T@bDFusTBxc)c">
-                <mutation name="fwd">
+              <block type="controls_if" id="#R16p?0!Rt1}82Q_5zO2">
+                <mutation elseif="1" else="1"/>
+                <value name="IF0">
+                  <block type="logic_compare" id="UzXI%rAMZA[}UE*cbXUd">
+                    <field name="OP">LT</field>
+                    <value name="A">
+                      <block type="variables_get" id="@5%T+t9W1)BZT@oXqnww">
+                        <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field>
+                      </block>
+                    </value>
+                    <value name="B">
+                      <block type="math_number" id="Wb8s[K5@WIquU`@,7c@w">
+                        <field name="NUM">130</field>
+                      </block>
+                    </value>
+                  </block>
+                </value>
+                <statement name="DO0">
+                  <block type="procedures_callnoreturn" id="pu3s6{_T@bDFusTBxc)c">
+                    <mutation name="fwd">
+                      <arg name="v"/>
+                      <arg name="ticks"/>
+                    </mutation>
+                    <value name="ARG0">
+                      <block type="variables_get" id="]RO~:%x7+T~!YzQ5FD:C">
+                        <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
+                      </block>
+                    </value>
+                    <value name="ARG1">
+                      <block type="math_number" id="v0c-z!Z^U6/IWhKEPnE*">
+                        <field name="NUM">10</field>
+                      </block>
+                    </value>
+                  </block>
+                </statement>
+                <value name="IF1">
+                  <block type="logic_compare" id="XoLsJ}.)nZb?`6tpIqv-">
+                    <field name="OP">GT</field>
+                    <value name="A">
+                      <block type="variables_get" id="9NAs7T{MBx/=YP5BpW43">
+                        <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field>
+                      </block>
+                    </value>
+                    <value name="B">
+                      <block type="math_number" id="|2@A]z`Rs0UlH}Ovv9`T">
+                        <field name="NUM">40</field>
+                      </block>
+                    </value>
+                  </block>
+                </value>
+                <statement name="DO1">
+                  <block type="procedures_callnoreturn" id="Y6^M7Oqd:JSsRteXXtVD">
+                    <mutation name="bwd">
+                      <arg name="v"/>
+                      <arg name="ticks"/>
+                    </mutation>
+                    <value name="ARG0">
+                      <block type="variables_get" id="8F$+J#P35!A!gFI[:AHU">
+                        <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
+                      </block>
+                    </value>
+                    <value name="ARG1">
+                      <block type="math_number" id="dFB2rRWf.tj`$C?![{FH">
+                        <field name="NUM">10</field>
+                      </block>
+                    </value>
+                  </block>
+                </statement>
+              </block>
+            </statement>
+            <value name="IF1">
+              <block type="logic_compare" id="(H+T:yEGNo[y%GO7P;Dz">
+                <field name="OP">LT</field>
+                <value name="A">
+                  <block type="variables_get" id="D`d-ScN5}NDq#So6U%2M">
+                    <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
+                  </block>
+                </value>
+                <value name="B">
+                  <block type="variables_get" id="kw^gNGg!Q00uE[+DZwGg">
+                    <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field>
+                  </block>
+                </value>
+              </block>
+            </value>
+            <statement name="DO1">
+              <block type="procedures_callnoreturn" id="mG-?FU_hknyuqCH{oWJT">
+                <mutation name="left">
                   <arg name="v"/>
                   <arg name="ticks"/>
                 </mutation>
                 <value name="ARG0">
-                  <block type="variables_get" id="]RO~:%x7+T~!YzQ5FD:C">
+                  <block type="variables_get" id="R%Oe)=kR9%E%`E3L[QVN">
                     <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
                   </block>
                 </value>
                 <value name="ARG1">
-                  <block type="math_number" id="v0c-z!Z^U6/IWhKEPnE*">
+                  <block type="math_number" id="xRlPd!,I^P3`5.OAFO-L">
                     <field name="NUM">10</field>
                   </block>
                 </value>
               </block>
             </statement>
-            <value name="IF1">
-              <block type="logic_compare" id="XoLsJ}.)nZb?`6tpIqv-">
+            <value name="IF2">
+              <block type="logic_compare" id="VxyB%0*)9[A{wCi_b~$0">
                 <field name="OP">GT</field>
                 <value name="A">
-                  <block type="variables_get" id="9NAs7T{MBx/=YP5BpW43">
-                    <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field>
+                  <block type="variables_get" id="-;*b3g{dTtQ{%@$gw6P)">
+                    <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
                   </block>
                 </value>
                 <value name="B">
-                  <block type="math_number" id="|2@A]z`Rs0UlH}Ovv9`T">
-                    <field name="NUM">40</field>
+                  <block type="variables_get" id="?q##-)hY2%F2{Lx*2U0U">
+                    <field name="VAR" id="2G]XEQ3Lhl$dG]=:]8Ge">x_max</field>
                   </block>
                 </value>
               </block>
             </value>
-            <statement name="DO1">
-              <block type="procedures_callnoreturn" id="Y6^M7Oqd:JSsRteXXtVD">
-                <mutation name="bwd">
+            <statement name="DO2">
+              <block type="procedures_callnoreturn" id="oGweCRo;|ZbP%1KR7B]a">
+                <mutation name="right">
                   <arg name="v"/>
                   <arg name="ticks"/>
                 </mutation>
                 <value name="ARG0">
-                  <block type="variables_get" id="8F$+J#P35!A!gFI[:AHU">
+                  <block type="variables_get" id="Vc7Fp*A$WDu^X7t.%1`9">
                     <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
                   </block>
                 </value>
                 <value name="ARG1">
-                  <block type="math_number" id="dFB2rRWf.tj`$C?![{FH">
+                  <block type="math_number" id="E-tWBnGP,8}Za*a95_6n">
                     <field name="NUM">10</field>
                   </block>
                 </value>
@@ -1492,67 +1658,19 @@
             </statement>
           </block>
         </statement>
-        <value name="IF1">
-          <block type="logic_compare" id="(H+T:yEGNo[y%GO7P;Dz">
-            <field name="OP">LT</field>
-            <value name="A">
-              <block type="variables_get" id="D`d-ScN5}NDq#So6U%2M">
-                <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
-              </block>
-            </value>
-            <value name="B">
-              <block type="variables_get" id="kw^gNGg!Q00uE[+DZwGg">
-                <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field>
-              </block>
-            </value>
-          </block>
-        </value>
-        <statement name="DO1">
-          <block type="procedures_callnoreturn" id="mG-?FU_hknyuqCH{oWJT">
+        <statement name="ELSE">
+          <block type="procedures_callnoreturn" id="CgcwFgGSHS9~{^Ao1,f$">
             <mutation name="left">
               <arg name="v"/>
               <arg name="ticks"/>
             </mutation>
             <value name="ARG0">
-              <block type="variables_get" id="R%Oe)=kR9%E%`E3L[QVN">
-                <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
-              </block>
-            </value>
-            <value name="ARG1">
-              <block type="math_number" id="xRlPd!,I^P3`5.OAFO-L">
-                <field name="NUM">10</field>
-              </block>
-            </value>
-          </block>
-        </statement>
-        <value name="IF2">
-          <block type="logic_compare" id="VxyB%0*)9[A{wCi_b~$0">
-            <field name="OP">GT</field>
-            <value name="A">
-              <block type="variables_get" id="-;*b3g{dTtQ{%@$gw6P)">
-                <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field>
-              </block>
-            </value>
-            <value name="B">
-              <block type="variables_get" id="?q##-)hY2%F2{Lx*2U0U">
-                <field name="VAR" id="2G]XEQ3Lhl$dG]=:]8Ge">x_max</field>
-              </block>
-            </value>
-          </block>
-        </value>
-        <statement name="DO2">
-          <block type="procedures_callnoreturn" id="oGweCRo;|ZbP%1KR7B]a">
-            <mutation name="right">
-              <arg name="v"/>
-              <arg name="ticks"/>
-            </mutation>
-            <value name="ARG0">
-              <block type="variables_get" id="Vc7Fp*A$WDu^X7t.%1`9">
+              <block type="variables_get" id="]LCdf3.eTMlu[kypLz(U">
                 <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field>
               </block>
             </value>
             <value name="ARG1">
-              <block type="math_number" id="E-tWBnGP,8}Za*a95_6n">
+              <block type="math_number" id="?/[a6Z`/|ETvT*oceSVt">
                 <field name="NUM">10</field>
               </block>
             </value>
@@ -1561,7 +1679,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="BJV|hZc!#JXq:io7MmM`" x="0" y="5050">
+  <block type="procedures_defnoreturn" id="BJV|hZc!#JXq:io7MmM`" x="0" y="5408">
     <mutation>
       <arg name="shot" varid="ymkMx:g,wGvcvRtYUanL" argid=":62/?4I]sXmWy2!AnMxj"/>
     </mutation>
@@ -1926,7 +2044,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="6289">
+  <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="6647">
     <field name="NAME">checkTimeoutsSetGoalBoth</field>
     <statement name="STACK">
       <block type="controls_if" id="fRY+n0,2r=7:t9`dVQYz">
@@ -2166,7 +2284,7 @@
       </block>
     </statement>
   </block>
-  <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="7024">
+  <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="7382">
     <field name="instance_name">ball_detector</field>
     <statement name="statement">
       <block type="variables_set" id="=2/,IQfcLO{_5PNd3UK~">
@@ -2367,7 +2485,7 @@
       </block>
     </statement>
   </block>
-  <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="7691">
+  <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="8049">
     <field name="instance_name">ball_detector_goal_left</field>
     <statement name="statement">
       <block type="variables_set" id="kvK,D4e%04[?+!jq*Lch">
@@ -2448,7 +2566,7 @@
       </block>
     </statement>
   </block>
-  <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="8022">
+  <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="8380">
     <field name="instance_name">ball_detector_goal_right</field>
     <statement name="statement">
       <block type="variables_set" id="0!1?#@4|tcM8+U6E[$Tl">
@@ -2529,7 +2647,7 @@
       </block>
     </statement>
   </block>
-  <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="8353">
+  <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="8711">
     <value name="condition">
       <block type="input_photo_transistor_if_state" id="dX]-jf`=2/tNnEnHfKvx">
         <field name="instance_name">TXT_M_I8_photo_transistor</field>
@@ -2552,7 +2670,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8490">
+  <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8848">
     <field name="NAME">shotBall</field>
     <statement name="STACK">
       <block type="variables_set" id="l,2u2WF|]I#%kDS#5O7-">
@@ -2664,7 +2782,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="na=DVwj{P1Npv6z`ZSY{" x="0" y="9047">
+  <block type="procedures_defnoreturn" id="na=DVwj{P1Npv6z`ZSY{" x="0" y="9405">
     <field name="NAME">soundGoal</field>
     <statement name="STACK">
       <block type="variables_set" id="o^c1yss2pIv%8YmX`=6X">
@@ -2705,7 +2823,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="9241">
+  <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="9599">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="-fFb#6a:h}yA(|L+pf*l"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="h?@dWX*~x|BDzo:O{is["/>
@@ -2802,7 +2920,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="9654">
+  <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="10012">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="k6At@e}Qga_x|SmVlf6C"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="~VyZflQ+9HCPP`ynQ/=Y"/>
@@ -2899,7 +3017,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" x="0" y="10067">
+  <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" x="0" y="10425">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="K)Z,8|d5@gck+Q]pnW01"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="(Id`t]O(jxfZJay}20X{"/>
@@ -2975,7 +3093,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" x="0" y="10452">
+  <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" x="0" y="10810">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="_mFFsmoZwL{(llRvf-eW"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="aNHXtqe[T`=Y[mqp`ZDN"/>
@@ -3051,7 +3169,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="10837">
+  <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="11195">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="~d8Z+AHZ!wz|G]JHW0lQ"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="jRMx@L,Ya|zd@/bBb#1T"/>
@@ -3142,7 +3260,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11278">
+  <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11636">
     <mutation>
       <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="8Z2n_ZVA.)85]V7j%3;7"/>
       <arg name="ticks" varid="l9lR0!)Laya}3RYVW(ZQ" argid="J(gJ~*9ZJJa,[V1)[xn#"/>
diff --git a/omniwheels_x4_soccer_goal.py b/omniwheels_x4_soccer_goal.py
index 1fd31f8..29594db 100644
--- a/omniwheels_x4_soccer_goal.py
+++ b/omniwheels_x4_soccer_goal.py
@@ -58,19 +58,22 @@ def checkTimeoutsSetGoalBoth():
 
 def stepOnlyGoal():
     global shot, v, ticks, factor_x, state, ts_ball, ts_goal_left, ts_goal_right, cmd, factor_y, goal_width, posx_ball, posx_goal_left, posx_goal_right, x_min, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, v_slow, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left, ts_deltas
-    if posx_goal_both >= x_min and posx_goal_both <= x_max:
-        if goal_width < 130:
-            fwd(v_slow, 10)
-        elif goal_width > 40:
-            bwd(v_slow, 10)
+    if posx_goal_left != None and posx_goal_right != None:
+        if posx_goal_both >= x_min and posx_goal_both <= x_max:
+            if goal_width < 130:
+                fwd(v_slow, 10)
+            elif goal_width > 40:
+                bwd(v_slow, 10)
+            else:
+                pass
+        elif posx_goal_both < x_min:
+            left(v_slow, 10)
+        elif posx_goal_both > x_max:
+            right(v_slow, 10)
         else:
             pass
-    elif posx_goal_both < x_min:
-        left(v_slow, 10)
-    elif posx_goal_both > x_max:
-        right(v_slow, 10)
     else:
-        pass
+        left(v_slow, 10)
 
 
 def stepBall(shot):
@@ -315,12 +318,12 @@ while True:
                         turnSideRight(v_slow, 20)
             elif posx_goal_left != None and posx_goal_right == None:
                 state = 'BALL_GOAL_LEFT'
-                right(v_slow, 10)
-                turnSideLeft(v_slow, 10)
+                right(v_slow, 20)
+                turnSideLeft(v_slow, 20)
             elif posx_goal_left == None and posx_goal_right != None:
                 state = 'BALL_GOAL_RIGHT'
-                left(v_slow, 10)
-                turnSideRight(v_slow, 10)
+                left(v_slow, 20)
+                turnSideRight(v_slow, 20)
             else:
                 state = 'BALL_NO_GOAL'
                 stepBall(False)
@@ -350,6 +353,9 @@ while True:
     ts_deltas = [(time.time() * 1000) - ts_ball, (time.time() * 1000) - ts_goal_left, (time.time() * 1000) - ts_goal_right]
     print('{:.1f} {:.1f} {:.1f} {}:{}  GOAL left: {} {}, right:{} {}, p:{}, w:{} BALL_pos:{},{} v_x:{} v_y:{}'.format(ts_deltas[0], ts_deltas[1], ts_deltas[2], state, cmd, posx_goal_left, posy_goal_left, posx_goal_right, posy_goal_right, posx_goal_both, goal_width, posx_ball, posy_ball, v_var_ball_xpos, v_var_ball_ypos))
     checkTimeoutsSetGoalBoth()
-    time.sleep(min(ts_deltas) / 1000)
+    if posx_ball != None and posx_goal_left != None and posx_goal_right != None:
+        time.sleep(min(ts_deltas) / 1000)
+    else:
+        time.sleep(0.01)
 
 
-- 
GitLab