Go to Post What I am expecting is the unexpected (what that is I don't know). - mdiradoorian [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-13-2011, 02:51 PM
normpearii normpearii is offline
Fledgling Programmer
AKA: Norman Pearson II
FRC #2603 (Highland Robotics Team)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Medina, Ohio
Posts: 6
normpearii is an unknown quantity at this point
Send a message via ICQ to normpearii Send a message via AIM to normpearii Send a message via MSN to normpearii Send a message via Yahoo to normpearii
Robot not turning with line followers

For some reason our robot refuses to turn when using autonomous with line followers

Declare:
Code:
DigitalInput *lightL;
DigitalInput *lightM;
DigitalInput *lightR;
Init:
Code:
lightL = new DigitalInput(7);
lightM = new DigitalInput(5);
lightR = new DigitalInput(3);
Autonomous Code:
Code:
		while(IsAutonomous())
		{
			ilightR=(lightR->Get()==1);
			ilightL=(lightL->Get()==1);
			ilightM=(lightM->Get()==1);
			dsLCD->Printf(DriverStationLCD::kUser_Line2, 1, "%d", ilightL);
			dsLCD->Printf(DriverStationLCD::kUser_Line3, 1, "%d", ilightM);
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1, "%d", ilightR);
			dsLCD->Printf(DriverStationLCD::kUser_Line5, 1, "%d", atFork);
						dsLCD->UpdateLCD();
			
			if(initialconditions)
			{
				if (ilightM == 1)
				{
				myRobot.Drive(.5,0);
				}
			}
			
			if (initialconditions && (ilightL == 1) && (ilightR == 0))
			{
				myRobot.Drive(.5,-.5);
			}
			if (initialconditions &&(ilightR == 1) && (ilightL == 0))
		{
			myRobot.Drive(.5,.5);
		}
		if((ilightL == 1) && (ilightR == 1))
		{
			initialconditions=false; 
			atFork=true;
		}
	
		if (atFork&&(ilightM==0)) 
		{
			myRobot.Drive(.5,.5);
		}
		if(atFork&&ilightM==1)
		{
			atFork=false;pastFork=true; 
			encoderL.Reset();
			encoderR.Reset();
			encoderL.Stop();
			encoderR.Stop();
			encoderL.Start();
			encoderR.Start();
		}
		if(pastFork)
		{
			s[2]->Set(true);
			if ((encoderL.Get()>arbitrarynumbernumber1)&&(encoderR.Get()>arbitrarynumbernumber2))
			{
				IareFinished=true;
			}
			if (!IareFinished)
			{
				if (ilightM==1)
				{
					myRobot.Drive(.5,0);
				}
				if ((ilightL==1) && (ilightR==0))
				{
					myRobot.Drive(.5,.5);
				}
				if ((ilightR==1) && (ilightL==0))
				{
					myRobot.Drive(.5,-.5);
				}

			}
			if (IareFinished==true)
			{
				myRobot.Drive(0,0);//quad erat demonstratum
			}
		}	
			
	}
We also tried the example code and get the same results. The Line trackers appear to be working based on the lights on them.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:43 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi