View unanswered posts | View active topics It is currently Thu Jul 31, 2014 9:51 am






Reply to topic  [ 3 posts ] 
line tracker 
Author Message
Rookie

Joined: Fri Mar 07, 2014 12:22 pm
Posts: 2
Post line tracker
I am just starting to learn ROBOTC computer code. I am supposed to program a robot to follow a circular course using three line trackers. The middle line tracker is supposed to follow the white tape and the left and right line trackers are supposed to follow a dark surface. I'm sure anyone with just a month of learning ROBOTC can pick out a million errors on my part. Can someone tell me what i am doing wrong?
task main()
{
untilBump(bump);
while (1==1)
{

if (SensorValue (MiddleSensor) <2300)
{
startMotor(RightFront,-25);
startMotor(RightRear,-25);
startMotor(LeftRear,25);
startMotor(LeftFront,25);

}
else
{
if ((SensorValue(RightSensor) < 2600) || (SensorValue(LeftSensor) < 2600))
{
if (SensorValue(RightSensor) < 2600)
{
startMotor(LeftFront, -25);
startMotor(LeftRear, -25);
stopMotor(RightFront);
stopMotor(RightRear);
}
else
{
startMotor(RightFront, 25);
startMotor(RightRear, 25);
stopMotor(LeftRear);
stopMotor(LeftFront);
}
}
else
{
startMotor(RightFront, 25);
startMotor(RightRear, 25);
startMotor(LeftRear, -25);
startMotor(LeftFront, -25);
}
}
}
}


Wed Mar 12, 2014 12:34 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 558
Post Re: line tracker
You're off to a good start, but let's break this problem down a bit (as this will make the coding process easier). Remember that line tracking has three basic movements that get repeated; move forward, turn left, and turn right. The questions we need to answer are:

- When do I want the robot to move forward?
- When do I want the robot to turn left?
- When do I want the robot to turn right?

These questions can be broken down further by asking "What do we want each line tracking sensor to see (light or dark) when we make these movements?"

- When do I want the robot to move forward?
- What should the left line tracker see?
- What should the middle line tracker see?
- What should the right line tracker see?

- When do I want the robot to turn left?
- What should the left line tracker see?
- What should the middle line tracker see?
- What should the right line tracker see?

- When do I want the robot to turn right?
- What should the left line tracker see?
- What should the middle line tracker see?
- What should the right line tracker see?

Once we have this information, we can start to implement this into the code :)

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Wed Mar 12, 2014 12:40 pm
Profile
Rookie

Joined: Fri Mar 07, 2014 12:22 pm
Posts: 2
Post Re: line tracker
I think this is what I want it to do. I need my robot to readjust itself if it goes off course.
Moving Forward
- I need the middle sensor to see the light colored tape.
-I need the left sensor to see a dark surface.
-I need the right sensor to see a dark surface.

Turning to the Left
-I need the middle sensor to see dark.
-I need the left sensor to see dark.
-I need the right sensor to see light colored tape.

Turning to the Right
-I need the middle sensor to see dark.
-I need the left sensor to see light colored tape.
-I need the right sensor to see dark.


Fri Mar 14, 2014 11:31 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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.