ROBOTC.net forumshttp://robotc.net/forums/ Problems!!! Plz help us T.Thttp://robotc.net/forums/viewtopic.php?f=15&t=9872 Page 1 of 1

 Author: Sam [ Sat Nov 22, 2014 2:40 am ] Post subject: Problems!!! Plz help us T.T Hi dear,This is middle school student starting RobotC programming.We started our project that robot scans 2 circles and compare which on is bigger.Don't know how to start. We made robot already.Please help and I will appreciate with all my heart.Thanks!!

 Author: BurningLights [ Sat Nov 22, 2014 4:00 pm ] Post subject: Re: Problems!!! Plz help us T.T Well, let's see, how can you tell if a circle is bigger? That will tell you the specific problem you are trying to solve with a robot.Then, you can figure out how your robot has to drive to let you do that, and what you need to do with the sensors.So, for instance a circle is bigger when the circumference or the diameter is bigger. Which one do you think is easier to measure? And then how do you think you can make your robot measure it?Also, what kind of circles are they? Are they just outlines or are they solid, because that will change what you need to do with the sensors? And also, does your robot have a light sensor on it?

 Author: jessica0903 [ Thu Nov 27, 2014 2:48 am ] Post subject: Re: Problems!!! Plz help us T.T hi, I also have the same problem like Sam. My robot has light sensor and I dont know which one will be easier?( measure the circumference or the diameter ) but I think measure the diameter may be easier? but i have no idea about the code. My circles are just outlines. Please help me solve this problem. Thanks in advance!

Author:  BurningLights [ Thu Nov 27, 2014 4:19 pm ]
Post subject:  Re: Problems!!! Plz help us T.T

 jessica0903 wrote:hi, I also have the same problem like Sam. My robot has light sensor and I dont know which one will be easier?( measure the circumference or the diameter ) but I think measure the diameter may be easier? but i have no idea about the code. My circles are just outlines. Please help me solve this problem. Thanks in advance!

Well, if you're trying to measure the diameter, your robot will need to drive from one edge of the circle to the other and detect the outline. So, the driving part is easy. You just use the motor command like:
 Code:motor[motorA] = 75; // Substitute your one drive motor for motorA and substitute the power you want to use for 75motor[motorB] = 75; // Substitute your other drive motor for motorB and stubstitute the power you want to use for 75

And then what can your robot do to know when it has reached the edge of the circle? And then how can your robot measure distance?

By the way, is this using an NXT robot? I just want to make sure, because that's kind of what I've been assuming...

 Author: jessica0903 [ Thu Dec 04, 2014 12:44 am ] Post subject: Re: Problems!!! Plz help us T.T yah,im using the nxt robot, I think I use the light sensor to realize/stop when it has reached the edge of the circle, because I draw the circles by black lines.About the measurement of the diameter, I use the equation between the rotation and the diameter of the wheel , but i have no idea. Can you help me figure out how to write this code @@. I'm not good at this. how about the code to compare 2 circles(if they are in the same size or the first circle is bigger/smaller than the last one?) , to save the datas and show them on screen? I'm so confused. Thank you so much!

Author:  BurningLights [ Thu Dec 04, 2014 11:40 am ]
Post subject:  Re: Problems!!! Plz help us T.T

Well, you could put both of the measurements in one program and just have the robot wait for a button press in between them. Do you have to figure out the size in something like inches or centimeters? Or does the robot just have to show which one is bigger on the screen?

So, I'll give you the commands you need, and a general framework for how the program could go, but you get to figure out how to put the two parts together.

First, the commands
 Code:motor[motorA] = 100; // I've already explained this oneSensorValue[S1] // SensorValue will give you the current reading of a sensor, in this case you want the light sensor. With the light sensor, lower values are darker. Replace S1 with whatever port your light sensor is on. Make sure you configure it as a light sensor in the Motors and Sensors Setup window under the Sensors tabnNxtButtonPressed == kEnterButton // nNxtButtonPressed has a code that represents the button that is pressed on the NXT brick. Possible values are kEnterButton (the orange one), kLeftButton, kRightButton, kExitButton (the gray one), and kNoButton.nxtDisplayTextLine(0, "The first one's bigger!"); // nxtDisplayTextLine puts text on the NXT screen on the line number you give it. The line number is the first item, and can be 0-7. The second item is whatever text you want to put on the screen.nMotorEncoder[motorA] // Gives you the encoder value of whatever motor you specify. Assign a value of 0 to it to reset the encoder

Your program could go something like:
1. Drive forward
2. Once it sees the outline of the circle, start measuring
3. Once it sees the other side of the outline, stop driving
4. Store the distance travelled from one side of the circle to the other
5. Wait for the orange button to be pressed on the NXT
6. Drive forward
7. Once it sees the outline of the circle, start measuring
8. Once it sees the other side of the outline, stop driving
9. Store the distance travelled from one side of this circle to the other side
10. Compare the distances travelled for the two circles and determine which one is bigger
11. Display which circle is bigger on the screen

 Page 1 of 1 All times are UTC - 5 hours [ DST ] Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/