User:ALGurung/project2

Project Preference

 * Mobile Robot Hallway Navigation
 * MakerBot PLA Material Characterization
 * Smart Shoe

Problem Statement
Make a Lego Robot navigate autonomously through the hallways using Matlab.

Project Plan
Briefly describe your group's plan for the next 4 weeks, including the specific activities that will take place each week.

Week 1 Narrative
For this week, my task was to find the schematics of the hallways that we were to navigate the robot around. Since I had worked on this project before, I just asked Christian who had access to the schematics. Apart from that I was also tasked to find an alternative way to make the robot turn when it reaches the end of the hallway. I searched for any known methods. I found one method that I really liked. Using servo motor as a neck for ultrasonic sensor. This method not only helps us in navigating the robot, but also gives the ultrasonic sensor a greater view.

Week 2 Narrative
For this week, I was formerly given the task of learning how to make the robot move as shown in the video, mentioned in my week 1's narrative. But we thought about putting that idea aside and starting with just simple design, so I was then tasked to code to make the robot navigate in the hallways. We also made plans of adding another ultrasonic sensor to the left of the robot, so that it can detect the wall to its left, so that the robot will move along the left wall within a certain range. Adding ultrasonic sensor was tasked to Graham. With the information I got after looking at the example shown by Prof. Edelen, I used "if statements" to begin coding. On Tuesday, when I first did coding using Matlab, I was able to make the robot move a certain distance, back up if the front ultrasonic sensor senses anything within 60cm, and continue moving forward again. On Thursday, the left ultrasonic sensor was added, so I coded the robot to navigate using inputs from both, front and left ultrasonic sensors. The robot was coded to move next to the left wall within 60cm to 255cm, turn right if it gets closer than 60cm to the wall and turn right if gets away more than 255cm from the wall, and turn right if it detects anything closer than 60cm in front of it. The robot moved along the hallway but got stuck when it reached the pillars. It didn't work. On Friday, Graham and I changed the old code by adding "else if statements" into the coding. We then coded the robot to get inputs from both ultrasonic sensors at the same time as well as keep left at all times.

With the final coding, the robot does the following:

1)If the front ultrasonic sensor senses something to be at 80cm and left ultrasonic sensor senses something to be at 60cm, the robot moves forward with speed of 100 on both motors. 2)If the front ultrasonic sensor senses something more than 80cm and left ultrasonic sensor senses something less than 60cm , the robot moves forward with the speed of left motor at 100 and right at 40, the robot turns right. 3)If the front ultrasonic sensor senses something more than 80cm and left ultrasonic sensor senses something more than 60cm, the robot moves forward with the speed of left motor at 40 and right at 100, the robot turns left. 4)If the front ultrasonic sensor senses something less than 80cm and left ultrasonic sensor senses something less than 60cm , the robot moves forward with the speed of left motor at 100 and right at 40, the robot turns right. 5)If the front ultrasonic sensor senses something less than 80cm and left ultrasonic sensor senses something more than 60cm, the robot moves forward with the speed of left motor at 100 and right at 40, the robot turns right.

This video also shows what we achieved this week. It still needs some improvement as the robot gets stuck in the pillar at the end.

Week 3 Narrative
This week I continued on working on the codes from last week. Since it had many flaws, it didn't even get around the hallways, foremost, we focused on how we can actually make it go all the way around the hallway. The first thing we did was change the placement of the left facing ultrasonic sensor, since it made the robot get stuck in some places. After that we changed the range of detection of that ultrasonic sensor from 60cm to 70cm because it was further away from the wall after the change in placement. Then we added the idea of backing up a certain distance if the front facing ultrasonic sensor detects something closer than 80cm in front of the robot. The robot backs up with the speed of 97 on left motor and 100 on right motor, meaning the robot actually backs up as well as turns slightly to the right. After that, we tested this on the hallway itself, and the robot did back up. Then we tested to see if the robot would go around the hallway with these new modifications to the design and the coding. The robot made it further than the point it reached last week, but unfortunately didn't make it all the way around this time as well. Thinking that there may have been problems with the wires, we made it sure that they weren't blocking the ultrasonic sensors' visions and wasn't the wheels as well. We ran the program again, but the robot got stuck in the same place, again. After observing where and how the robot got stuck, we found out that the ultrasonic sensor doesn't detect anything that's in the gap between its two eyes, and that's one of our problems.

Week 4 Narrative
This week our group worked on wrapping up the project. This week was focused on completion of our CDIO page, and fixing any errors with the timer coding used in the robot, a finishing touch. I was given the task of recording and putting up the videos in our CDIO page along with helping in coding the robot and testing the program.

I wanted to have a thumb preview of the video, so I tried embedding the videos, which were already uploaded to Youtube. But, wikiversity doesn't allow embedding of videos from an external source, so I had to put the videos another way, from wikimedia commons. The videos I took were in .mov format and wikimedia only accepts .ogv, so I had to convert them. After converting, I started uploading the videos to wikimedia, but wikimedia only lets you upload files that are 100mb max. while my video was more than that. Not seeing any other way around, I just put up links that directs to the video posted in youtube.

With the work done in the past three weeks, we already had a good grip on what we were doing and also had made the robot navigate around the hallway, which was the primary goal of this project. But to be 100% sure that the robot won't get stuck on obstacles, such as bench legs, which it did in earlier trials, we incorporated the use of timer. Formerly the coding was done with backing up for 5sec and a 0.1sec timer on all logics, but was changed afterwards to 1sec for backing up and 0 on all logics that didn't use backing command. The timer now commands the robot to back up for 1 second, when the front facing ultrasonic sensor detects anything less than 30cm in front of it. Another slight change was also done; the robot will now turn sharply to the right if the front facing ultrasonic sensor detects anything within 30-80cm in front of it. With this new change, timer coding and backing up based on the timer, and keeping all other logics from last coding the same, we tested the robot on the hallway. The robot starts backing up for a second when the program is started and moves back and forth abruptly at certain points when the left facing ultrasonic sensor detects something close to it. But, apart from that, it was a success, the robot successfully navigates around the hallway autonomously, and can also be seen in this video as well.