From 60f18aa66d03593f6e09c9235c86febd6279de80 Mon Sep 17 00:00:00 2001 From: ft-Demo <fischertechnik-team@fischer.de> Date: Fri, 22 Oct 2021 14:41:49 +0000 Subject: [PATCH] commit by robo pro coding --- lib/display.qml | 2 +- lib/display.xml | 2 +- omniwheels_x4_soccer_goal.blockly | 388 ++++++++++++++++++++---------- omniwheels_x4_soccer_goal.py | 9 +- 4 files changed, 263 insertions(+), 138 deletions(-) diff --git a/lib/display.qml b/lib/display.qml index 8367dce..0cab849 100644 --- a/lib/display.qml +++ b/lib/display.qml @@ -13,7 +13,7 @@ TXTWindow { } TXTSwitch { id: txt_switch_active - text: "active" + text: "START" font.pixelSize: 16 enabled: true checked: true diff --git a/lib/display.xml b/lib/display.xml index 3a16681..211e50a 100644 --- a/lib/display.xml +++ b/lib/display.xml @@ -1 +1 @@ -<xml type="display" version="2"><item id="4" class="TXTSwitch"><name>txt_switch_active</name><enabled>true</enabled><checked>true</checked><text>active</text><geometry><x>60</x><y>171</y><width>100</width><height>40</height></geometry></item><item id="5" class="TXTLabel"><name>txt_label_ball</name><text>-</text><geometry><x>60</x><y>70</y><width>100</width><height>40</height></geometry></item><item id="6" class="TXTLabel"><name>txt_label_goal</name><text>-</text><geometry><x>60</x><y>120</y><width>100</width><height>40</height></geometry></item><item id="7" class="TXTLabel"><name>txt_label_ball_</name><text>ball</text><geometry><x>20</x><y>70</y><width>40</width><height>40</height></geometry></item><item id="8" class="TXTLabel"><name>txt_label_goal_</name><text>goal</text><geometry><x>20</x><y>120</y><width>40</width><height>40</height></geometry></item><item id="9" class="TXTLabel"><name>txt_label_counters_</name><text>C1...4</text><geometry><x>20</x><y>20</y><width>40</width><height>40</height></geometry></item><item id="10" class="TXTLabel"><name>txt_label_counters</name><text>-</text><geometry><x>60</x><y>20</y><width>100</width><height>40</height></geometry></item></xml> \ No newline at end of file +<xml type="display" version="2"><item id="4" class="TXTSwitch"><name>txt_switch_active</name><enabled>true</enabled><checked>true</checked><text>START</text><geometry><x>60</x><y>171</y><width>100</width><height>40</height></geometry></item><item id="5" class="TXTLabel"><name>txt_label_ball</name><text>-</text><geometry><x>60</x><y>70</y><width>100</width><height>40</height></geometry></item><item id="6" class="TXTLabel"><name>txt_label_goal</name><text>-</text><geometry><x>60</x><y>120</y><width>100</width><height>40</height></geometry></item><item id="7" class="TXTLabel"><name>txt_label_ball_</name><text>ball</text><geometry><x>20</x><y>70</y><width>40</width><height>40</height></geometry></item><item id="8" class="TXTLabel"><name>txt_label_goal_</name><text>goal</text><geometry><x>20</x><y>120</y><width>40</width><height>40</height></geometry></item><item id="9" class="TXTLabel"><name>txt_label_counters_</name><text>C1...4</text><geometry><x>20</x><y>20</y><width>40</width><height>40</height></geometry></item><item id="10" class="TXTLabel"><name>txt_label_counters</name><text>-</text><geometry><x>60</x><y>20</y><width>100</width><height>40</height></geometry></item></xml> \ No newline at end of file diff --git a/omniwheels_x4_soccer_goal.blockly b/omniwheels_x4_soccer_goal.blockly index 65fef18..1b2c15a 100644 --- a/omniwheels_x4_soccer_goal.blockly +++ b/omniwheels_x4_soccer_goal.blockly @@ -1603,135 +1603,260 @@ </block> </value> <statement name="DO4"> - <block type="controls_if" id="ip*`sP8:b(5pR4)~R_an"> - <mutation elseif="1" else="1"/> - <value name="IF0"> - <block type="logic_compare" id="(H+T:yEGNo[y%GO7P;Dz"> - <field name="OP">LT</field> - <value name="A"> - <block type="math_arithmetic" id="Ai7:`$F~9O2YGCqE}7]%" inline="false"> - <field name="OP">MINUS</field> + <block type="variables_set" id="u#?[x*W2[}s=7T+@kGX3"> + <field name="VAR" id="vH;^OzJY7dOdepMScU1s">state</field> + <value name="VALUE"> + <block type="text" id="Gi1v,-rKbpMdik!jz5aA"> + <field name="TEXT">ONLY_GOAL</field> + </block> + </value> + <next> + <block type="controls_if" id="ip*`sP8:b(5pR4)~R_an"> + <mutation elseif="2" else="1"/> + <value name="IF0"> + <block type="logic_operation" id="fn=DRPVeg$aV~zkMY*tl" inline="false"> + <field name="OP">AND</field> <value name="A"> - <block type="lists_getIndex" id="R=vnD6%qBZ6oMp]rsnuD"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="4$hv.8aI05y@,%h(#M!|"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + <block type="logic_compare" id="2Q5e3vZ!5/=nainF0od+"> + <field name="OP">LT</field> + <value name="A"> + <block type="math_arithmetic" id="stzng{bs`Stm,oBHUX4!" inline="false"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="lists_getIndex" id="F)PC`z6pXXfHV8yp+0wg"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="-dLwf7e|7vM#7`Euo5:Y"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id=":L~QVzvDi@-0k$E#ST]q"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="B"> + <block type="lists_getIndex" id="oV|[T86~]QE#t,i.$w||"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="T_7UifGjb/lr2J{Ts/T0"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="z+~r?hm,C-QOOBj55O`="> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> </block> </value> - <value name="AT"> - <block type="math_number" id="ATE$C[5@_7i#/$0#A=C,"> - <field name="NUM">1</field> + <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="lists_getIndex" id=";}IGw$j4`qR]-V6y1F{C"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="qeaIcn2J!s[tLnzs1-TD"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + <block type="logic_compare" id="c(LuogB[ECxBtM-6/r4b"> + <field name="OP">GT</field> + <value name="A"> + <block type="math_arithmetic" id="4Y=iZrdYGWmqI3n^Qia^" inline="false"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="lists_getIndex" id="1ChGpLd?q.BTzqaV^%Kd"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="$3]ihsX$QqGH0*uM8$0}"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="!`XkfPY{Xf%.#?+~LDkZ"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="B"> + <block type="lists_getIndex" id="^h3?BJeP34MIrWaZ9@rY"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="4[dCFY5H/eN@cFMa{f^Y"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="b@F!?=;Ry:$m$S6*-q%?"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> </block> </value> - <value name="AT"> - <block type="math_number" id="$@C}!!6KJsxT:/2%*qFq"> - <field name="NUM">2</field> + <value name="B"> + <block type="variables_get" id=")0O+HGV1!`X_dJGq4=yZ"> + <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field> </block> </value> </block> </value> </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="DO0"> - <block type="procedures_callnoreturn" id="xH1rS2h$??lsC(b5|}S%" inline="true"> - <mutation name="left_v"> - <arg name="v"/> - </mutation> - <value name="ARG0"> - <block type="variables_get" id="J/%Oa`9f,Y13y_bOs_ef"> - <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field> + <statement name="DO0"> + <block type="procedures_callnoreturn" id="Hv;PVkTzhtVls=i_!Gc@" inline="true"> + <mutation name="fwd_v"> + <arg name="v"/> + </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> </block> - </value> - </block> - </statement> - <value name="IF1"> - <block type="logic_compare" id="VxyB%0*)9[A{wCi_b~$0"> - <field name="OP">GT</field> - <value name="A"> - <block type="math_arithmetic" id="|7Z%Ki.3uN~;7c7dD[@e" inline="false"> - <field name="OP">MINUS</field> + </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="lists_getIndex" id="jeo$Tn_DQK0@K|6xywSs"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="YHmHsZ0^]EkM`Q2Ii*yl"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + <block type="math_arithmetic" id="Ai7:`$F~9O2YGCqE}7]%" inline="false"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="lists_getIndex" id=";}IGw$j4`qR]-V6y1F{C"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="qeaIcn2J!s[tLnzs1-TD"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="$@C}!!6KJsxT:/2%*qFq"> + <field name="NUM">2</field> + </block> + </value> </block> </value> - <value name="AT"> - <block type="math_number" id="t,gX6}8J!Fj1f.N[r~Zp"> - <field name="NUM">1</field> + <value name="B"> + <block type="lists_getIndex" id="R=vnD6%qBZ6oMp]rsnuD"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="4$hv.8aI05y@,%h(#M!|"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="ATE$C[5@_7i#/$0#A=C,"> + <field name="NUM">1</field> + </block> + </value> </block> </value> </block> </value> <value name="B"> - <block type="lists_getIndex" id="#uNz,SfO~+zP4,sS`C6;"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="kQ1V6dYMl=T|wiWBB:yK"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + <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="xH1rS2h$??lsC(b5|}S%" inline="true"> + <mutation name="left_v"> + <arg name="v"/> + </mutation> + <value name="ARG0"> + <block type="variables_get" id="J/%Oa`9f,Y13y_bOs_ef"> + <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</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="math_arithmetic" id="|7Z%Ki.3uN~;7c7dD[@e" inline="false"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="lists_getIndex" id="#uNz,SfO~+zP4,sS`C6;"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="kQ1V6dYMl=T|wiWBB:yK"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="=oK,TS$D{KF$),BuO%b-"> + <field name="NUM">2</field> + </block> + </value> </block> </value> - <value name="AT"> - <block type="math_number" id="=oK,TS$D{KF$),BuO%b-"> - <field name="NUM">2</field> + <value name="B"> + <block type="lists_getIndex" id="jeo$Tn_DQK0@K|6xywSs"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="YHmHsZ0^]EkM`Q2Ii*yl"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="t,gX6}8J!Fj1f.N[r~Zp"> + <field name="NUM">1</field> + </block> + </value> </block> </value> </block> </value> + <value name="B"> + <block type="variables_get" id="?q##-)hY2%F2{Lx*2U0U"> + <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field> + </block> + </value> </block> </value> - <value name="B"> - <block type="variables_get" id="?q##-)hY2%F2{Lx*2U0U"> - <field name="VAR" id="Ym/+Qo0YZe25;%N1d!*f">x_min</field> + <statement name="DO2"> + <block type="procedures_callnoreturn" id="jYQXBtRHSn.adQq~G7@Z" inline="true"> + <mutation name="right_v"> + <arg name="v"/> + </mutation> + <value name="ARG0"> + <block type="variables_get" id="nCzWllccVaUk{$/gd9*b"> + <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field> + </block> + </value> </block> - </value> - </block> - </value> - <statement name="DO1"> - <block type="procedures_callnoreturn" id="jYQXBtRHSn.adQq~G7@Z" inline="true"> - <mutation name="right_v"> - <arg name="v"/> - </mutation> - <value name="ARG0"> - <block type="variables_get" id="nCzWllccVaUk{$/gd9*b"> - <field name="VAR" id=")rK_fR,m=]b(j[{.CtBj">v_slow</field> + </statement> + <statement name="ELSE"> + <block type="procedures_callnoreturn" id="txDc~?FC/.mMwB2ftP!t"> + <mutation name="stop"/> </block> - </value> - </block> - </statement> - <statement name="ELSE"> - <block type="procedures_callnoreturn" id="txDc~?FC/.mMwB2ftP!t"> - <mutation name="stop"/> + </statement> </block> - </statement> + </next> </block> </statement> <value name="IF5"> @@ -1833,20 +1958,6 @@ <field name="TEXT">NO_BALL</field> </block> </value> - <next> - <block type="variables_set" id="f[tU/WJU9.%1;^OAkqZd"> - <field name="VAR" id="2Lkg^#Z.uZy(%Nr[26)6">search_dir_left</field> - <value name="VALUE"> - <block type="logic_negate" id="JJa{!NOx2:RP--3T:;.m"> - <value name="BOOL"> - <block type="variables_get" id="7RbY5FX}VSC*Zjq0j1#!"> - <field name="VAR" id="2Lkg^#Z.uZy(%Nr[26)6">search_dir_left</field> - </block> - </value> - </block> - </value> - </block> - </next> </block> </statement> <statement name="ELSE"> @@ -2095,7 +2206,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="5549"> + <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="5763"> <field name="NAME">checkTimeouts</field> <statement name="STACK"> <block type="controls_if" id="o.;j7*F0}TW}ju0E18(_"> @@ -2241,7 +2352,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="6002"> + <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="6216"> <field name="instance_name">ball_detector</field> <statement name="statement"> <block type="variables_set" id="=2/,IQfcLO{_5PNd3UK~"> @@ -2442,7 +2553,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="6669"> + <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="6883"> <field name="instance_name">ball_detector_goal_left</field> <statement name="statement"> <block type="variables_set" id="kvK,D4e%04[?+!jq*Lch"> @@ -2522,7 +2633,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="6972"> + <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="7186"> <field name="instance_name">ball_detector_goal_right</field> <statement name="statement"> <block type="variables_set" id="0!1?#@4|tcM8+U6E[$Tl"> @@ -2602,7 +2713,7 @@ </block> </statement> </block> - <block type="counter_event" id="T^aHOKaV|bU#ZeZfn[GJ" x="0" y="7275"> + <block type="counter_event" id="T^aHOKaV|bU#ZeZfn[GJ" x="0" y="7489"> <value name="condition"> <shadow type="counter_if_value" id="9`P*eh,|:Wnytp?G[|;{"> <field name="instance_name">TXT_M_C1_motor_step_counter</field> @@ -2650,7 +2761,7 @@ </block> </statement> </block> - <block type="counter_event" id="7wA~J+BkZ5~nV6aI|fLZ" x="0" y="7422"> + <block type="counter_event" id="7wA~J+BkZ5~nV6aI|fLZ" x="0" y="7636"> <value name="condition"> <shadow type="counter_if_value" id="RDF|2PoXWvG^_k{FB37U"> <field name="instance_name">TXT_M_C2_motor_step_counter</field> @@ -2698,7 +2809,7 @@ </block> </statement> </block> - <block type="counter_event" id="Nv;e.HwUkTK/=(qEs~82" x="0" y="7569"> + <block type="counter_event" id="Nv;e.HwUkTK/=(qEs~82" x="0" y="7783"> <value name="condition"> <shadow type="counter_if_value" id="05ihu;VYh*tmqA78pJQL"> <field name="instance_name">TXT_M_C3_motor_step_counter</field> @@ -2746,7 +2857,7 @@ </block> </statement> </block> - <block type="counter_event" id="j|Pz^uHewb7]si9}3az3" x="0" y="7716"> + <block type="counter_event" id="j|Pz^uHewb7]si9}3az3" x="0" y="7930"> <value name="condition"> <shadow type="counter_if_value" id="N9]b*Kn_Nxk}[I9e!^Z."> <field name="instance_name">TXT_M_C4_motor_step_counter</field> @@ -2794,7 +2905,7 @@ </block> </statement> </block> - <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="7863"> + <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="8077"> <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> @@ -2817,7 +2928,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8000"> + <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8214"> <field name="NAME">shotBall</field> <statement name="STACK"> <block type="servomotor_set_position" id="9C*rGH2+bsy8H4Xzz#gk"> @@ -2903,6 +3014,17 @@ <block type="sound_play_audio_file" id="-8bCV.(5yrq.DB#~[_}@"> <field name="soundfile_name">26_Augenzwinkern.wav</field> <field name="checkbox">FALSE</field> + <next> + <block type="display_set_switch_checked" id=")N/~DtYFy8cPbOpo-I50"> + <field name="instance_name">txt_switch_active</field> + <field name="property_name">checked</field> + <value name="value"> + <shadow type="logic_boolean" id="@Yk!SDjWfHi4@-ozuu_d"> + <field name="BOOL">FALSE</field> + </shadow> + </value> + </block> + </next> </block> </next> </block> @@ -2920,7 +3042,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="+FKt%DE[[q%Zp0T.Fn}d" collapsed="true" x="0" y="8530"> + <block type="procedures_defnoreturn" id="+FKt%DE[[q%Zp0T.Fn}d" collapsed="true" x="0" y="8772"> <field name="NAME">stop</field> <statement name="STACK"> <block type="encodermotor_stop" id="}]1#.xeDc*.k9aGX5P?4"> @@ -2932,7 +3054,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="/pGK)WReTLfX`L_7oAMD" x="0" y="8597"> + <block type="procedures_defnoreturn" id="/pGK)WReTLfX`L_7oAMD" x="0" y="8839"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="{M*n_!I)eN0.4..0Bzo#"/> </mutation> @@ -2969,7 +3091,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="qX~e_RBh^tj];fOb=cq6" x="0" y="8846"> + <block type="procedures_defnoreturn" id="qX~e_RBh^tj];fOb=cq6" x="0" y="9088"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid="{M*n_!I)eN0.4..0Bzo#"/> </mutation> @@ -3006,7 +3128,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="!zD7YDZ.5n?En8cYle4R" x="0" y="9095"> + <block type="procedures_defnoreturn" id="!zD7YDZ.5n?En8cYle4R" x="0" y="9337"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid=",q%qjDTJ~Z@[BoMwORuq"/> </mutation> @@ -3043,7 +3165,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="}KXL0=RKLgCT~yQ];aw:" x="0" y="9344"> + <block type="procedures_defnoreturn" id="}KXL0=RKLgCT~yQ];aw:" x="0" y="9586"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid=",q%qjDTJ~Z@[BoMwORuq"/> </mutation> @@ -3080,7 +3202,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="0R.p||vBpkt08x[mI=z[" x="0" y="9593"> + <block type="procedures_defnoreturn" id="0R.p||vBpkt08x[mI=z[" x="0" y="9835"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid=",q%qjDTJ~Z@[BoMwORuq"/> </mutation> @@ -3121,7 +3243,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="9834"> + <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="10076"> <field name="NAME">turnBallLeft</field> <statement name="STACK"> <block type="encodermotor_set_speed" id="I[S{vjf1EdjHVhk32Irr"> @@ -3167,7 +3289,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="10055"> + <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="10297"> <field name="NAME">turnBallRight</field> <statement name="STACK"> <block type="encodermotor_set_speed" id="c8~SXys:o35ETKj;GX?m"> @@ -3213,7 +3335,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="dhS+rZWE[`RZz:fU3A)e" collapsed="true" x="0" y="10276"> + <block type="procedures_defnoreturn" id="dhS+rZWE[`RZz:fU3A)e" collapsed="true" x="0" y="10518"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid=",q%qjDTJ~Z@[BoMwORuq"/> </mutation> @@ -3241,7 +3363,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id=")G33?J{l2sdl+nL3hpBp" collapsed="true" x="0" y="10343"> + <block type="procedures_defnoreturn" id=")G33?J{l2sdl+nL3hpBp" collapsed="true" x="0" y="10585"> <mutation> <arg name="v" varid="DfDz@$]?^P=(6r:%^xC*" argid=",q%qjDTJ~Z@[BoMwORuq"/> </mutation> @@ -3269,7 +3391,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" collapsed="true" x="0" y="10410"> + <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" collapsed="true" x="0" y="10652"> <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{"/> @@ -3335,7 +3457,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" collapsed="true" x="0" y="10477"> + <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" collapsed="true" x="0" y="10719"> <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"/> @@ -3401,7 +3523,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="10544"> + <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="10786"> <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"/> @@ -3467,7 +3589,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="0yb4y~)e=F^~rds6/HYd" x="0" y="10901"> + <block type="procedures_defnoreturn" id="0yb4y~)e=F^~rds6/HYd" x="0" y="11143"> <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"/> @@ -3538,7 +3660,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11230"> + <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11472"> <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#"/> @@ -3604,7 +3726,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="qiCJ8lc,P.U`J8k0us:C" x="0" y="11587"> + <block type="procedures_defnoreturn" id="qiCJ8lc,P.U`J8k0us:C" x="0" y="11829"> <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 0a74282..ae99daa 100644 --- a/omniwheels_x4_soccer_goal.py +++ b/omniwheels_x4_soccer_goal.py @@ -149,6 +149,7 @@ def shotBall(): break time.sleep(0.010) TXT_M.get_loudspeaker().play("26_Augenzwinkern.wav", False) + display.set_attr("txt_switch_active.checked", str(False).lower()) def stop(): @@ -417,15 +418,17 @@ while True: else: stop() elif posx_goal[0] != None and posx_goal[1] != None: - if posx_goal[0] - posx_goal[1] < x_min: + state = 'ONLY_GOAL' + if posx_goal[1] - posx_goal[0] < x_min and posx_goal[1] - posx_goal[0] > x_min: + fwd_v(v_slow) + elif posx_goal[1] - posx_goal[0] < x_min: left_v(v_slow) - elif posx_goal[0] - posx_goal[1] > x_min: + elif posx_goal[1] - posx_goal[0] > x_min: right_v(v_slow) else: stop() elif (posx_ball == None or posy_ball == None) and (posx_goal[0] != None or posx_goal[1] != None): state = 'NO_BALL' - search_dir_left = not search_dir_left else: state = 'NONE' search_ball_rot(v_slow) -- GitLab