Week 2: Robotics

One sensor I wanted to try was the robot’s sense of it being picked up. I find this to be a very interesting concept because it means that the machinery can calculate the pressure put upon the wheels and determine that if there is no tension then it must be off the ground. I first started by going to the sense category to select the function “mBot is picked up”. Since there are two options for the robot (being picked up and being left on the ground), I needed a control structure that would allow for different variables. I chose the “if / then / else” format and put the sense of being picked up as an attachment to “if” because it is what I am testing/trying to conduct. When the robot is picked up, it will flash red lights (the universal color for “stop”) and its wheels will turn as if to say, “Let me go!”. If the robot was on the ground, its lights would turn yellow (as a warning to anyone that may even think about picking it up) and it would stop moving. As seen in the video, the sensor worked well and the robot was very quick to detecting pressure in terms of whether it is on the ground or not.

https://drive.google.com/file/d/1_LqyGZ0FlSOcqYdn_AQPVOeFWqoe3RJ_/view?usp=sharing

For the “line follower sensor” task, I used the loop mat that came with the robot kit because it had a thick black line for the robot to follow. When I looked under the sense categories, I noticed that the option even had the color black in its title, so I selected “black line detected”. Since the sensor has to pick up on a variable, and won’t do so all the time, I used the “if / then / else” structure again. I found it kind of difficult to get the timing and speed right because if the robot was too fast or turned too much, then it would pass over the line. I played around with these different factors and decided that the robot should move forward more than it moved right (in a clockwise motion around the loop). To make the robot stay on the line, I also had to decrease the speed for the right turns so it would only turn slightly. In order to be aware when the robot no longer sensed the line (due to a sharp turn or bump in the paper) I programmed it to stop moving and light up green. This allowed me to determine that if the robot stopped AND turned green then it’s stopping wasn’t a coding error, but a step in the sensing process.

https://drive.google.com/file/d/1p75Mls6gtsV43ipD8pnUGMyqvi_3ytgN/view?usp=sharing

My favorite sensor task was the “ultrasonic sensor” activity. I was able to understand how the sensor functioned by using my prior knowledge of sonar (that bats and whales use) and the term “distance” in the sensor title. I noticed that there was nowhere to put the distance number, so I figured that this would be my first time to use the math category. First, I wanted to code what would happen if there was nothing directly in front of the robot. Since I needed two different math formulas, I used two “if / then” structures instead of one “if / then / else”. I had to try a variety of different numbers for the math equations. To do this, I looked at the “ultrasonic sensor” counter at the top right of the screen. I noticed, by using my hand, that anything under 10 was too close to the robot, meaning it could cause harm if the robot where to touch it. I used “less than” and “greater than” symbols to create the two “if / then” equations. I also coded the robot to turn red in order to alert when something was too close to it. I tested this by using one of my dogs’ toys. (Later, my dog stole the toy and brought it to a different room because it didn’t like the robot playing with it.)

https://drive.google.com/file/d/1Xx1BZ3HUkwK24I1Kq-ohBT3MCLwcLvNE/view?usp=sharing

The task I found to be most entertaining was the “light sensor” activity because it felt as if I was catching the robot doing something “naughty”. I wanted the robot to light up when it was dark, and turn off its lights when it was light. I used the “strength of light” sensor and another math equation. Using the “light sensor” counter at the top right, I noticed that the robot sensed light amounts up to 999. So, I decided that if the strength of light were to be less than half of that (which I wrote as 500), then the lights should come on and keep blinking until the strength of light greatly changes. I enjoyed switching the lights on and off for different amounts of time and for different intervals because it showed that the code will work even in an ever changing environment.

https://drive.google.com/file/d/1xcHyTpq04mVa_cNltLBV00qDTsWh3JxX/view?usp=sharing

    • Gerald Ardito
      Gerald Ardito

      Skyler,

      This is all great work.

      And, once again, your reflection does a terrific job capturing your thinking and working processes.

    Computer Science for Teachers Spring 2019

    Computer Science for Teachers Spring 2019

    Here is the online home for CS for Teachers at Pace University for Spring 2019.

    Latest comments