View unanswered posts | View active topics It is currently Tue Apr 23, 2019 8:05 am

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Problems!!! Plz help us T.T
Author Message
Rookie

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

Sat Nov 22, 2014 2:40 am
Professor

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

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

Thu Nov 27, 2014 2:48 am
Professor

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

_________________
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
Rookie

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

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

_________________
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 6 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

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

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning