Saturday, August 27, 2016

Lego Mindstorms Programming - Ultra Sonic Sensor

Programming a robot using 'Lego Mindstorms' with Ultra Sonic Sensor
(to detect and avoid hitting objects)
Partner: Jada

Programming: With sound and image
What was the most difficult part of this challenge?
Overall Jada and I were able to effectively program our robot to detect objects and then reverse and rotate it to avoid hitting majority of the objects the it encountered in its path. However while this was true, the most difficult part of this challenge was determining the most accurate order to program the robot. We had difficulties trying to determine what should follow after each step of the programming such as when to stop the robot and then when to turn it around. Also, it was had to actually program the robot to turn around to avoid an object at the right degrees, because it constantly kept turning to close to the objects that it kept hitting them, or too much that it turned completely around so the timing and distance was also a bit of a challenge.

How did you go about solving it??
To solve this dilemma, we decided to break the task down into smaller steps instead of attempting to program the robot all at once, so we could focus on getting each section of the pattern/program correct before moving onto the next stage. We created the pattern section by section, by breaking down the overall aim (which was to program our robot to detect and avoid objects) into smaller steps. First we programmed our robot to move forward, and then for its sensor to detect objects 10cm or less away which we decided as a class. Once it detected something, we programmed the robot to stop which we initially had before the sensor detected objects, however after a few attempts we recognised that we needed it to stop after it detected something so the robot could then reverse backwards, because the ultra sonic sensor needed to send a out a response first and then receive a response back to determine if there where any objects in its path, before it could then stop to move around it. So once we programmed it to stop, and then reverse, we determined that we needed to rotate our robot to avoid the objects in its path. It took several trials and errors attempts as we kept making slight adjustments to the degree which the robot turned, but eventually we reached a degree that turned the robot sufficiently around to avoid the object. Once we completed each step, we moved on with the next step/task until we ultimately created one entire pattern, and then we simply added a loop around the patter so the robot would be programmed to repeat the steps whenever it encountered/detected an object. 

No comments:

Post a Comment