Day 1: Lego Mindstorms Kit and Sensors

Today, we used a Lego Mindstorms kit to make a robot that could move around using simple commands such as turning or moving forward, using the five minute robot instructions. Here is what it looked like:

Sensors

We added three types of sensors to our robot. Each of them are shown below:

The sensors that we mainly used on day one were the touch sensor and the ultrasonic sensor. We learned how to get samples in python using the get_sample function.

Touch Sensor

This was the function used to get samples for the touch sensor: touch1.get_sample( )

We made a loop so that if the sensor didn't touch anything, it would keep going. The loop we added to do this was the While loop, which looked like this when put into python: while True:

The sensor printed "True" on the screen when it was pressed and "False" when it wasn't.

Ultrasonic Sensor

The function we used to get samples for the ultrasonic sensor was: sonar.get_sample( )

When we used this function, the sensor would sense how far an object was from it.


Scatterbot Challenge

The scatterbot challenge was when we wanted to create a function where if the touch sensor touched an object, it would shut down. The function we created that did this looked like this:

As you can see, we used a While loop again, using True and False. This made it so that the bot would keep going forever until the touch sensor was touched.


Day 2: Color Sensor

On day 2, we worked with the Lego Mindstorm robot again, but worked more with the color sensor than the other sensors.

Find the Color Challenge

The challenge for day 2 was the color challenge. In this challenge, we basically had to make our robot find a certain color that was laid out on the floor using the color sensor. We then had to make the robot stop and signify when it found the color. The function we used to do this looked like this:


Our color of choice was blue. We wrote the function to make it display "I found blue." when the robot sensed the color blue, and then stop. When the robot sensed blue, it looked like this in python:

Picture of our robot finding the color blue:

Day 3: Color Sensor

On day 3, we worked with the color sensor again and began another challenge.

Walk the Line Challenge

Day 3's challenge was called the "Walk the Line Challenge." What we had to do in this challenge was that we had to make our robot follow a line on the floor until it reached the end. The line laid out on the floor was blue and was in the shape of an L. This is what the line looked like:

In that picture, we were trying to get our robot to turn the corner of the "L". This is what we struggled with the most during this challenge. We were only able to get the robot to go the duration of the straight part of the L while following the line, but couldn't make it turn the corner. The function we used to make it go straight was:

At the end of the day, we were unable to fully complete the challenge because we couldn't make our robot turn the corner, but it was a fun experience and we were still able to get our bot to follow the straight part of the "L".

More pictures from this challenge:


Day 4: Scatterbots

On day 4, we programmed the bots to scatter and if their touch sensors were touched, they would shut down. The last bot standing would win.

We added modifications to our bot to make it last longer when the bots were scattered. Our modified bot is shown above. We also had to program our robot to avoid obstacles and shut down when the touch sensor was pressed. The function we used to do this was:


Day 5: Stay on the Desk Challenge (Extra Credit)

On day 5, we worked on a new challenge. We had to try to make our robots stay on a desk without falling off, by using one of the sensors. The sensor we decided to use was the sonar sensor. We modified our robot and put the sonar sensor in a more convenient place where it could sense when it was about to fall off the desk. This is was our modified bot for this challenge looked like:

We were able to make the robot stay on the desk by using this function:

Because we were using the sonar sensor, we measured the amount of space was between the desk and the new location of the sensor. We found out that this amount was 6 using the sonar.get_sample function, so we incorporated this into our code. We added:

to our code in order to make it so that if the sensor went off the desk and the amount of space in between the sensor became more than six, the functions below the sonar.get_sample ( ) > 6 would be implemented.

Table of Contents

Home

Programming Projects

Computer Hardware

Circuits

Robotics

Game Programming

3D Graphics

A.I. Page

A.I. Games

Advanced Programming