Wednesday, October 9, 2013

EV3 Wait Block- Ultrasonic Sensor

Last night I spent nearly two hours trying to figure out the introductory program called Stop at Object using the ultrasonic sensor in the Robot Educator.


An ah-ha moment came when I realized that when the wait block's mode for the sensor was changed to "compare" from "change" that I needed to adjust the "less than, greater than" parameter. I felt better about having to teach this on the next day to my students.

There was still something nagging at me though, so I resolved to call up LEGO Education in the morning. I did, and Tim, the fellow I spoke to was extremely helpful. 

My question: What is the exact meaning of the "compare" mode and the "change" on the ultrasonic sensor when using a wait block? I tried the help menu and it was sort of helpful, but I needed to hear it explained from a person. 


Here is what I found out: 
The "Change" setting for the mode refers to a change from an initial reading of the sensor. For example, in the program above: 

Block 1- steering: results in the robot moving forward unlimited (forever) at a positive power parameter of 50. 

Block 2- wait: directs the robot to continue moving forward until the distance to the object has decreased (1) by 11 cm from the original distance detected by the ultrasonic sensor. Therefore it does not matter how far away the object is from the sensor. 

Block 3- steering: directs the robot to stop. 

Block 4- wait: wait for 1 second

Block 5- steering: using a negative power of 50, directs robot to go in reverse for unlimited or forever. 

Block 6- wait: directs robot to continue moving in reverse until the distance from the object has increased (0) by 6 cm from this second starting distance from the object. 

Block 7- steering: directs the robot to stop. 

Example: If robot starts at 25 cm away from object, it will move towards the object until it reaches 14 cm (25 cm - 11 cm). After a 1 second delay, the robot would then move in reverse, 6 cm back from 14 cm from the object to a final position of 20 cm (14 cm + 6 cm) from the object. 

The "Compare" setting was what I was looking for. This setting sets a threshold for the robot to cross before doing something. For example, using this setting a robot will move until it is a certain distance from the object.

There is one crazy thing that happens with the program above. I have put this to my students to figure out as a star-worthy challenge. If the robot is set at a distance from the object less then 11 cm, then it will just move forward forever because it never satisfies the parameter of being able to move 11 cm towards the object. In addition, my students have not figured out that the robots will move the same distance towards the object as long as the robot is 11 cm or more away from the object. If it were 50 cm away from the object, the robot will still only move 11 cm towards the object and then 6 cm back as long as there is not interference by anything in the surroundings. 

This is an excellent puzzle for my students to try and figure out. We'll see how day 2 goes.

No comments:

Post a Comment