Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced issues in Robotics and Programming Dr. Katerina G. Hadjifotinou Experimental Junior High School of the University of Macedonia.

Similar presentations


Presentation on theme: "Advanced issues in Robotics and Programming Dr. Katerina G. Hadjifotinou Experimental Junior High School of the University of Macedonia."— Presentation transcript:

1 Advanced issues in Robotics and Programming Dr. Katerina G. Hadjifotinou Experimental Junior High School of the University of Macedonia

2 Previous knowledge: 1)Sequence structure 2)Various kinds of Loop structures 3)Sensor input and sound output 4)Simple constructions

3 Selection Structures: 3 kinds 1) Single-alternative selection structure. 2) Dual-alternative selection structure. 3) Case selection structure. Students must know how to: a) Distinguish the difference between each structure and know which structure to use on each occasion. b) Use the Selection Structure in combination with robot’s sensor values. c) Embed one Structure into another.

4 Selection Structures Activity 1: Single selection structure Make the robot say “Red” if the color sensor detects an object with red color. (Use the Switch command to get input from the color sensor. Then use the Sound block and select Red from LEGO Sound Files -> Colors. Put the switch block into an unlimited loop) Activity 2: Dual selection structure The robot says “Red” when the color sensor “sees” red and makes any other noise in any other occasion. Activity 3: Multiple selection structure Extend the switch block in the program by pressing the plus sign on the upper left of the block (appears only in the “Measure Color” option of the switch block) so that the program can detect many colors and the robot say the correct color each time. The recognizable colors by the EV3 color sensor are: black, blue, green, yellow, red, white and brown, so a Case Switch block with up to 7 selections must be constructed. Final worksheet’s question: “If there were no multiple selection switch block how could our robot detect three different colors?” Answer: by embedding one switch block into another!

5 Line-Following Line following is a function very often needed in robotics missions, especially in the various robotics competitions. The implementation of line-following is an excellent occasion for the pupils to familiarize themselves with algorithmic solutions of problems.

6 Line-Following Activity 1: Describing the problem and finding ways to solve it An easy solution: start with the robot’s color sensor not on the line, but exactly on the right border of the line! Then program the robot to make continuous small correction moves forward and left until the sensor sees black. When the sensor sees black, make continuous small correction movements forward and right, until the sensor sees again white, a.s.o. In this way, the robot keeps moving forward with zigzag movements, it’s color sensor being continuously kept over the black line’s right border! Activity 2: Making the algorithm work with LEGO Minstorms EV3

7 Variables: your robot’s memory! Students must know how to: 1) Describe the purpose of using numeric variables in programming 2) Write a sensor value on a numeric variable. 3) Read the value of a numeric variable and use it in a selection command. 4) Make the robot decide on it’s next move depending on it’s environment. 5) Create complex programs with many structures embedded in one another. Activity 1: A robot that decides which way to go Make a robotic vehicle that goes forward until it reaches an obstacle. Then it stops, checks the distance of the open space on it’s left and on it’s right and decides to turn and proceed in that direction, where there is more open space. This can be done by fastening an ultrasonic sensor on a medium motor which, every time the robot stops moving forward, turns the sensor first left and then right in order to scan the open space available and decide on the optimal direction to proceed. BUT: “How will the robot “remember” how much was the distance measured on the left, in order to compare it with that on the robot’s right, measured after the sensor has turned right?”. There comes the introduction to the Variables, as the robot’s memory!

8 Variables: your robot’s memory! Activity 2: Programming the “clever” robot After the sensor turns to the robot’s right, the stored distance must be compared to the newly measured distance and the results must be used in a switch with which the robot will “decide” if it proceeds to the left or to the right. The two structures have to be preceded by a Repeat-Until Loop that will move the robot forward until it reaches an obstacle, and all these blocks have to be included within an unlimited loop, so that this process is repeated. Hint: At the end of each search, the ultrasonic sensor must return to it’s original position (that is, looking straight ahead)

9 But: There’s more to Educational Robotics than LEGO Mindstorms!

10 Cheap! Many more sensors and endless chinese electronics! Endless possibilities in robotic constructions and automations!

11 Programming Arduino Arduino Sketches (C++)

12 Scratch for Arduino

13 Ardublock: best for novices!

14 Thank you for your attention!


Download ppt "Advanced issues in Robotics and Programming Dr. Katerina G. Hadjifotinou Experimental Junior High School of the University of Macedonia."

Similar presentations


Ads by Google