From 2494ccc023bccdd41c2a543b6d4d8783d3ac24c6 Mon Sep 17 00:00:00 2001 From: ft-Demo <fischertechnik-team@fischer.de> Date: Fri, 29 Oct 2021 06:37:20 +0000 Subject: [PATCH] commit by robo pro coding --- lib/display.qml | 72 +-- lib/display.xml | 2 +- omniwheels_x4_soccer_goal.blockly | 782 ++++++++++++++++-------------- omniwheels_x4_soccer_goal.py | 53 +- 4 files changed, 476 insertions(+), 433 deletions(-) diff --git a/lib/display.qml b/lib/display.qml index 7b6c451..a499b48 100644 --- a/lib/display.qml +++ b/lib/display.qml @@ -13,13 +13,13 @@ TXTWindow { } TXTSwitch { id: txt_switch_ball - text: "" + text: "Goal" font.pixelSize: 16 enabled: true checked: false - x: 170 + x: 120 y: 10 - width: 60 + width: 120 height: 40 } TXTLabel { @@ -27,67 +27,67 @@ TXTWindow { text: "-" font.pixelSize: 16 elide: Text.ElideRight - x: 50 - y: 10 - width: 120 - height: 40 + x: 40 + y: 20 + width: 79 + height: 30 } TXTLabel { id: txt_label_goal_left text: "-" font.pixelSize: 16 elide: Text.ElideRight - x: 50 - y: 70 - width: 120 - height: 40 + x: 40 + y: 80 + width: 80 + height: 30 } TXTLabel { id: txt_label_goal_right text: "-" font.pixelSize: 16 elide: Text.ElideRight - x: 50 - y: 110 - width: 120 - height: 40 + x: 160 + y: 80 + width: 80 + height: 30 } StatusIndicator { id: txt_status_indicator_ball - color: "#FFB700" + color: "#FF9900" active: false - x: 20 - y: 20 - width: 20 - height: 20 + x: 0 + y: 10 + width: 40 + height: 40 } StatusIndicator { id: txt_status_indicator_goal_left color: "#19FF00" active: false - x: 20 - y: 80 - width: 20 - height: 20 + x: 0 + y: 70 + width: 40 + height: 40 } StatusIndicator { id: txt_status_indicator_goal_right color: "#F8FF00" active: false - x: 20 - y: 120 - width: 20 - height: 20 + x: 120 + y: 70 + width: 40 + height: 40 } TXTSwitch { id: txt_switch_goal - text: "" + text: "Center" font.pixelSize: 16 enabled: true checked: false - x: 170 - y: 150 - width: 60 + x: 120 + y: 180 + width: 120 height: 40 } TXTLabel { @@ -95,9 +95,9 @@ TXTWindow { text: "-" font.pixelSize: 16 elide: Text.ElideRight - x: 50 - y: 150 - width: 120 - height: 40 + x: 40 + y: 110 + width: 200 + height: 30 } } diff --git a/lib/display.xml b/lib/display.xml index d8eb86d..0ea8e48 100644 --- a/lib/display.xml +++ b/lib/display.xml @@ -1 +1 @@ -<xml type="display" version="2"><item id="4" class="TXTSwitch"><name>txt_switch_ball</name><enabled>true</enabled><checked>false</checked><text/><geometry><x>170</x><y>10</y><width>60</width><height>40</height></geometry></item><item id="5" class="TXTLabel"><name>txt_label_ball</name><text>-</text><geometry><x>50</x><y>10</y><width>120</width><height>40</height></geometry></item><item id="6" class="TXTLabel"><name>txt_label_goal_left</name><text>-</text><geometry><x>50</x><y>70</y><width>120</width><height>40</height></geometry></item><item id="10" class="TXTLabel"><name>txt_label_goal_right</name><text>-</text><geometry><x>50</x><y>110</y><width>120</width><height>40</height></geometry></item><item id="11" class="StatusIndicator"><name>txt_status_indicator_ball</name><color>#FFB700</color><active>false</active><geometry><x>20</x><y>20</y><width>20</width><height>20</height></geometry></item><item id="12" class="StatusIndicator"><name>txt_status_indicator_goal_left</name><color>#19FF00</color><active>false</active><geometry><x>20</x><y>80</y><width>20</width><height>20</height></geometry></item><item id="13" class="StatusIndicator"><name>txt_status_indicator_goal_right</name><color>#F8FF00</color><active>false</active><geometry><x>20</x><y>120</y><width>20</width><height>20</height></geometry></item><item id="14" class="TXTSwitch"><name>txt_switch_goal</name><enabled>true</enabled><checked>false</checked><text/><geometry><x>170</x><y>150</y><width>60</width><height>40</height></geometry></item><item id="15" class="TXTLabel"><name>txt_label_goal_both</name><text>-</text><geometry><x>50</x><y>150</y><width>120</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_ball</name><enabled>true</enabled><checked>false</checked><text>Goal</text><geometry><x>120</x><y>10</y><width>120</width><height>40</height></geometry></item><item id="5" class="TXTLabel"><name>txt_label_ball</name><text>-</text><geometry><x>40</x><y>20</y><width>79</width><height>30</height></geometry></item><item id="6" class="TXTLabel"><name>txt_label_goal_left</name><text>-</text><geometry><x>40</x><y>80</y><width>80</width><height>30</height></geometry></item><item id="10" class="TXTLabel"><name>txt_label_goal_right</name><text>-</text><geometry><x>160</x><y>80</y><width>80</width><height>30</height></geometry></item><item id="11" class="StatusIndicator"><name>txt_status_indicator_ball</name><color>#FF9900</color><active>false</active><geometry><x>0</x><y>10</y><width>40</width><height>40</height></geometry></item><item id="12" class="StatusIndicator"><name>txt_status_indicator_goal_left</name><color>#19FF00</color><active>false</active><geometry><x>0</x><y>70</y><width>40</width><height>40</height></geometry></item><item id="13" class="StatusIndicator"><name>txt_status_indicator_goal_right</name><color>#F8FF00</color><active>false</active><geometry><x>120</x><y>70</y><width>40</width><height>40</height></geometry></item><item id="14" class="TXTSwitch"><name>txt_switch_goal</name><enabled>true</enabled><checked>false</checked><text>Center</text><geometry><x>120</x><y>180</y><width>120</width><height>40</height></geometry></item><item id="15" class="TXTLabel"><name>txt_label_goal_both</name><text>-</text><geometry><x>40</x><y>110</y><width>200</width><height>30</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 b38920e..71c95d9 100644 --- a/omniwheels_x4_soccer_goal.blockly +++ b/omniwheels_x4_soccer_goal.blockly @@ -15,11 +15,11 @@ <variable id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</variable> <variable id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</variable> <variable id="Ym/+Qo0YZe25;%N1d!*f">x_min</variable> + <variable id=")rK_fR,m=]b(j[{.CtBj">v_slow</variable> <variable id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</variable> <variable id="q#H`+Gwt~43Dh@fu;G-D">posy_ball</variable> <variable id="a8;eFhj+gj?)7exUyU;p">posy_goal_left</variable> <variable id="+j/X+RCIMajR28(u#7DG">posy_goal_right</variable> - <variable id=")rK_fR,m=]b(j[{.CtBj">v_slow</variable> <variable id="2G]XEQ3Lhl$dG]=:]8Ge">x_max</variable> <variable id="O=Lc:FQ[]f3iuM/V@.mv">v_var_ball_xpos</variable> <variable id="}*jl@)UA_Hjh5rc,Gt)c">y_ball_far</variable> @@ -27,6 +27,7 @@ <variable id="xjf5O*w9;IZf$n55ytVF">y_ball_touch</variable> <variable id=";S3?%3)**s[[l~Aq3*,{">v_var_ball_ypos</variable> <variable id="09n]XF2CKURQs)nHOfam">y_ball_near</variable> + <variable id="A=j.].x+a4-)iSQbu32#">ts_last_print</variable> <variable id="2Lkg^#Z.uZy(%Nr[26)6">search_dir_left</variable> <variable id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</variable> </variables> @@ -196,36 +197,36 @@ </block> </value> <next> - <block type="variables_set" id="KM.MX+]F}x6_^($zaJ42"> - <field name="VAR" id="2Lkg^#Z.uZy(%Nr[26)6">search_dir_left</field> + <block type="variables_set" id="t-K;R}1T?OZQBG{83kv?"> + <field name="VAR" id="A=j.].x+a4-)iSQbu32#">ts_last_print</field> <value name="VALUE"> - <block type="logic_boolean" id="G[2Hre!^[YHSfA#^`k;H"> - <field name="BOOL">TRUE</field> + <block type="util_runtime_measurement" id=",fJ0GJbDd}kQa$Ac%,S/"> + <field name="TIME">MILLISECOND</field> </block> </value> <next> - <block type="variables_set" id="?^qtAjQUmvZ=U[d1VIhg"> - <field name="VAR" id="vH;^OzJY7dOdepMScU1s">state</field> + <block type="variables_set" id="KM.MX+]F}x6_^($zaJ42"> + <field name="VAR" id="2Lkg^#Z.uZy(%Nr[26)6">search_dir_left</field> <value name="VALUE"> - <block type="text" id="V.-^bs67=#+RFV.YX~P,"> - <field name="TEXT">NONE</field> + <block type="logic_boolean" id="G[2Hre!^[YHSfA#^`k;H"> + <field name="BOOL">TRUE</field> </block> </value> <next> - <block type="variables_set" id="!eP!#y!o25=Kc{0p7GDs"> - <field name="VAR" id="fPH`.@]riH+=v{,A)bP5">cmd</field> + <block type="variables_set" id="?^qtAjQUmvZ=U[d1VIhg"> + <field name="VAR" id="vH;^OzJY7dOdepMScU1s">state</field> <value name="VALUE"> - <block type="text" id="vc4C]$ok!Yk@_eIUD8L)"> + <block type="text" id="V.-^bs67=#+RFV.YX~P,"> <field name="TEXT">NONE</field> </block> </value> <next> - <block type="util_wait_for" id="psY%VZ5++RBl5.z;}C^B"> - <field name="format">s</field> - <value name="value"> - <shadow type="math_number" id="((-m~`=x]Jlg;bgN9QH!"> - <field name="NUM">2</field> - </shadow> + <block type="variables_set" id="!eP!#y!o25=Kc{0p7GDs"> + <field name="VAR" id="fPH`.@]riH+=v{,A)bP5">cmd</field> + <value name="VALUE"> + <block type="text" id="vc4C]$ok!Yk@_eIUD8L)"> + <field name="TEXT">NONE</field> + </block> </value> <next> <block type="loop_endless" id="V,Gw25li,3_,;92QCQLj"> @@ -943,429 +944,385 @@ </block> </statement> <next> - <block type="display_set_status_indicator_active" id="Ol/kdywTz9GJZec|QWMS"> - <field name="instance_name">txt_status_indicator_ball</field> - <value name="value"> - <shadow type="logic_boolean" id="C/tmfzzEp6H,:Q-Cbzm5"> - <field name="BOOL">TRUE</field> - </shadow> - <block type="logic_compare" id="A*?Wn/psphIs}+%SxVmh"> - <field name="OP">NEQ</field> - <value name="A"> - <block type="variables_get" id="s5*njiZc=^N+p)4eIr:g"> - <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> - </block> - </value> - <value name="B"> - <block type="logic_null" id="e!/:${Wq/7lIg8.F`rU:"/> - </value> - </block> - </value> + <block type="procedures_callnoreturn" id="O6U,(~H4n-^0fP^x)_,{"> + <mutation name="checkTimeoutsSetGoalBoth"/> <next> - <block type="display_set_status_indicator_active" id="6raPw1+,67bp]Ic#!]_h"> - <field name="instance_name">txt_status_indicator_goal_left</field> - <value name="value"> - <shadow type="logic_boolean"> - <field name="BOOL">TRUE</field> - </shadow> - <block type="logic_compare" id="(Gd1pOPhbD[]9blVQC|s"> - <field name="OP">NEQ</field> - <value name="A"> - <block type="variables_get" id="d)kKqkwH4O9u46e{zBnP"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> + <block type="variables_set" id="6x+{VP+wdcN`Z%}[I.!L"> + <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> + <value name="VALUE"> + <block type="lists_create_with" id="LDomGXVQ/3v0~^mXO=H:"> + <mutation items="3"/> + <value name="ADD0"> + <block type="math_arithmetic" id="t680,3~Y1s!r4H9oe8JV"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="util_runtime_measurement" id="j%rmr;8@Az.]O/{}Y4_U"> + <field name="TIME">MILLISECOND</field> + </block> + </value> + <value name="B"> + <block type="variables_get" id="C/5XJ8aZmH}nTu/c{K/3"> + <field name="VAR" id="v3eHF0atAL+ouaa{W$=m">ts_ball</field> + </block> + </value> </block> </value> - <value name="B"> - <block type="logic_null" id="/s%hwOAf=LC]:$PjiZy?"/> + <value name="ADD1"> + <block type="math_arithmetic" id="$d!a-N+BUJRl4UwINuSA"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="util_runtime_measurement" id="(V|oNw#p7uI.IS-0bNIb"> + <field name="TIME">MILLISECOND</field> + </block> + </value> + <value name="B"> + <block type="variables_get" id="^|.#)!4#E5}RC4|@nT=E"> + <field name="VAR" id=";Ki:[qYaZnowqSa`]/aW">ts_goal_left</field> + </block> + </value> + </block> </value> - </block> - </value> - <next> - <block type="display_set_status_indicator_active" id="^O{W3G$em_v6~A^t1K$]"> - <field name="instance_name">txt_status_indicator_goal_right</field> - <value name="value"> - <shadow type="logic_boolean"> - <field name="BOOL">TRUE</field> - </shadow> - <block type="logic_compare" id="2S2X?GGT8}tBgMGb3x=["> - <field name="OP">NEQ</field> + <value name="ADD2"> + <block type="math_arithmetic" id="g-kAJ}l^chb1#7`^GN})"> + <field name="OP">MINUS</field> <value name="A"> - <block type="variables_get" id="4yKol;}{*yD|UJzvYN83"> - <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> + <block type="util_runtime_measurement" id="f}EvEIL!N;0K~[,Yj{i|"> + <field name="TIME">MILLISECOND</field> </block> </value> <value name="B"> - <block type="logic_null" id="?MiF_jh!]il%Rhf3lN~~"/> + <block type="variables_get" id="(VfxxD;J|pK4hJH~.L#:"> + <field name="VAR" id="z^z{Ev+IMfS6[W1raY;l">ts_goal_right</field> + </block> </value> </block> </value> - <next> - <block type="display_set_label_text" id="QDZ)v?E3iW-Liq4HKvUn"> - <field name="instance_name">txt_label_ball</field> - <value name="value"> - <shadow type="text" id="B`M|)AOBioxQGjue#9y^"> - <field name="TEXT">abc</field> - </shadow> - <block type="text_format" id="bMzX7EzL+}J^dowK5pv|"> - <mutation items="2"/> - <value name="value"> - <shadow type="text" id="(C2/oN~6=q7Bw[A5`Pz)"> - <field name="TEXT">x:{}, y:{}</field> - </shadow> - </value> - <value name="ADD0"> - <block type="variables_get" id="N3bK$!XutDL@t?7tqOnB"> - <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> + </block> + </value> + <next> + <block type="controls_if" id="_f|fti@*DD:6NVcT=@F`"> + <value name="IF0"> + <block type="logic_compare" id="S%]]V.~p==`AZ%,pPs$Z" inline="false"> + <field name="OP">GT</field> + <value name="A"> + <block type="math_arithmetic" id="TQ^Swug!P:_s!71ZBS~h"> + <field name="OP">MINUS</field> + <value name="A"> + <block type="util_runtime_measurement" id="*LO~h?FB2X0V5n!ohqt*"> + <field name="TIME">MILLISECOND</field> </block> </value> - <value name="ADD1"> - <block type="variables_get" id="CIUI@k|{^~}vfJeTSYP2"> - <field name="VAR" id="q#H`+Gwt~43Dh@fu;G-D">posy_ball</field> + <value name="B"> + <block type="variables_get" id="N-n}YO-)8MQmOqyQTD-B"> + <field name="VAR" id="A=j.].x+a4-)iSQbu32#">ts_last_print</field> </block> </value> </block> </value> + <value name="B"> + <block type="math_number" id="!-?@OIQfTR@2XYd-p;#|"> + <field name="NUM">200</field> + </block> + </value> + </block> + </value> + <statement name="DO0"> + <block type="variables_set" id="zU`J!L3yHUm.2D0gjNd*"> + <field name="VAR" id="A=j.].x+a4-)iSQbu32#">ts_last_print</field> + <value name="VALUE"> + <block type="util_runtime_measurement" id="|!8OZ;iGQoa@sml7mN3N"> + <field name="TIME">MILLISECOND</field> + </block> + </value> <next> - <block type="display_set_label_text" id="2Ac72_SmdOYaC#|w[dk%"> - <field name="instance_name">txt_label_goal_left</field> + <block type="display_set_status_indicator_active" id="Ol/kdywTz9GJZec|QWMS"> + <field name="instance_name">txt_status_indicator_ball</field> <value name="value"> - <shadow type="text"> - <field name="TEXT">abc</field> + <shadow type="logic_boolean" id="C/tmfzzEp6H,:Q-Cbzm5"> + <field name="BOOL">TRUE</field> </shadow> - <block type="text_format" id="xXJlH+s%1,D1WcfOkt#6"> - <mutation items="2"/> - <value name="value"> - <shadow type="text" id=":(AhX7mg_fQeOGz*xR@g"> - <field name="TEXT">{} {}</field> - </shadow> - </value> - <value name="ADD0"> - <block type="variables_get" id="ppSdz+]@cvkJ)r-5HdD^"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> + <block type="logic_compare" id="A*?Wn/psphIs}+%SxVmh"> + <field name="OP">NEQ</field> + <value name="A"> + <block type="variables_get" id="s5*njiZc=^N+p)4eIr:g"> + <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> </block> </value> - <value name="ADD1"> - <block type="variables_get" id="Fe?~n3W$cZh6_K]^Dsyx"> - <field name="VAR" id="a8;eFhj+gj?)7exUyU;p">posy_goal_left</field> - </block> + <value name="B"> + <block type="logic_null" id="e!/:${Wq/7lIg8.F`rU:"/> </value> </block> </value> <next> - <block type="display_set_label_text" id="a{S3p;wE$+yu^C@/gbFc"> - <field name="instance_name">txt_label_goal_right</field> + <block type="display_set_status_indicator_active" id="6raPw1+,67bp]Ic#!]_h"> + <field name="instance_name">txt_status_indicator_goal_left</field> <value name="value"> - <shadow type="text"> - <field name="TEXT">abc</field> + <shadow type="logic_boolean"> + <field name="BOOL">TRUE</field> </shadow> - <block type="text_format" id="aM8~sP`fYChiSu}cXXcR"> - <mutation items="2"/> - <value name="value"> - <shadow type="text" id="iEm4r;N9H6ZV_0W/huA7"> - <field name="TEXT">{} {}</field> - </shadow> - </value> - <value name="ADD0"> - <block type="variables_get" id="86hRDB1XQ4so2N5SUnF_"> - <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> + <block type="logic_compare" id="(Gd1pOPhbD[]9blVQC|s"> + <field name="OP">NEQ</field> + <value name="A"> + <block type="variables_get" id="d)kKqkwH4O9u46e{zBnP"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> </block> </value> - <value name="ADD1"> - <block type="variables_get" id="%A3W)E/]zAMtqytEd%-*"> - <field name="VAR" id="+j/X+RCIMajR28(u#7DG">posy_goal_right</field> - </block> + <value name="B"> + <block type="logic_null" id="/s%hwOAf=LC]:$PjiZy?"/> </value> </block> </value> <next> - <block type="display_set_label_text" id="Fn{?O{el^_@qD+)BLOev"> - <field name="instance_name">txt_label_goal_both</field> + <block type="display_set_status_indicator_active" id="^O{W3G$em_v6~A^t1K$]"> + <field name="instance_name">txt_status_indicator_goal_right</field> <value name="value"> - <shadow type="text" id="}wMC[[!{mYT9LBcx}EtT"> - <field name="TEXT">abc</field> + <shadow type="logic_boolean"> + <field name="BOOL">TRUE</field> </shadow> - <block type="text_format" id="zV,[,3k$`H2B5D[4-c.d"> - <mutation items="2"/> - <value name="value"> - <shadow type="text" id="pLr%-2L|$X9_^)k~m;J("> - <field name="TEXT">p:{}, w:{}</field> - </shadow> - </value> - <value name="ADD0"> - <block type="variables_get" id="1/;a8^BqFI^^?=Ea;HdL"> - <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field> + <block type="logic_compare" id="2S2X?GGT8}tBgMGb3x=["> + <field name="OP">NEQ</field> + <value name="A"> + <block type="variables_get" id="4yKol;}{*yD|UJzvYN83"> + <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> </block> </value> - <value name="ADD1"> - <block type="variables_get" id="CD]^^%xF/1z=fT)6mSMr"> - <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field> - </block> + <value name="B"> + <block type="logic_null" id="?MiF_jh!]il%Rhf3lN~~"/> </value> </block> </value> <next> - <block type="variables_set" id="6x+{VP+wdcN`Z%}[I.!L"> - <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> - <value name="VALUE"> - <block type="lists_create_with" id="LDomGXVQ/3v0~^mXO=H:"> - <mutation items="3"/> + <block type="display_set_label_text" id="QDZ)v?E3iW-Liq4HKvUn"> + <field name="instance_name">txt_label_ball</field> + <value name="value"> + <shadow type="text" id="B`M|)AOBioxQGjue#9y^"> + <field name="TEXT">abc</field> + </shadow> + <block type="text_format" id="bMzX7EzL+}J^dowK5pv|"> + <mutation items="2"/> + <value name="value"> + <shadow type="text" id="(C2/oN~6=q7Bw[A5`Pz)"> + <field name="TEXT">x:{} y:{}</field> + </shadow> + </value> <value name="ADD0"> - <block type="math_arithmetic" id="t680,3~Y1s!r4H9oe8JV"> - <field name="OP">MINUS</field> - <value name="A"> - <block type="util_runtime_measurement" id="j%rmr;8@Az.]O/{}Y4_U"> - <field name="TIME">MILLISECOND</field> - </block> - </value> - <value name="B"> - <block type="variables_get" id="C/5XJ8aZmH}nTu/c{K/3"> - <field name="VAR" id="v3eHF0atAL+ouaa{W$=m">ts_ball</field> - </block> - </value> + <block type="variables_get" id="N3bK$!XutDL@t?7tqOnB"> + <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> </block> </value> <value name="ADD1"> - <block type="math_arithmetic" id="$d!a-N+BUJRl4UwINuSA"> - <field name="OP">MINUS</field> - <value name="A"> - <block type="util_runtime_measurement" id="(V|oNw#p7uI.IS-0bNIb"> - <field name="TIME">MILLISECOND</field> - </block> - </value> - <value name="B"> - <block type="variables_get" id="^|.#)!4#E5}RC4|@nT=E"> - <field name="VAR" id=";Ki:[qYaZnowqSa`]/aW">ts_goal_left</field> - </block> - </value> - </block> - </value> - <value name="ADD2"> - <block type="math_arithmetic" id="g-kAJ}l^chb1#7`^GN})"> - <field name="OP">MINUS</field> - <value name="A"> - <block type="util_runtime_measurement" id="f}EvEIL!N;0K~[,Yj{i|"> - <field name="TIME">MILLISECOND</field> - </block> - </value> - <value name="B"> - <block type="variables_get" id="(VfxxD;J|pK4hJH~.L#:"> - <field name="VAR" id="z^z{Ev+IMfS6[W1raY;l">ts_goal_right</field> - </block> - </value> + <block type="variables_get" id="CIUI@k|{^~}vfJeTSYP2"> + <field name="VAR" id="q#H`+Gwt~43Dh@fu;G-D">posy_ball</field> </block> </value> </block> </value> <next> - <block type="text_print" id="##1hG%c^2!NKjN~e1lyg"> - <value name="TEXT"> - <shadow type="text" id="p_E`2=Fj^pN,D}gxPEvW"> - <field name="TEXT"/> + <block type="display_set_label_text" id="2Ac72_SmdOYaC#|w[dk%"> + <field name="instance_name">txt_label_goal_left</field> + <value name="value"> + <shadow type="text"> + <field name="TEXT">abc</field> </shadow> - <block type="text_format" id="mB*d7.SSna@S_Ds5Y4[o"> - <mutation items="15"/> + <block type="text_format" id="xXJlH+s%1,D1WcfOkt#6"> + <mutation items="2"/> <value name="value"> - <shadow type="text" id="a{L7ErJR}=Flx|}3~+X4"> - <field name="TEXT">{:.1f} {:.1f} {:.1f} {}:{} GOAL left: {} {}, right:{} {}, p:{}, w:{} BALL_pos:{},{} v_x:{} v_y:{}</field> + <shadow type="text" id=":(AhX7mg_fQeOGz*xR@g"> + <field name="TEXT">x:{} y:{}</field> </shadow> </value> <value name="ADD0"> - <block type="lists_getIndex" id="CbdeIGK@44m#g.!M[#x$"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="}7jQPibx;u0_gP;A]},T"> - <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> - </block> - </value> - <value name="AT"> - <block type="math_number" id="[Wss|q41wTq{v=?|sD.f"> - <field name="NUM">1</field> - </block> - </value> + <block type="variables_get" id="ppSdz+]@cvkJ)r-5HdD^"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> </block> </value> <value name="ADD1"> - <block type="lists_getIndex" id="2]ZTjNwL+l|+n=]^@kBa"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="4AF^Nf7uzZK##!V!tCyY"> - <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> - </block> - </value> - <value name="AT"> - <block type="math_number" id="`!LwlvmfWrC[X9}c`xAy"> - <field name="NUM">2</field> - </block> - </value> + <block type="variables_get" id="Fe?~n3W$cZh6_K]^Dsyx"> + <field name="VAR" id="a8;eFhj+gj?)7exUyU;p">posy_goal_left</field> </block> </value> - <value name="ADD2"> - <block type="lists_getIndex" id="4C()}[ATkY^*1!#aVh,d"> - <mutation statement="false" at="true"/> - <field name="MODE">GET</field> - <field name="WHERE">FROM_START</field> - <value name="VALUE"> - <block type="variables_get" id="L_TvMk8V]tf,^rAwG;{_"> - <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> + </block> + </value> + <next> + <block type="display_set_label_text" id="a{S3p;wE$+yu^C@/gbFc"> + <field name="instance_name">txt_label_goal_right</field> + <value name="value"> + <shadow type="text"> + <field name="TEXT">abc</field> + </shadow> + <block type="text_format" id="aM8~sP`fYChiSu}cXXcR"> + <mutation items="2"/> + <value name="value"> + <shadow type="text" id="iEm4r;N9H6ZV_0W/huA7"> + <field name="TEXT">x:{} y:{}</field> + </shadow> + </value> + <value name="ADD0"> + <block type="variables_get" id="86hRDB1XQ4so2N5SUnF_"> + <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> </block> </value> - <value name="AT"> - <block type="math_number" id="LTfrlTDNfb/=}Ze]-s^V"> - <field name="NUM">3</field> + <value name="ADD1"> + <block type="variables_get" id="%A3W)E/]zAMtqytEd%-*"> + <field name="VAR" id="+j/X+RCIMajR28(u#7DG">posy_goal_right</field> </block> </value> </block> </value> - <value name="ADD3"> - <block type="variables_get" id="UGc[vu*b~9D^!p.3?7mo"> - <field name="VAR" id="vH;^OzJY7dOdepMScU1s">state</field> - </block> - </value> - <value name="ADD4"> - <block type="variables_get" id="wVt[k#I:X+:T`RVkRf]K"> - <field name="VAR" id="fPH`.@]riH+=v{,A)bP5">cmd</field> - </block> - </value> - <value name="ADD5"> - <block type="variables_get" id="+?O{K7(C)vw`Y6!T4L(o"> - <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> - </block> - </value> - <value name="ADD6"> - <block type="variables_get" id="kiYnqn=QqrO`bh^F{AQ#"> - <field name="VAR" id="a8;eFhj+gj?)7exUyU;p">posy_goal_left</field> - </block> - </value> - <value name="ADD7"> - <block type="variables_get" id="/(B3zJewppd~EofXj-kV"> - <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> - </block> - </value> - <value name="ADD8"> - <block type="variables_get" id=",3+x;7D(bN-41WySQn.v"> - <field name="VAR" id="+j/X+RCIMajR28(u#7DG">posy_goal_right</field> - </block> - </value> - <value name="ADD9"> - <block type="variables_get" id="u$4~ei085+j]JF61p!Kz"> - <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field> - </block> - </value> - <value name="ADD10"> - <block type="variables_get" id="#umK_pdUK0;[tcAYO_7s"> - <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field> - </block> - </value> - <value name="ADD11"> - <block type="variables_get" id="sPxj5C*ZzYUH*$WCe4|q"> - <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> - </block> - </value> - <value name="ADD12"> - <block type="variables_get" id="~vY0WPr#jWq#SxvDb1@n"> - <field name="VAR" id="q#H`+Gwt~43Dh@fu;G-D">posy_ball</field> - </block> - </value> - <value name="ADD13"> - <block type="variables_get" id="r!O8lsSDk:Xs*=-;)LRu"> - <field name="VAR" id="O=Lc:FQ[]f3iuM/V@.mv">v_var_ball_xpos</field> - </block> - </value> - <value name="ADD14"> - <block type="variables_get" id="`fG05b:bzq8[q?bquCg6"> - <field name="VAR" id=";S3?%3)**s[[l~Aq3*,{">v_var_ball_ypos</field> - </block> - </value> - </block> - </value> - <next> - <block type="procedures_callnoreturn" id="O6U,(~H4n-^0fP^x)_,{"> - <mutation name="checkTimeoutsSetGoalBoth"/> <next> - <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 type="display_set_label_text" id="Fn{?O{el^_@qD+)BLOev"> + <field name="instance_name">txt_label_goal_both</field> + <value name="value"> + <shadow type="text" id="}wMC[[!{mYT9LBcx}EtT"> + <field name="TEXT">abc</field> + </shadow> + <block type="text_format" id="zV,[,3k$`H2B5D[4-c.d"> + <mutation items="2"/> + <value name="value"> + <shadow type="text" id="pLr%-2L|$X9_^)k~m;J("> + <field name="TEXT">x:{}, width:{}</field> + </shadow> + </value> + <value name="ADD0"> + <block type="variables_get" id="1/;a8^BqFI^^?=Ea;HdL"> + <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field> </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> + <value name="ADD1"> + <block type="variables_get" id="CD]^^%xF/1z=fT)6mSMr"> + <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field> + </block> + </value> + </block> + </value> + <next> + <block type="text_print" id="##1hG%c^2!NKjN~e1lyg"> + <value name="TEXT"> + <shadow type="text" id="p_E`2=Fj^pN,D}gxPEvW"> + <field name="TEXT"/> + </shadow> + <block type="text_format" id="mB*d7.SSna@S_Ds5Y4[o"> + <mutation items="15"/> + <value name="value"> + <shadow type="text" id="a{L7ErJR}=Flx|}3~+X4"> + <field name="TEXT">{:.1f} {:.1f} {:.1f} {}:{} GOAL left: {} {}, right:{} {}, p:{}, w:{} BALL_pos:{},{} v_x:{} v_y:{}</field> + </shadow> + </value> + <value name="ADD0"> + <block type="lists_getIndex" id="CbdeIGK@44m#g.!M[#x$"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="}7jQPibx;u0_gP;A]},T"> + <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="[Wss|q41wTq{v=?|sD.f"> + <field name="NUM">1</field> </block> </value> - <value name="B"> - <block type="logic_null" id="rDzB|:95l=q`!x,aL@3W"/> + </block> + </value> + <value name="ADD1"> + <block type="lists_getIndex" id="2]ZTjNwL+l|+n=]^@kBa"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="4AF^Nf7uzZK##!V!tCyY"> + <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> + </block> + </value> + <value name="AT"> + <block type="math_number" id="`!LwlvmfWrC[X9}c`xAy"> + <field name="NUM">2</field> + </block> </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> + <value name="ADD2"> + <block type="lists_getIndex" id="4C()}[ATkY^*1!#aVh,d"> + <mutation statement="false" at="true"/> + <field name="MODE">GET</field> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get" id="L_TvMk8V]tf,^rAwG;{_"> + <field name="VAR" id="4w5r@LJD+|NUZ5,*H@JC">ts_deltas</field> </block> </value> - <value name="B"> - <block type="logic_null" id="M$0*hkR:/MNk}_}~4+oB"/> + <value name="AT"> + <block type="math_number" id="LTfrlTDNfb/=}Ze]-s^V"> + <field name="NUM">3</field> + </block> </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> + <value name="ADD3"> + <block type="variables_get" id="UGc[vu*b~9D^!p.3?7mo"> + <field name="VAR" id="vH;^OzJY7dOdepMScU1s">state</field> + </block> + </value> + <value name="ADD4"> + <block type="variables_get" id="wVt[k#I:X+:T`RVkRf]K"> + <field name="VAR" id="fPH`.@]riH+=v{,A)bP5">cmd</field> + </block> + </value> + <value name="ADD5"> + <block type="variables_get" id="+?O{K7(C)vw`Y6!T4L(o"> + <field name="VAR" id="=2ARo+;2DS07SU~j29Fk">posx_goal_left</field> + </block> + </value> + <value name="ADD6"> + <block type="variables_get" id="kiYnqn=QqrO`bh^F{AQ#"> + <field name="VAR" id="a8;eFhj+gj?)7exUyU;p">posy_goal_left</field> + </block> + </value> + <value name="ADD7"> + <block type="variables_get" id="/(B3zJewppd~EofXj-kV"> + <field name="VAR" id="7Tp~7_.qfmJN0SR]5p}F">posx_goal_right</field> + </block> + </value> + <value name="ADD8"> + <block type="variables_get" id=",3+x;7D(bN-41WySQn.v"> + <field name="VAR" id="+j/X+RCIMajR28(u#7DG">posy_goal_right</field> + </block> + </value> + <value name="ADD9"> + <block type="variables_get" id="u$4~ei085+j]JF61p!Kz"> + <field name="VAR" id="{]]L-TSC^#XtGnVinxf[">posx_goal_both</field> + </block> + </value> + <value name="ADD10"> + <block type="variables_get" id="#umK_pdUK0;[tcAYO_7s"> + <field name="VAR" id="v0BvP7[91TGaMpQG$r0f">goal_width</field> + </block> + </value> + <value name="ADD11"> + <block type="variables_get" id="sPxj5C*ZzYUH*$WCe4|q"> + <field name="VAR" id="S4.mduNQC(va3iR{oSdB">posx_ball</field> + </block> + </value> + <value name="ADD12"> + <block type="variables_get" id="~vY0WPr#jWq#SxvDb1@n"> + <field name="VAR" id="q#H`+Gwt~43Dh@fu;G-D">posy_ball</field> + </block> + </value> + <value name="ADD13"> + <block type="variables_get" id="r!O8lsSDk:Xs*=-;)LRu"> + <field name="VAR" id="O=Lc:FQ[]f3iuM/V@.mv">v_var_ball_xpos</field> + </block> + </value> + <value name="ADD14"> + <block type="variables_get" id="`fG05b:bzq8[q?bquCg6"> + <field name="VAR" id=";S3?%3)**s[[l~Aq3*,{">v_var_ball_ypos</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> + </next> </block> </next> </block> @@ -1381,6 +1338,89 @@ </block> </next> </block> + </statement> + <next> + <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> </next> @@ -1445,7 +1485,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="En/f/xqq^SH?wf?Q!C!`" x="0" y="4467"> + <block type="procedures_defnoreturn" id="En/f/xqq^SH?wf?Q!C!`" x="0" y="4575"> <field name="NAME">stepOnlyGoal</field> <statement name="STACK"> <block type="controls_if" id="zah5aZ58,g+zkkR*Mxzn"> @@ -1679,7 +1719,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="BJV|hZc!#JXq:io7MmM`" x="0" y="5408"> + <block type="procedures_defnoreturn" id="BJV|hZc!#JXq:io7MmM`" x="0" y="5516"> <mutation> <arg name="shot" varid="ymkMx:g,wGvcvRtYUanL" argid=":62/?4I]sXmWy2!AnMxj"/> </mutation> @@ -2044,7 +2084,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="6647"> + <block type="procedures_defnoreturn" id="N2EC5uK:$~0ERXAdK0!y" x="0" y="6755"> <field name="NAME">checkTimeoutsSetGoalBoth</field> <statement name="STACK"> <block type="controls_if" id="fRY+n0,2r=7:t9`dVQYz"> @@ -2284,7 +2324,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="7382"> + <block type="camera_on_ball_detected" id="dgC*A|KHMC_R5S#ZRk}d" x="0" y="7490"> <field name="instance_name">ball_detector</field> <statement name="statement"> <block type="variables_set" id="=2/,IQfcLO{_5PNd3UK~"> @@ -2485,7 +2525,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="8049"> + <block type="camera_on_ball_detected" id="Rg2Gt(0WT:J2|Us~[j.3" x="0" y="8157"> <field name="instance_name">ball_detector_goal_left</field> <statement name="statement"> <block type="variables_set" id="kvK,D4e%04[?+!jq*Lch"> @@ -2566,7 +2606,7 @@ </block> </statement> </block> - <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="8380"> + <block type="camera_on_ball_detected" id="(?slhGsN^:d1`vP{j9#|" x="0" y="8488"> <field name="instance_name">ball_detector_goal_right</field> <statement name="statement"> <block type="variables_set" id="0!1?#@4|tcM8+U6E[$Tl"> @@ -2647,7 +2687,7 @@ </block> </statement> </block> - <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="8711"> + <block type="input_event" id="j(TuhJ0G}{^qGSq:26FY" x="0" y="8819"> <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> @@ -2670,7 +2710,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8848"> + <block type="procedures_defnoreturn" id="RyK*td9aN5aR;@gw4f)+" x="0" y="8956"> <field name="NAME">shotBall</field> <statement name="STACK"> <block type="variables_set" id="l,2u2WF|]I#%kDS#5O7-"> @@ -2782,7 +2822,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="na=DVwj{P1Npv6z`ZSY{" x="0" y="9405"> + <block type="procedures_defnoreturn" id="na=DVwj{P1Npv6z`ZSY{" x="0" y="9513"> <field name="NAME">soundGoal</field> <statement name="STACK"> <block type="variables_set" id="o^c1yss2pIv%8YmX`=6X"> @@ -2823,7 +2863,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="9599"> + <block type="procedures_defnoreturn" id="UFM0X7|X:*ja#f+^7kz;" x="0" y="9707"> <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["/> @@ -2920,7 +2960,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="10012"> + <block type="procedures_defnoreturn" id="*i[s2YTWD*g9HS4dxkPq" x="0" y="10120"> <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"/> @@ -3017,7 +3057,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" x="0" y="10425"> + <block type="procedures_defnoreturn" id="oSa9Ly*^-c^M{$gkMZt1" x="0" y="10533"> <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{"/> @@ -3093,7 +3133,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" x="0" y="10810"> + <block type="procedures_defnoreturn" id="G@]xamrhDPW$7uQ6oPo#" x="0" y="10918"> <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"/> @@ -3169,7 +3209,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="11195"> + <block type="procedures_defnoreturn" id="5Hv=PFtVvPQA=IZrkJfU" x="0" y="11303"> <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"/> @@ -3260,7 +3300,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11636"> + <block type="procedures_defnoreturn" id="[S@[MO!Z/cNt:Jsg4dd}" x="0" y="11744"> <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 8e0879c..b1c5b27 100644 --- a/omniwheels_x4_soccer_goal.py +++ b/omniwheels_x4_soccer_goal.py @@ -34,10 +34,11 @@ v_fast = None y_ball_touch = None v_var_ball_ypos = None y_ball_near = None +ts_last_print = None search_dir_left = None ts_deltas = None def checkTimeoutsSetGoalBoth(): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas if posx_goal_left != None and posx_goal_right != None: goal_width = posx_goal_right - posx_goal_left posx_goal_both = posx_goal_left + goal_width / 2 @@ -57,7 +58,7 @@ 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas 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: @@ -77,7 +78,7 @@ def stepOnlyGoal(): def stepBall(shot): - global 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas state = 'stepBall' if posx_ball < x_min: left(v_slow, round(math.fabs(posx_ball) * 0.07)) @@ -99,7 +100,7 @@ def stepBall(shot): def ball_callback(event): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas ts_ball = (time.time() * 1000) posx_ball = event.value.x posy_ball = event.value.y @@ -112,7 +113,7 @@ ball_detector.add_detection_listener(ball_callback) def ball_callback2(event): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas ts_goal_left = (time.time() * 1000) posx_goal_left = event.value.x posy_goal_left = event.value.y @@ -123,7 +124,7 @@ ball_detector_goal_left.add_detection_listener(ball_callback2) def ball_callback23(event): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas ts_goal_right = (time.time() * 1000) posx_goal_right = event.value.x posy_goal_right = event.value.y @@ -134,7 +135,7 @@ ball_detector_goal_right.add_detection_listener(ball_callback23) def callback(event): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas if TXT_M_I8_photo_transistor.is_dark(): shotBall() time.sleep(5) @@ -144,7 +145,7 @@ TXT_M_I8_photo_transistor.add_change_listener("dark", callback) def shotBall(): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'shotBall' TXT_M_S1_servomotor.set_position(int(400)) TXT_M_M1_encodermotor.set_speed(int(512), Motor.CCW) @@ -171,7 +172,7 @@ def shotBall(): def soundGoal(): - 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'soundGOAL' TXT_M.get_loudspeaker().play("26_Augenzwinkern.wav", False) display.set_attr("txt_switch_ball.checked", str(False).lower()) @@ -182,7 +183,7 @@ def soundGoal(): def turnSideLeft(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'turnSideLeft' if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CCW) @@ -198,7 +199,7 @@ def turnSideLeft(v, ticks): def turnSideRight(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'turnSideRight' if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CW) @@ -214,7 +215,7 @@ def turnSideRight(v, ticks): def fwd(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'fwd' if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v), Motor.CCW) @@ -229,7 +230,7 @@ def fwd(v, ticks): def bwd(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'bwd' if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v), Motor.CW) @@ -244,7 +245,7 @@ def bwd(v, ticks): def left(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'left ({}, {})'.format(v, ticks) if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v), Motor.CCW) @@ -259,7 +260,7 @@ def left(v, ticks): def right(v, ticks): - global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, 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 + global shot, 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, v_slow, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, ts_last_print, search_dir_left, ts_deltas cmd = 'right ({}, {})'.format(v, ticks) if ticks >= 1: TXT_M_M1_encodermotor.set_speed(int(v), Motor.CW) @@ -295,10 +296,10 @@ posy_ball = None ts_ball = (time.time() * 1000) ts_goal_left = (time.time() * 1000) ts_goal_right = (time.time() * 1000) +ts_last_print = (time.time() * 1000) search_dir_left = True state = 'NONE' cmd = 'NONE' -time.sleep(2) while True: if display.get_attr("txt_switch_ball.checked"): display.set_attr("txt_switch_goal.checked", str(False).lower()) @@ -343,16 +344,18 @@ while True: elif display.get_attr("txt_switch_goal.checked"): display.set_attr("txt_switch_ball.checked", str(False).lower()) stepOnlyGoal() - display.set_attr("txt_status_indicator_ball.active", str(posx_ball != None).lower()) - display.set_attr("txt_status_indicator_goal_left.active", str(posx_goal_left != None).lower()) - display.set_attr("txt_status_indicator_goal_right.active", str(posx_goal_right != None).lower()) - display.set_attr("txt_label_ball.text", str('x:{}, y:{}'.format(posx_ball, posy_ball))) - display.set_attr("txt_label_goal_left.text", str('{} {}'.format(posx_goal_left, posy_goal_left))) - display.set_attr("txt_label_goal_right.text", str('{} {}'.format(posx_goal_right, posy_goal_right))) - display.set_attr("txt_label_goal_both.text", str('p:{}, w:{}'.format(posx_goal_both, goal_width))) - 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() + ts_deltas = [(time.time() * 1000) - ts_ball, (time.time() * 1000) - ts_goal_left, (time.time() * 1000) - ts_goal_right] + if (time.time() * 1000) - ts_last_print > 200: + ts_last_print = (time.time() * 1000) + display.set_attr("txt_status_indicator_ball.active", str(posx_ball != None).lower()) + display.set_attr("txt_status_indicator_goal_left.active", str(posx_goal_left != None).lower()) + display.set_attr("txt_status_indicator_goal_right.active", str(posx_goal_right != None).lower()) + display.set_attr("txt_label_ball.text", str('x:{} y:{}'.format(posx_ball, posy_ball))) + display.set_attr("txt_label_goal_left.text", str('x:{} y:{}'.format(posx_goal_left, posy_goal_left))) + display.set_attr("txt_label_goal_right.text", str('x:{} y:{}'.format(posx_goal_right, posy_goal_right))) + display.set_attr("txt_label_goal_both.text", str('x:{}, width:{}'.format(posx_goal_both, goal_width))) + 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)) if posx_ball != None and posx_goal_left != None and posx_goal_right != None: time.sleep(min(ts_deltas) / 1000) else: -- GitLab