From 70a4f575531d49ebadc97d4d8923f51d0fa7e36d Mon Sep 17 00:00:00 2001 From: ft-Demo <fischertechnik-team@fischer.de> Date: Mon, 22 Aug 2022 08:41:21 +0000 Subject: [PATCH] commit by robo pro coding --- .project.json | 2 +- lib/camera.py | 20 ++++++++++---------- lib/camera.xml | 2 +- lib/controller.blockly | 6 +++--- lib/controller.py | 2 +- omniwheels_x4_soccer_goal.blockly | 2 +- omniwheels_x4_soccer_goal.py | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.project.json b/.project.json index ca5e7b2..6861320 100644 --- a/.project.json +++ b/.project.json @@ -1 +1 @@ -{"name":"omniwheels_x4_soccer_goal","mode":"ADVANCED","uuid":"5cee2f40-1592-343a-6d7e-a28532502696"} \ No newline at end of file +{"uuid":"5cee2f40-1592-343a-6d7e-a28532502696","name":"omniwheels_x4_soccer_goal","mode":"ADVANCED","version":"1.0","controller":"TXT4"} \ No newline at end of file diff --git a/lib/camera.py b/lib/camera.py index 397eb0d..ddabe78 100644 --- a/lib/camera.py +++ b/lib/camera.py @@ -2,24 +2,24 @@ from lib.controller import * import fischertechnik.factories as txt_factory -TXT_M_USB_1_camera.set_rotate(False) -TXT_M_USB_1_camera.set_height(240) -TXT_M_USB_1_camera.set_width(320) -TXT_M_USB_1_camera.set_fps(15) -TXT_M_USB_1_camera.start() +TXT_M_USB1_1_camera.set_rotate(False) +TXT_M_USB1_1_camera.set_height(240) +TXT_M_USB1_1_camera.set_width(320) +TXT_M_USB1_1_camera.set_fps(15) +TXT_M_USB1_1_camera.start() 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) +TXT_M_USB1_1_camera.add_detector(ball_detector) blocked_area_right = txt_factory.camera_factory.create_blocked_area(240, 190, 80, 50) -TXT_M_USB_1_camera.add_blocked_area(blocked_area_right) +TXT_M_USB1_1_camera.add_blocked_area(blocked_area_right) blocked_area_left = txt_factory.camera_factory.create_blocked_area(0, 190, 80, 50) -TXT_M_USB_1_camera.add_blocked_area(blocked_area_left) +TXT_M_USB1_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) +TXT_M_USB1_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, [109,152,108], 20) -TXT_M_USB_1_camera.add_detector(ball_detector_goal_left) +TXT_M_USB1_1_camera.add_detector(ball_detector_goal_left) diff --git a/lib/camera.xml b/lib/camera.xml index beff0a7..b1102da 100644 --- a/lib/camera.xml +++ b/lib/camera.xml @@ -1 +1 @@ -<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 +<xml type="camera" verion="1" version="2" rotate="0" height="240" width="320" fps="15" camera_name="TXT_M_USB1_1_camera"><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 diff --git a/lib/controller.blockly b/lib/controller.blockly index f65a367..a6d8ac6 100644 --- a/lib/controller.blockly +++ b/lib/controller.blockly @@ -1,4 +1,4 @@ -<xml xmlns="https://developers.google.com/blockly/xml" version="12"> +<xml xmlns="https://developers.google.com/blockly/xml" version="13"> <block type="txt4_controller" id="sntDv!Tiig{o,Dn5u$|t" x="27" y="27"> <mutation> <arg type="Input" name="Input-0" value="I8"/> @@ -14,7 +14,7 @@ <arg type="Counter" name="Counter-2" value="C3"/> <arg type="Counter" name="Counter-3" value="C4"/> <arg type="I2C" name="I2C-0" value="-"/> - <arg type="USB" name="USB-0" value="USB_1"/> + <arg type="USB" name="USB-0" value="USB1_1"/> <arg type="USB" name="USB-1" value="-"/> </mutation> <field name="mode">0</field> @@ -32,7 +32,7 @@ <field name="Counter-2">C3</field> <field name="Counter-3">C4</field> <field name="I2C-0">-</field> - <field name="USB-0">USB_1</field> + <field name="USB-0">USB1_1</field> <field name="USB-1">-</field> <value name="Input-0"> <block type="photo_transistor" id="_7y+A9(=#S#C#aBLOH:P"/> diff --git a/lib/controller.py b/lib/controller.py index 5a58b8a..5166b1f 100644 --- a/lib/controller.py +++ b/lib/controller.py @@ -23,6 +23,6 @@ TXT_M_C3_motor_step_counter = txt_factory.counter_factory.create_encodermotor_co TXT_M_C3_motor_step_counter.set_motor(TXT_M_M3_encodermotor) TXT_M_C4_motor_step_counter = txt_factory.counter_factory.create_encodermotor_counter(TXT_M, 4) TXT_M_C4_motor_step_counter.set_motor(TXT_M_M4_encodermotor) -TXT_M_USB_1_camera = txt_factory.usb_factory.create_camera(TXT_M, 1) +TXT_M_USB1_1_camera = txt_factory.usb_factory.create_camera(TXT_M, 1) txt_factory.initialized() \ No newline at end of file diff --git a/omniwheels_x4_soccer_goal.blockly b/omniwheels_x4_soccer_goal.blockly index 71c95d9..8d1c54d 100644 --- a/omniwheels_x4_soccer_goal.blockly +++ b/omniwheels_x4_soccer_goal.blockly @@ -1,4 +1,4 @@ -<xml xmlns="https://developers.google.com/blockly/xml" version="12"> +<xml xmlns="https://developers.google.com/blockly/xml" version="13"> <variables> <variable id="ymkMx:g,wGvcvRtYUanL">shot</variable> <variable id="DfDz@$]?^P=(6r:%^xC*">v</variable> diff --git a/omniwheels_x4_soccer_goal.py b/omniwheels_x4_soccer_goal.py index b1c5b27..bf2ab8e 100644 --- a/omniwheels_x4_soccer_goal.py +++ b/omniwheels_x4_soccer_goal.py @@ -1,10 +1,10 @@ -import time import math +import time +from fischertechnik.controller.Motor import Motor +from lib.camera import * from lib.controller import * from lib.display import * -from lib.camera import * -from fischertechnik.controller.Motor import Motor shot = None -- GitLab