Skip to content
Snippets Groups Projects
Commit 286818b0 authored by ft-Demo's avatar ft-Demo
Browse files

commit by robo pro coding

parent 1f0d9624
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ TXT_M_USB_1_camera.set_width(320)
TXT_M_USB_1_camera.set_fps(15)
TXT_M_USB_1_camera.start()
ball_detector = txt_factory.camera_factory.create_ball_detector(0, 0, 320, 240, 5, 80, -100, 100, [200,113,52], 20)
ball_detector = txt_factory.camera_factory.create_ball_detector(0, 0, 320, 240, 5, 80, -100, 100, [223,151,123], 20)
TXT_M_USB_1_camera.add_detector(ball_detector)
blocked_area_right = txt_factory.camera_factory.create_blocked_area(240, 190, 80, 50)
......@@ -20,6 +20,6 @@ TXT_M_USB_1_camera.add_blocked_area(blocked_area_left)
ball_detector_goal_right = txt_factory.camera_factory.create_ball_detector(0, 70, 320, 120, 10, 120, -100, 100, [183,137,26], 20)
TXT_M_USB_1_camera.add_detector(ball_detector_goal_right)
ball_detector_goal_left = txt_factory.camera_factory.create_ball_detector(0, 70, 320, 120, 10, 120, -100, 100, [57,117,47], 20)
ball_detector_goal_left = txt_factory.camera_factory.create_ball_detector(0, 70, 320, 120, 10, 120, -100, 100, [109,152,108], 20)
TXT_M_USB_1_camera.add_detector(ball_detector_goal_left)
<xml type="camera" verion="1" version="2" rotate="0" height="240" width="320" fps="15"><item id="2" class="BallDetector"><name>ball_detector</name><color>#c87134</color><tolerance>20</tolerance><min_ball_diameter>5</min_ball_diameter><max_ball_diameter>80</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>0</y><width>320</width><height>240</height></geometry></item><item id="4" class="BlockedArea"><name>blocked_area_right</name><geometry><x>240</x><y>190</y><width>80</width><height>50</height></geometry></item><item id="5" class="BlockedArea"><name>blocked_area_left</name><geometry><x>0</x><y>190</y><width>80</width><height>50</height></geometry></item><item id="12" class="BallDetector"><name>ball_detector_goal_right</name><color>#b7891a</color><tolerance>20</tolerance><min_ball_diameter>10</min_ball_diameter><max_ball_diameter>120</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>70</y><width>320</width><height>120</height></geometry></item><item id="11" class="BallDetector"><name>ball_detector_goal_left</name><color>#39752f</color><tolerance>20</tolerance><min_ball_diameter>10</min_ball_diameter><max_ball_diameter>120</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>70</y><width>320</width><height>120</height></geometry></item></xml>
\ No newline at end of file
<xml type="camera" verion="1" version="2" rotate="0" height="240" width="320" fps="15"><item id="2" class="BallDetector"><name>ball_detector</name><color>#df977b</color><tolerance>20</tolerance><min_ball_diameter>5</min_ball_diameter><max_ball_diameter>80</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>0</y><width>320</width><height>240</height></geometry></item><item id="4" class="BlockedArea"><name>blocked_area_right</name><geometry><x>240</x><y>190</y><width>80</width><height>50</height></geometry></item><item id="5" class="BlockedArea"><name>blocked_area_left</name><geometry><x>0</x><y>190</y><width>80</width><height>50</height></geometry></item><item id="12" class="BallDetector"><name>ball_detector_goal_right</name><color>#b7891a</color><tolerance>20</tolerance><min_ball_diameter>10</min_ball_diameter><max_ball_diameter>120</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>70</y><width>320</width><height>120</height></geometry></item><item id="11" class="BallDetector"><name>ball_detector_goal_left</name><color>#6d986c</color><tolerance>20</tolerance><min_ball_diameter>10</min_ball_diameter><max_ball_diameter>120</max_ball_diameter><start_range_value>-100</start_range_value><end_range_value>100</end_range_value><geometry><x>0</x><y>70</y><width>320</width><height>120</height></geometry></item></xml>
\ No newline at end of file
......@@ -12,14 +12,14 @@ TXTWindow {
anchors.fill: parent
}
TXTSwitch {
id: txt_switch_active
text: "START"
id: txt_switch_ball
text: ""
font.pixelSize: 16
enabled: true
checked: true
x: 60
y: 178
width: 100
checked: false
x: 170
y: 10
width: 60
height: 40
}
TXTLabel {
......@@ -27,49 +27,77 @@ TXTWindow {
text: "-"
font.pixelSize: 16
elide: Text.ElideRight
x: 60
y: 20
width: 179
x: 50
y: 10
width: 120
height: 40
}
TXTLabel {
id: txt_label_goal
id: txt_label_goal_left
text: "-"
font.pixelSize: 16
elide: Text.ElideRight
x: 60
y: 80
width: 180
x: 50
y: 70
width: 120
height: 40
}
TXTLabel {
id: txt_label_ball_
text: "ball"
id: txt_label_goal_right
text: "-"
font.pixelSize: 16
elide: Text.ElideRight
x: 50
y: 110
width: 120
height: 40
}
StatusIndicator {
id: txt_status_indicator_ball
color: "#FFB700"
active: false
x: 20
y: 20
width: 40
height: 40
width: 20
height: 20
}
TXTLabel {
id: txt_label_goal_
text: "goal"
font.pixelSize: 16
elide: Text.ElideRight
StatusIndicator {
id: txt_status_indicator_goal_left
color: "#19FF00"
active: false
x: 20
y: 80
width: 40
width: 20
height: 20
}
StatusIndicator {
id: txt_status_indicator_goal_right
color: "#F8FF00"
active: false
x: 20
y: 120
width: 20
height: 20
}
TXTSwitch {
id: txt_switch_goal
text: ""
font.pixelSize: 16
enabled: true
checked: false
x: 170
y: 150
width: 60
height: 40
}
TXTLabel {
id: txt_label_goal_x
id: txt_label_goal_both
text: "-"
font.pixelSize: 16
elide: Text.ElideRight
x: 60
y: 120
width: 180
x: 50
y: 150
width: 120
height: 40
}
}
<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>178</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>20</y><width>179</width><height>40</height></geometry></item><item id="6" class="TXTLabel"><name>txt_label_goal</name><text>-</text><geometry><x>60</x><y>80</y><width>180</width><height>40</height></geometry></item><item id="7" class="TXTLabel"><name>txt_label_ball_</name><text>ball</text><geometry><x>20</x><y>20</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>80</y><width>40</width><height>40</height></geometry></item><item id="10" class="TXTLabel"><name>txt_label_goal_x</name><text>-</text><geometry><x>60</x><y>120</y><width>180</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/><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
This diff is collapsed.
......@@ -7,15 +7,15 @@ from lib.camera import *
from fischertechnik.controller.Motor import Motor
shot = None
v = None
ticks = None
shot = None
factor_x = None
state = None
ts_ball = None
ts_goal_left = None
ts_goal_right = None
cmd = None
state = None
factor_y = None
goal_width = None
posx_ball = None
......@@ -27,16 +27,16 @@ posy_ball = None
posy_goal_left = None
posy_goal_right = None
x_max = None
v_var_ball_xpos = None
v_slow = None
v_var_ball_xpos = None
y_ball_far = None
v_var_ball_ypos = None
v_fast = None
y_ball_touch = None
v_var_ball_ypos = None
y_ball_near = None
search_dir_left = None
def checkTimeoutsSetGoalBoth():
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
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
......@@ -56,7 +56,7 @@ def checkTimeoutsSetGoalBoth():
def stepBall(shot):
global v, ticks, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
state = 'stepBall'
if posx_ball < x_min:
left(v_slow, round(math.fabs(posx_ball) * 0.07))
......@@ -78,7 +78,7 @@ def stepBall(shot):
def ball_callback(event):
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
ts_ball = (time.time() * 1000)
posx_ball = event.value.x
posy_ball = event.value.y
......@@ -91,7 +91,7 @@ ball_detector.add_detection_listener(ball_callback)
def ball_callback2(event):
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
ts_goal_left = (time.time() * 1000)
posx_goal_left = event.value.x
posy_goal_left = event.value.y
......@@ -102,7 +102,7 @@ ball_detector_goal_left.add_detection_listener(ball_callback2)
def ball_callback23(event):
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
ts_goal_right = (time.time() * 1000)
posx_goal_right = event.value.x
posy_goal_right = event.value.y
......@@ -113,7 +113,7 @@ ball_detector_goal_right.add_detection_listener(ball_callback23)
def callback(event):
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
if TXT_M_I8_photo_transistor.is_dark():
shotBall()
time.sleep(5)
......@@ -123,7 +123,7 @@ TXT_M_I8_photo_transistor.add_change_listener("dark", callback)
def shotBall():
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'shotBall'
TXT_M_S1_servomotor.set_position(int(400))
TXT_M_M1_encodermotor.set_speed(int(512), Motor.CCW)
......@@ -150,10 +150,10 @@ def shotBall():
def soundGoal():
global v, ticks, shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'soundGOAL'
TXT_M.get_loudspeaker().play("26_Augenzwinkern.wav", False)
display.set_attr("txt_switch_active.checked", str(False).lower())
display.set_attr("txt_switch_ball.checked", str(False).lower())
while True:
if (not (TXT_M.get_loudspeaker().is_playing())):
break
......@@ -161,7 +161,7 @@ def soundGoal():
def turnSideLeft(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'turnSideLeft'
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CCW)
......@@ -177,7 +177,7 @@ def turnSideLeft(v, ticks):
def turnSideRight(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'turnSideRight'
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v_slow), Motor.CW)
......@@ -193,7 +193,7 @@ def turnSideRight(v, ticks):
def fwd(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'fwd'
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v), Motor.CCW)
......@@ -208,7 +208,7 @@ def fwd(v, ticks):
def bwd(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'bwd'
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v), Motor.CW)
......@@ -223,7 +223,7 @@ def bwd(v, ticks):
def left(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'left ({}, {})'.format(v, ticks)
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v), Motor.CCW)
......@@ -238,7 +238,7 @@ def left(v, ticks):
def right(v, ticks):
global shot, factor_x, ts_ball, ts_goal_left, ts_goal_right, cmd, state, 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, x_max, v_var_ball_xpos, v_slow, y_ball_far, v_var_ball_ypos, v_fast, y_ball_touch, y_ball_near, search_dir_left
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, posx_goal_both, posy_ball, posy_goal_left, posy_goal_right, x_max, v_slow, v_var_ball_xpos, y_ball_far, v_fast, y_ball_touch, v_var_ball_ypos, y_ball_near, search_dir_left
cmd = 'right ({}, {})'.format(v, ticks)
if ticks >= 1:
TXT_M_M1_encodermotor.set_speed(int(v), Motor.CW)
......@@ -279,7 +279,7 @@ state = 'NONE'
cmd = 'NONE'
time.sleep(2)
while True:
if display.get_attr("txt_switch_active.checked"):
if display.get_attr("txt_switch_ball.checked"):
if posx_ball != None and posy_ball != None:
if posx_goal_left != None and posx_goal_right != None:
state = 'BALL_GOAL_BOTH'
......@@ -326,9 +326,13 @@ while True:
else:
state = 'NONE'
cmd = 'NONE'
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.text", str('left:{} {}, right:{} {}'.format(posx_goal_left, posy_goal_left, posx_goal_right, posy_goal_right)))
display.set_attr("txt_label_goal_x.text", str('p:{}, w:{}'.format(posx_goal_both, goal_width)))
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)))
print('{}:{} GOAL left: {} {}, right:{} {}, p:{}, w:{} BALL_pos:{},{} v_x:{} v_y:{}'.format(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(0.08)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment