Hi! My name is Sahasra Datla. I'm in 5th grade at BRAGG Elementary school.
Hi! My name is Samhita Pokkunuri. I'm in 7th grade and I go to Carl Sandburg Middle School.
The project that we have been doing this semester is called the taxi challenge. In this challenge the robot is the "taxi" and we use an array with variables, which are the passengers. The robot has to go the distance that the passengers say. For example, if the first position in the array is equal to 30, the robot has to go 30 cm. Then if the second position says to go 20 cm, the robot has to turn around and go back 10 cm. The robot will do this for 6 passengers.
Throughout this class, we have encountered many new, astounding things. Some technical facts we have learned are:
1) Encoders: Encoders are the sensors inside a wheel that show how much the wheel has rotated. However, the number of ticks in an encoder varies; for an EV3 or and NXT, it's about 360 encoders. These motors store the encoder values, which are measured by the array nMotorEncoder, which is used in our code countless times. This is the formula for going forward in our code:
float encPerCM = 360/(WD*PI);
2) Arrays: Arrays are a systematic representation of a sequence of the same type of data. In other words, arrays can store multiple values (of the same data type), which makes your code more efficient and less problematic. An example of an array would be "int number[10]." This array indicates the following: The array is allocating 10 elements for "number," from index 0-9. Each "number" takes up about 4 bytes, which is also the size of the int data type.
A crucial thing to remember when using arrays is to be careful about how much you allocate. It would be best if you never used more than you allocate; doing so can cause your code to crash or even create inconstant results.
3) Functions: A function is a unit of code used to accomplish specific tasks, and are one of the building blocks of Robot C code today. Functions can either return one value or none at all, as specific functions specify these requirements. Functions are necessary because if you have repeated code in your program, you can use a function to reduce this clutter significantly. Functions are often used in code for things such as formulas, turns, going forward / backward, or even line tracing.
We started this project with simply a line tracing code. In the span of about a month, we elaborated on this code, by adding things such as functions, encoders, and arrays! First, we created functions that could transform encoders to centimeters, centimeters to encoders, etc. We then incorporated this into our code for the passengers' distances. We also used encoders to do our line tracing, while transporting passengers. After perfecting this aspect of the code, we began to implement arrays into our code. This is because arrays make your code much more efficient in terms of organization. Using arrays instead of separate variables makes your code much easier to read. This is the overall process of our code!
Over the course of this challenge we have encountered many big and small problems here are a few...
The robot would not turn at all. This was because we had forgotten to reset the motor encoders, so by the time the robot got to the place that it had to turn it had already reached the target.
The robot would go a lot further than we wanted it to because when we went the amount of the 2nd passenger, instead of going the distance between the 2nd and 1st passenger it would go the whole distance of the 2nd passenger.
A passenger needed the robot to go back from the first stop, so we tried to line trace backwards, this didn't work because there was a time that both sensors saw black, which is not possible when going forward. Trying to solve this problem, we added a few lines of code for if the robot saw black, this didn't work because the robot would see black then turn, then it would see white and black then turn back to the black, creating an infinite loop, to solve this problem, instead of line tracing backwards, we made the robot turn around and then line trace forwards.
We have been working on this project since May 15th. For the first two weeks, we worked on it at home. For the rest of the time, along with our partners, we have enhanced our code. Throughout this time, we have begun to use arrays, encoders, functions, and more! This project, in total, has spanned over four weeks (May 15th - June 12th).
In the future we would try to add more passengers into our code and see if it would make a difference or even work. Something that we are still puzzled with is how to successfully incorporate arrays into our code. Though we have been able to complete our code, it sometimes doesn't work for all the passengers. If we had more time to evaluate on this, we would definitely adjust our code to work for all passengers.