View unanswered posts | View active topics It is currently Sun Apr 22, 2018 11:57 pm






Reply to topic  [ 6 posts ] 
Problems!!! Plz help us T.T 
Author Message
Rookie

Joined: Sat Nov 22, 2014 2:34 am
Posts: 1
Post 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!!


Sat Nov 22, 2014 2:40 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post 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?

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Sat Nov 22, 2014 4:00 pm
Profile
Rookie

Joined: Thu Nov 27, 2014 2:42 am
Posts: 2
Post 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!


Thu Nov 27, 2014 2:48 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post 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 75
motor[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... :roll:

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Thu Nov 27, 2014 4:19 pm
Profile
Rookie

Joined: Thu Nov 27, 2014 2:42 am
Posts: 2
Post 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!


Thu Dec 04, 2014 12:44 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post 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. :bigthumb:

First, the commands
Code:
motor[motorA] = 100; // I've already explained this one
SensorValue[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 tab
nNxtButtonPressed == 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

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Thu Dec 04, 2014 11:40 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.