# ADVANCED EV 3 PROGRAMMING LESSON Proportional Control By

- Slides: 9

ADVANCED EV 3 PROGRAMMING LESSON Proportional Control By Sanjay and Arvind Seshan

Lesson Objectives Learn what proportional control means and why to use it Learn to apply proportional control to different sensors Prerequisites: Math Blocks, Color Sensor Calibration, Data Wires © 2019 EV 3 Lessons. com, Last edit 07/17/2019 2

Learn and Discuss Proportional Control Let’s start with a game Imagine that you blindfold one teammate. He or She has to get across the room as quickly as they can and stop exactly on a line drawn on the ground The rest of the team has to give the commands. When your teammate is far away, the blindfolded person must move fast and take big steps. But as he gets closer to the line, if he keeps running, he will overshoot. So, you have to tell the blindfolded teammate to go slower and take smaller steps. You have to program the robot in the same way! © 2019 EV 3 Lessons. com, Last edit 07/17/2019 3

What Proportional Control Looks Like The Pseudocode for every proportional control program consists of two stages: Computing an error how far is the robot from a target Making a correction make the robot take an action that is proportional to the error (this is why it is called proportional control). You must multiply the error by a scaling factor to determine the correction. Compute Error © 2019 EV 3 Lessons. com, Last edit 07/17/2019 Make Correction 4

Challenge To learn how to use proportional control, create a Robot Follower program Use proportional control with the ultrasonic sensor to get the robot to stay 15 cm away from the human at all times (even when the human moves) Objective Get to a target distance from human Error How many cm from target location (current_distance – target_distance) © 2019 EV 3 Lessons. com, Last edit 07/17/2019 Correction Move faster based on distance 5

Challenge Compute Error How many cm from target location (current_distance – target_distance) error Compute/Apply Correction Move faster based on distance error © 2019 EV 3 Lessons. com, Last edit 07/17/2019 6

Putting It All Together: Ultrasonic Robot Follower © 2019 EV 3 Lessons. com, Last edit 07/17/2019 7

Discussion Guide 1. What does proportional control mean? Ans. Moving more or less based on how far the robot is from the target distance 2. What do all proportional control code have in common? Ans. Computing an error and making a correction © 2019 EV 3 Lessons. com, Last edit 07/17/2019 8

Credits This tutorial was created by Sanjay Seshan and Arvind Seshan More lessons at www. ev 3 lessons. com This work is licensed under a Creative Commons Attribution. Non. Commercial-Share. Alike 4. 0 International License. © 2019 EV 3 Lessons. com, Last edit 07/17/2019 9

- ADVANCED EV 3 PROGRAMMING LESSON Proportional Control By
- ADVANCED EV 3 PROGRAMMING LESSON Proportional Control By
- ADVANCED EV 3 PROGRAMMING LESSON Proportional Control with
- Control of Motion OnOff Control bangbang Proportional Control
- Proportional and Non Proportional Relationships using Graphs Objective