From 3db1a54419ee9e957622f21ffab2e0ddee0c1ee2 Mon Sep 17 00:00:00 2001 From: Sukal Date: Mon, 25 Sep 2023 17:33:31 +0200 Subject: [PATCH] Tested Line Following with different track shape --- .../Programs /Follow_line_color_recognition.py | 4 ++-- .../Follow_line_intensity_reflected_light.py | 14 +++++++------- Follow_the_line/README.md | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Follow_the_line/Programs /Follow_line_color_recognition.py b/Follow_the_line/Programs /Follow_line_color_recognition.py index 98b3932..1a72433 100644 --- a/Follow_the_line/Programs /Follow_line_color_recognition.py +++ b/Follow_the_line/Programs /Follow_line_color_recognition.py @@ -12,8 +12,8 @@ from ev3dev2.led import Leds cs_right = ColorSensor(INPUT_4) cs_left = ColorSensor(INPUT_2) # Motors are outputs -m_left = Motor(OUTPUT_B) -m_right = Motor(OUTPUT_C) +m_left = Motor(OUTPUT_A) +m_right = Motor(OUTPUT_D) leds = Leds() # The motor is initialized to run counter-clockwise (gegen den Uhrzeigersinn) diff --git a/Follow_the_line/Programs /Follow_line_intensity_reflected_light.py b/Follow_the_line/Programs /Follow_line_intensity_reflected_light.py index 3aa8514..94d4b97 100644 --- a/Follow_the_line/Programs /Follow_line_intensity_reflected_light.py +++ b/Follow_the_line/Programs /Follow_line_intensity_reflected_light.py @@ -12,8 +12,8 @@ from ev3dev2.led import Leds cs_right = ColorSensor(INPUT_4) cs_left = ColorSensor(INPUT_2) # Motors are outputs -m_left = Motor(OUTPUT_B) -m_right = Motor(OUTPUT_C) +m_left = Motor(OUTPUT_A) +m_right = Motor(OUTPUT_D) leds = Leds() # The motor is initialized to run counter-clockwise (gegen den Uhrzeigersinn) @@ -21,9 +21,9 @@ m_right.polarity = 'inversed' # use 'normal' to initialize it to run clockwise m_left.polarity = 'inversed' # Defined inputs for the given experiment / enviroment -Line = 1 # min. reflection meassured of line -Floor = 30 # max. reflection meassured of floor -max_speed_percent = 50 # maximum wanted speed percentage (highest possible value 100%) +Line = 3 # min. reflection meassured of line +Floor = 35 # max. reflection meassured of floor +max_speed_percent = 40 # maximum wanted speed percentage (highest possible value 100%) # calculate range range = (Floor - Line) @@ -41,12 +41,12 @@ while True: m_l_speed_percent= max_speed_percent*cs_l_percent m_r_speed_percent= max_speed_percent*cs_r_percent # make sure percentage is not higher than possible (100%) and signal it through lights - if m_l_speed_percent > 100: + if m_l_speed_percent >= 100: m_l_speed_percent = 0 leds.set_color("LEFT", "AMBER") else: leds.set_color("LEFT", "GREEN") - if m_r_speed_percent > 100: + if m_r_speed_percent >= 100: m_r_speed_percent = 0 leds.set_color("RIGHT", "AMBER") else: diff --git a/Follow_the_line/README.md b/Follow_the_line/README.md index 0a0b67b..f62bc16 100644 --- a/Follow_the_line/README.md +++ b/Follow_the_line/README.md @@ -13,8 +13,8 @@ But the program should work with all robots that have one driven wheel per side. #### Motors The used robot drives forward when the wheels turn counter-clockwise. `polarity = 'inversed'` If you use a robot with a clockwise direction of rotation, you need to change the settings in the program. `polarity = 'normal'` -* **Left** Motor: Connected to output-port **B** -* **Right** Motor: Connected to output-port **C** +* **Left** Motor: Connected to output-port **A** +* **Right** Motor: Connected to output-port **D** #### Sensors