Dealer's Choice - The wheels on the bot go round and round....

For the dealer's choice I wanted to move past the idea of the robot just moving around - I wanted it to be used to perform work. So I opted to make the robot stationary, and use the servos to create action on non-moving objects. In this case, I created an elevator. The obstacle sensor senses a "rider", flashes the LEDs, and then opens the door, waits for 1 second, closes the door, and the elevator goes up. Then at the top floor, the elevator beeps, returns to ground floor, and the door opens and closes again.

I must give credit to my son who has been generous enough to allow me to borrow ALL of his legos to complete this project. By the time I finished this project, he told me I can keep them, because he's tired of me going into his bedroom and rummaging in his drawers.

Challenges I faced in this challenge were mostly related to mechanical engineering rather than coding. The action of opening and closing the door was difficult because it requires a change in the direction of the servo turns - the Robot is turning on the Y axis but the door needed to move on the X axis. So The small wheel axle allowed me to create that change. Then I had to create tension on the other side of the door to allow the door to return to the origin. 

The next challenge was preventing the door from getting stuck or unbalanced and creating drive strain. It took many, many attempts to perfect that little door. 

My first elevator box was made from cardboard, but that ended up being too heavy with the friction of the cable going through two 90 degree turns for the robot to effectively move without drive strain, so I changed out the body for legos and it worked!

Coding the project was interesting - adding the wait times in milliseconds and then adding in the sensor data was simple in theory but in reality, with the "autocomplete" function of the EdPy app, I found it to be frustrating. Often, the autocomplete adds an extra "Ed." to the function, creating syntax errors. However - the code was created.

I enjoyed this project and using the robot for more than just moving about the room because this creates opportunities to introduce real-life engineering challenges to my students in the classroom. I'm already considering a Maker Day for my kids where they would design a mechanical engineering challenge that would be solved with the incorporation of this bot. I appreciated going through the process of the frustrations and challenges I encountered, because it gave me insight into the challenges my students will face executing these projects, and offers me opportunities to help them forge through the challenge to meet success.

 

The Code:

 

#-------------Setup----------------

import Ed

Ed.EdisonVersion = Ed.V2

Ed.DistanceUnits = Ed.INCH
Ed.Tempo = Ed.TEMPO_MEDIUM

#--------Your code below----------
Ed.ObstacleDetectionBeam(Ed.ON)
Ed.Drive(Ed.STOP, 1, 1)

while True:
   if Ed.ReadObstacleDetection()>Ed.OBSTACLE_AHEAD:
    Ed.LeftLed(Ed.ON)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.LeftLed(Ed.OFF)
    Ed.RightLed(Ed.ON)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.RightLed(Ed.OFF)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.DriveLeftMotor(Ed.BACKWARD, 8, 13)
    Ed.TimeWait(2000, Ed.TIME_MILLISECONDS)
    Ed.DriveLeftMotor(Ed.FORWARD, 8, 13)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.DriveRightMotor(Ed.FORWARD,5,30)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.PlayTone(8000, 2000)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    while Ed.ReadMusicEnd()==Ed.MUSIC_NOT_FINISHED:
        pass
    Ed.DriveRightMotor(Ed.BACKWARD, 8, 30)
    Ed.TimeWait(500, Ed.TIME_MILLISECONDS)
    Ed.DriveLeftMotor(Ed.BACKWARD, 8, 13)
    Ed.TimeWait(1000, Ed.TIME_MILLISECONDS)
    Ed.DriveLeftMotor(Ed.FORWARD, 8, 13)
    Ed.PlayTone(8000, 2000)

 

The Video:

https://vimeo.com/334281081

 

 

 

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