Tuesday, March 29, 2016

Sciborgs Part 3

Day 15 (3/15/16)

Our next assignment with the sciborgs was to do essentially the same tasks as before, except instead of using bang- bang control we had to use proportional control. Proportional control uses feedback to figure out how much power to supply to a mechanism based on how far off it is from the goal. We write the power in the form of:

Power = k * error
where k is the gain constant
and error = goal - reality

Task #9

The first task we had to do was to make the sciborg drive even straighter than when we used the bang-bang control. We did this by setting the constant k to 3 and the error to the difference in the positions of both of the motors. Here is what our code looked like:

By using the difference between the positions of the two motors we were able to devise a system so that one motor would speed up or slow down based on the position of the other motor. Unfortunately, we did not have enough time to test this code on different surfaces because it took us too long to devise the code and we needed to move on to the other tasks. I am guessing that the best results would be on the carpet because with the higher friction, the wheels are less likely to slip and so the motor encoder will be more accurate.

Task #10

The next task we worked on (and spent a lot of time on) was making the sciborg go 10 feet exactly and then stop. Once again, we used proportional control to make this happen. Here is what our code looked like:


We devised the original function so the sciborg could get close to the line. The sciborg, however did not make it all the way to the line, so we devised a nudge function to push the sciborg a little bit farther until it reached the line. Changing the gain changes the speed of the sciborg as it gets closer to the target. We determined that a smaller gain will get the sciborg the farthest because it will take longer to slow down.

This assignment gave us lots of problems and issues. We tried many things, and worked many hours just on this task, and we were not able to get it to perform perfectly the way we wanted.

Here is a video for the sciborg moving 10 feet using proportional control:


Task #11

The next task was to use the ultrasonic sensor to allow the sciborg to follow something using proportional control.

This task was a bit easier than the others because we had two different modules from the first two tasks to use. We used the same concepts from task 9 and 10 to control the sciborg using the sensor. This time however, instead of using the motor encoder, we were using the ultrasonic sensor to determine how far away the sciborg was from the target (the delrin board or another sciborg).

Using proportional control is a little more effective then bang-bang control because the speed is related to the distance and the sciborg is constantly taking in to account the distance from the target.

Here is the code we put together for the ultrasonic sensor proportional control:



Here is a video of the sciborg following a delrin board:


And here is a video of a few sciborgs following each other in a row:



Task #12

Our final task was to get the sciborg to follow the path (white strips of tape) using only proportional control. For this task, we were not able to get very far in the execution of this task. We were able to devise our first draft of the code which did not work at all. Here is what the first draft looked like:



If we had more time, I would use a different logic to come up with a proportional equation to make one wheel turn faster or slower than the other depending on the reading from the ultrasonic sensor. The target reading is around 90 for the sciborg following on the line. So, the error  would be 90 - the reading from the sensor. If the value is higher, the error will be negative so the wheel will move slower. If we use this equation for the speed of motor 2, this proportional equation would control the sciborg in the correct direction. If the value is lower, the error will be positive, wheel 2 will move faster and turn the sciborg in the other direction.


No comments:

Post a Comment