From f9a2fb5f2a87b1979b6a1a2ae33045d001637ca5 Mon Sep 17 00:00:00 2001 From: Sp1rk0vD4N Date: Sat, 21 Feb 2026 17:46:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B:=20=D0=BD=D0=B5=D0=B9=D1=80=D0=BE=D0=BD=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=81=D0=B5=D1=82=D1=8C,=20=D0=BF=D0=B0=D1=80=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D1=80=D1=8B=20=D1=80=D0=B5=D0=B3=D1=83=D0=BB?= =?UTF-8?q?=D1=8F=D1=82=D0=BE=D1=80=D0=B0=20=D0=B8=20=D0=BE=D1=82=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=B0=D1=80=D0=BA=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=20=D0=B3=D0=B0=D1=80=D0=B0=D0=B6=20=D1=81?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=BD=D0=B5=D0=B9=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B5=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lesson_10/step_3.py | 12 ++++++++++-- lesson_10/step_4.py | 8 ++++---- lesson_10/step_5_state_machine.py | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lesson_10/step_3.py b/lesson_10/step_3.py index 14a365b..8526130 100644 --- a/lesson_10/step_3.py +++ b/lesson_10/step_3.py @@ -82,7 +82,8 @@ class Step(Node): ) self.declare_parameter( "allowed_classes", - ["red_bou", "yellow_bou"], # defaults + ["green_square"], + #["red_bou", "yellow_bou"], # defaults classes_descriptor ) @@ -317,7 +318,7 @@ class Step(Node): if len(data) < len(self.get_parameter("allowed_classes").value): return None - + """ # Сумма азимутов всех обнаруженных объектов azimuth_sum = sum([azimuth for _, azimuth, _ in data]) @@ -325,6 +326,13 @@ class Step(Node): course = azimuth_sum / len(data) return course + """ + + if not data: + return None + + return data[0][1] + def annotate_result_azimuth(self, annotated_frame: np.ndarray, azimuth: float) -> np.ndarray: """ diff --git a/lesson_10/step_4.py b/lesson_10/step_4.py index 8977aa6..cb88c5f 100644 --- a/lesson_10/step_4.py +++ b/lesson_10/step_4.py @@ -17,18 +17,18 @@ class Step(Node): super().__init__("step_4") # Скорость поворота - range = FloatingPointRange(from_value=0.0, to_value=2.0, step=0.01) + range = FloatingPointRange(from_value=0.0, to_value=10.0, step=0.01) descriptor = ParameterDescriptor(floating_point_range=[range]) - self.declare_parameter("max_angular_speed", 0.15, descriptor) + self.declare_parameter("max_angular_speed", 0.2, descriptor) # Зона нечувствительности по угловой ошибке range = FloatingPointRange(from_value=0.0, to_value=180.0, step=0.01) descriptor = ParameterDescriptor(floating_point_range=[range]) - self.declare_parameter("dead_zone_angle", 5.0, descriptor) + self.declare_parameter("dead_zone_angle", 0.0, descriptor) range = FloatingPointRange(from_value=0.0, to_value=2.0, step=0.01) descriptor = ParameterDescriptor(floating_point_range=[range]) - self.declare_parameter("linear_speed", 0.5, descriptor) + self.declare_parameter("linear_speed", 0.8, descriptor) self.declare_parameter("is_enabled", True) diff --git a/lesson_10/step_5_state_machine.py b/lesson_10/step_5_state_machine.py index c7b35f2..27d86cb 100644 --- a/lesson_10/step_5_state_machine.py +++ b/lesson_10/step_5_state_machine.py @@ -49,9 +49,9 @@ def main(): add_state(SetMotionControllerIsEnabled(c, is_enabled=False), "stop_autopilot_motion", "move_forward") - add_state(PublishTwist(c, twist_list=(1.0, -0.05), duration_s=10), "move_forward", {"done": "search_gate"}) + add_state(PublishTwist(c, twist_list=(1.0, 0.0), duration_s=1), "move_forward", {"done": "search_gate"}) - add_state(SearchGate(c, angular_speed=-0.15), "search_gate", {"detect": "start_autopilot_motion"}) + add_state(SearchGate(c, angular_speed=0.15), "search_gate", {"detect": "start_autopilot_motion"}) add_state(SetMotionControllerIsEnabled(c, is_enabled=True), "start_autopilot_motion", "start") -- GitLab