0% found this document useful (0 votes)
6 views2 pages

Dasdadqwdrw

This document outlines the implementation of a PD (Proportional-Derivative) control logic for a LEGO EV3 line follower robot using two infrared sensors. It details sensor placement, variable definitions, algorithm steps for error calculation, and tuning considerations to enhance performance. Additionally, it provides solutions to common problems encountered during operation.

Uploaded by

ssulemanakbar12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Dasdadqwdrw

This document outlines the implementation of a PD (Proportional-Derivative) control logic for a LEGO EV3 line follower robot using two infrared sensors. It details sensor placement, variable definitions, algorithm steps for error calculation, and tuning considerations to enhance performance. Additionally, it provides solutions to common problems encountered during operation.

Uploaded by

ssulemanakbar12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PD Line Follower using LEGO EV3 with Two IR

Sensors

1 Introduction
Using two infrared (IR) sensors for line following allows for better accuracy
and stability compared to a single sensor. The key concepts covered in this
document include:
• Sensor placement
• PD (Proportional-Derivative) control logic
• LEGO EV3-G block programming implementation

2 PD Control Logic
The PD control logic is based on:
• Error Calculation: The difference between the left and right sensor
values.
• Proportional Term (P): Adjusts based on the current error.
• Derivative Term (D): Considers the rate of change of error to prevent
oscillations.

3 Variables Definition
Define the following variables in the LEGO EV3-G software:
• Setpoint: Ideal difference between sensors (typically 0)
• Kp: Proportional gain (e.g., 1.5)
• Kd: Derivative gain (e.g., 1.0)
• Error: Difference between sensor values
• Previous Error: Store error from the previous cycle
• Correction: Steering adjustment based on the PD calculation

1
4 Algorithm Steps
The following sequence should be implemented in an infinite loop:
1. Read values from the left and right IR sensors.
2. Calculate the error:
Error = Left Sensor − Right Sensor (1)

3. Compute the Proportional Term (P):


P = Kp × Error (2)

4. Compute the Derivative Term (D):


D = Kd × (Error − Previous Error) (3)

5. Compute the correction:


Correction = P + D (4)

6. Apply correction to motors using steering control.


7. Update the Previous Error variable.

5 Example Values for Tuning


Recommended initial values:
• Setpoint: 0
• Kp : 1.5
• Kd : 1.0
• Base Speed: 50%

6 Tuning Considerations
• Increase Kp to make the robot more responsive.
• Increase Kd to reduce oscillations.
• Fine-tune values to achieve stable line following.

7 Common Problems and Solutions


Issue Solution
Robot oscillates too much Reduce Kp or increase Kd
Robot reacts too slowly Increase Kp slightly
Robot overcorrects Check sensor alignment and gain values

You might also like