Sunday, February 17, 2019

Final Lecture/Lab Post

2/14/2019

FINAL - Lecture Portion (5% of class grade)
To receive full credit on the lecture portion of the final you must create a final blog post speaking about the final project/competition of the class.

Your blog post should include the following:
(Be sure to include pictures and/or videos to accompany the following as well)
1. A description of the final competition requirements.
2. Describe how you approached the competition and whether your method worked.
3. Changes that you made to your initial approach.
4. What you learned from the final project.
5. What you would do/change if you had more time to be more competitive in the final project.
6. What things you think you will take with you from this class and how you might apply it in the future.
7. Copy and paste of the Final code you used for your robot.

Your blog post will be graded based on the overall quality and inclusion of the above criteria as well as how in depth you go.

------------------------------------------------------------------------------------------------------------------------
1. Copied for lab handout
A description of the final competition requirements.

Rules for Fire Fighting Competition

The objective is for the robot to locate and extinguish the candle in the minimum amount of time. The robot score is essentially the time (in seconds) required for the robot to locate and extinguish the candle.
1.       A single lit candle is placed in one of the 4 rooms of the maze. The robot will begin at a starting point and once the robot begins to move the time will start.
2.       There will be 3 rounds in which each robot is allowed 2 attempts per round to locate and extinguish the candle. The better of the 2 attempts per round will be counted.
          Round 1 – You can pick which room you want the candle placed in.
          Round 2 – You will be told which room the candle will be placed at least 15 minutes in ahead of time.
          Round 3 – The candle will be placed randomly in one of the rooms.
3.       A robot that successfully extinguishes the candle in more than one round will receive a final score equal to the average of the times of the successfully completed rounds. Robots that successfully extinguish the candle three times will be rated higher than robots with only one or two successful runs, regardless of the run times. A robot that extinguishes a candle in a higher round will be rated higher than a robot that extinguishes the candle in a lower round.
4.      There is also a room factor that is applied to your overall time from start to extinguishing the candle. You do not need to go into the room to consider it “explored.” Just driving by its entrance will consider that room explored.
·      Candle found in first room explored ——– 1.0 factor
·      Candle found in second room explored —– 0.85 factor
·      Candle found in third room explored ——– 0.50 factor
·      Candle found in fourth room explored ——- 0.35 factor
5.       There is a bonus for returning to the home position after extinguishing the candle. If a robot can return to within 5 inches of its starting point, after extinguishing candle, the extinguishing time is multiplied by a factor of 0.8
6.      In any round you elect an arbitrary start position that is randomly selected, the extinguishing time will be multiplied by a factor of .8

Rules

1.       Robots must be constructed and programmed using Vex Basic Robotics Kits and all other materials must be approved by the instructor.
2.       Robot maximum size is limited to 14 inches by 14 inches by 8 inches. No sensor can be higher than 10 inches from ground.
3.       The robot must move to within 12 inches of the candle before the robot extinguishes the candle.
4.       The robot is not permitted to “look” over the walls of the maze.  The robot is not permitted to climb over the walls of the maze. The robot is permitted to touch the walls at any time during the run (with no penalties).
5.       The robot is not permitted to touch the candle in any way when the candle is lit except with a designating extinguishing device, otherwise there is a 1.5 times factor applied. There is no penalty for touching the candle after the candle is extinguished. The extinguishing device cannot be in operation more than 10 seconds during entire search.



Arena Details


1.       Arena is 8ft by 8ft. The walls of the arena are 12″ +- 1″ in height. The walls are made of 3/8″ mdf. The floor of the arena will be the default flooring of the classroom (a commercial floor tile).
2.       The maze dimensions and layout are known prior to the contest. Any dimension may vary by up to an inch of the labeled value.
3.       There is a circle constructed from black electrical tape on the floor at the fixed home start position. The robot must be completely inside the start circle, but can be faced in any direction.
4.       The candle will be placed at least 3 inches away from any wall.  The candle will not be positioned at the entrance of the room. In all cases, the robot will be able to enter the room (12 inches minimum) without making contact with the candle.
5.       The height of the lower portion of the flame is roughly 3 inches from surface.
There will be black lines of tape at the entrance to the rooms.

2. Describe how you approached the competition and whether your method worked.  AND
3. Changes that you made to your initial approach.

We approached the competition with a plan. Our methods worked on timing,  but the draw back was sensors. Our method is great, but for a perfect world. The logic was all there, but the error was a big result on sensors accuracy. The IR sensor has arbitrary values that changes very dramatically with the light in the room. Shade and even a cover will greatly change the results. The UltraSonic Sensor was a different chapter. The sensor that we had had random numbers occasionally pop up. We switched it out for another ultraSonic Sensor, but after lots of trials and tuning, ir turns out that that sensor was just faulty in inoperational. We installed another UltraSonic Sensor (our 3rd one) and that one worked. It still popped out a few random numbers of error, but it was less common than the initial sensor unit. The encoders worked great, till they somehow got some dirt inside, then errors came out. A smile dust out clean cleared out the sensor. We used to have full power to motors for speed, but we changed the approach by reducing power to the wheels, so there was less wheel slip on the ground surface. The encoders was only as accurate as the wheels having traction on the competition floor, which by the way was a bit slippery.

4. What you learned from the final project. 

Lots was learned, especially that robotics competition or even the robotic build is very possible in our homes. The sensors are able to be purchased and even sold in a bulk pack. Each unit is easily programmed with easily accessible and downloadable programs. Coding has been done or you can research and modify others code. Simply making code from scratch has such a deep gratifying experience and a sense of accomplishment. We did our program from scratch and it worked out great as used lots of functions in our approach.

5. What you would do/change if you had more time to be more competitive in the final project

If we had more time, we would have perfected the code. The biggest change would have been the realignment technique. I witnessed a student in our class do it, and it was super impressive and ingenious. The technique was to have the robot move forward, but after every turn, the robot will shortly reverse itself and ram into the wall behind it. The idea is to have the robot be flat against the floor, so that each time the robot moves forwards, the bot will go exactly straight forward. It eliminates the error that accumulates with slippage error on the track surface. I would have implement that kind of alignment technique. It proved impossible to beat when combined with the reduced power sent to the wheels to prevent slippage.

6. What things you think you will take with you from this class and how you might apply it in the future.

I will for sure take programming into a whole new level with complicated functions. Not complicated, but more duplicated functions to command different tasks, makes it a lot simpler than having a giant code block. I think I am actually going to try to invest in a VEX kit. i have used it before many years ago, but I was extremely intimidated by the programming of the device. I built great robots, but severely failed on the programming aspect. It was just then a giant piece and pile of metal parts put together. I think I can actually do it at home now.

7. Copy and paste of the Final code you used for your robot.

1...2....3....Done!

Lab 17 - Using IR sensors for flame and line detection for the VEX

2/14/2019

IR sensor is able to detect IR light. As with all sensors, visible light can be detected, but thus one is able to detect InfraRed light which is light above the spectrum of visible light. Coincidentally, Android phones are able to view this light through its camera. Iphones are not able to view such light. Our robot, for testing purposes only, has been customized with a useful state of the art (in my mind. haha), an easy to grab handle. Tall hable is useful so the person, me or my robot partner, does not have to bend down all the way to grab the robot and risk getting fingers caught in the possibly still moving gears. Also useful for mounting a phone as a ash cam , and even is useful to quickly grab the robot in case the collision sensor or programming is not yet working fully properly.



IR sensor mounted



            




















The IR sensor for this bot is going to be mounted in front of the bot because that is what is needed to be avoiding obstacles such as the walls. the sensor worked great! The only issue we found was the location in the room. In our test bench we tested the light and we were getting readings of about 500. Our bench area was not greatly lit up. The actual maze competition area, howerve, was greatly lit up by the classrooms lights. The readings in that location was much higher, and hence it was harder to see the IR candle cause of the excess light. Then problem was easily fixed by decreasing the sensitivity of the IR sensor. Since the resistor was already soldered into the sensor, we just simply changed the programming number. Project Success!

Lab 16 - Ultrasonic Rangefinder and other sensors

2/12/2019

An Ultrasonic sensor uses audio waves to detect structures such as walls blacking a path; hence rangefinder. The audio waves will signal how much open range there is that is in front of the robot. The sensor receives a 10us electrical pulse to signal the sensor to activate and send out a sound at trigger point. The Echo part will receive the audio that bounces back form the wall structure. Depending on the time it takes back for the sensor to receive the feedback, the sensor will calculate the distance away that is in front of the robot.

UltraSonic Sensor Installed

The hard part of the sensor in readings is its out of limits range. If the distance in front of the sensor is more than 6 feet away, the sensor will return a -1 value. The code for that part cant be just x>-6, the sensor for the code must also include a lower bounds limit. The key to this part of the code is to be 0<x>6. That code will ignore the -1 value and allow further distance to tell the robot to keep moving forward.

Wall Avoidance Lab
Code the lab will have the robot keep going forward unless a wall is detected. Make a right turn if a wall is detected. if a wall is detected again, move left form the original orientation; or move 180 degrees after the 2nd right turn.


Wednesday, February 13, 2019

Code.org Homework Assignment

2/5/2019

Code.org Homework Assignment

Star Wars: Building a Galaxy with CodesetBackground("Endor");
setMap("circle");
setDroid("R2-D2");
setDroidSpeed("normal");
playSound("R2-D2random");
function whenUp() {
  goUp();
}
function whenDown() {
  goDown();
}
function whenLeft() {
  goLeft();
}
function whenRight() {
  goRight();
}
addCharacter("PufferPig");
addCharacter("PufferPig");
function whenGetAllPufferPigs() {
  addPoints(100);
  endGame("win");
}


SHARE GAME @  https://studio.code.org/c/140816053

Minecraft Voyage Aquatic 

for (var count = 0; count < 5; count++) {
  placeBlock("redCoralBlock");
  turn("left");
  moveForward();
  placeBlock("redCoralBlock");
  moveForward();
}

SHARE GAME @  https://studio.code.org/c/714458078


Code with Anna and Elsa
Puzzle 6 Star https://studio.code.org/c/49768924
Puzzle 9 Super Star https://studio.code.org/c/618940565
Puzzle 12 Parallelogram Star https://studio.code.org/c/51803719
Puzzle 15 Star in a Star https://studio.code.org/c/53014217
Puzzle 17 Start Star https://studio.code.org/c/618940329
Puzzle 19 Snowflake https://studio.code.org/c/53005426
Finish Star: 

for (var count = 0; count < 3; count++) {
  drawSnowflake('square');turnRight(90);
  jumpForward(100);
}

SHARE GAME @ https://studio.code.org/c/52521226







Sunday, February 10, 2019

Lab 15 - Building Square Bot and doing the Electrical Tape Maze with and without encoders

2/5/2019 & 2/7/2019

Mega bot building time! The day has come in which we will build a robot. The Robot is going to be a square on shape and it is going to go through a maze that was laid out with electrical tape. We have all the parts either in the box or in the parts room. We are basically following the manual to build the robot, but with the encoders installed in place. We are not going to use them in the first trip but we are going t use them on the second trip using the programming; just so we do not have to dismantle the bot just to install the encoders.

Bot Building Station
We worked on a side project utilizing the biggest wheels, but turning ability was terrible, so we stayed with the tiny wheels for maneuverability. 
Mega Test Bot
Due to programming constraints to one user at a time, I would periodically assist with the programming part when needed, until then I was on mechanical duty. I built the bot for the future labs too. The bot is equipped with an easy elevated carry handle so the robot can be transported easily without having to constantly be bending down to retrieve the bot or to reposition it. The bot is also rigged with some fans for blowing out a future flame, a sonar sensor upfront for the future IR detection part, and racks for video recording modularity.


Sunday, February 3, 2019

Lab 14 - Non-Existent

Nothing posted for Lab 14 on packet

Lab 13 - Building Sensors for your Robot

1/29/2019

We worked with phototransistors today in lab. It is basically a photodiode amplifier combination that is integrated on a silicon chip. Recall that a transistor has an emitter, collector, and a base pin. Notice how this device only has two actual pins. THe third pin is the base pin, which is actually  in the device already. The light (light that the sensor detects) is the base activating pin for the device. This device is going to detect IR (InfraRed). That is light that we humans cannot see, but our phones can! well, some phones; Apple phones cannot see that light, but the Android phones are able to display IR light on the camera screen.

Time permitting, we did not light a candle for flame (too messy as the wax goes onto the floors and makes a mess, and a fire hazard). We used a pre-constructed flame which is a couple of IR LEDs on a breadboard [piece that outputs IR light.

Phototransistor



Once again, due to time permits, I built a circuit on the breadboard to detect IR light. It is only one phototransistor, and One carefully chosen resistor. That resistor, depending on its value, will allow more or less voltage/current to be ran through it. The important concept in this is the preferred gain range. We want a resistor, so that when hooked up to the phototransistor, we got a high value of 1000 or so on the display with super intense IR light. The lowest we should see is around 20's when the IR light source is about 4 feet away from the sensor.