View unanswered posts | View active topics It is currently Sat Jan 19, 2019 10:30 pm

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
line tracker
Author Message
Rookie

Joined: Fri Mar 07, 2014 12:22 pm
Posts: 2
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?
{
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

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
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 updated help documentation and the ROBOTC Forums.

Wed Mar 12, 2014 12:40 pm
Rookie

Joined: Fri Mar 07, 2014 12:22 pm
Posts: 2
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 3 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