View Single Post
  #1   Spotlight this post!  
Unread 19-02-2011, 03:04
Matt Daioh's Avatar
Matt Daioh Matt Daioh is offline
Registered User
FRC #3501 (Grinders)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Sunnyvale
Posts: 10
Matt Daioh is an unknown quantity at this point
Exclamation Line Tracking Code

Hi everyone.

I'm a programmer on a rookie team and we are trying to set up our line sensors. The line trackers are set up according to the guide released by NI, http://decibel.ni.com/content/docs/DOC-14730,although we wrote our own program in C instead of LabView. Does anyone have any advice or see any errors?

Also, I would like to try and debug this, but I can't find the target console! I think it's because I can't connect to the cRIO, but I can still upload programs to it! It's all very confusing. Yes, the cRIO has power when I am trying to connect it.

Quote:

void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
if (ds->GetDigitalIn(ENABLE_AUTONOMOUS) == 1) // only run the autonomous program if jumper is in place
{
printf("Entering autonomnous mode");
/*TrackingThreshold tdata = getTrackingData(WHITE, FLUORESCENT);
ParticleAnalysisReport par;*/

/*DigitalInput(UINT32 slot, UINT32 channel);*/
DigitalInput photoSensor1(8,3);
DigitalInput photoSensor2(8,4);
DigitalInput photoSensor3(8,5);

while ((photoSensor1 != 1) && (photoSensor2 != 1) && (photoSensor3 != 1)){
/*getting digital input*/
photoSensor1.Get(); //get for sensor 1
photoSensor2.Get(); // get for sensor 2
photoSensor3.Get(); //get for sensor 3

if((photoSensor == 0) && (photoSensor2 == 0) && (photoSensor3 == 1)){
printf("Photo sensor 3 is active");
myRobot->Drive(0.1, 0.0);
wait(0.5);
}else if((photoSensor1 == 0) && (photoSensor2 == 1) && (photoSensor3 == 1)){
printf("Photo sensor 2 and 3 is active");
myRobot->Drive(0.1, 30.0); //drive at .1 intensity at 30 degrees
Wait(0.5); //for .5 seconds
}else if((photoSensor1 == 1) && (photoSensor2 == 0) && (photoSensor3 == 1)){
printf("Photo sensor 1 and 3 is active");
myRobot->Drive(0.1, 30.0); //drive at .1 intensity at 30 degrees
Wait(0.5); //for .5 seconds
}else if((photoSensor1 == 1) && (photoSenosr2 == 0) && (photoSenosr3 == 0)){
printf("Photo sensor 1 is active");
myRobot->Drive(0.1, 30.0); //drive at .1 intensity at 30 degrees
Wait(0.5); //for .5 seconds
}else if((photoSensor1 == 0) && (photoSensor2 == 1) && (photoSensor3 == 0)){
printf("Photo sensor 2 is active");
myRobot->Drive(0.1, 30.0); //drive at .1 intensity at 30 degrees
Wait(0.5); //for .5 seconds
}else if((photoSensor1 == 1) && (photoSensor2 == 1) && (photoSensor3 == 0)){
printf("Photo sensor 1 and 2 is active");
myRobot->Drive(0.1, 30.0); //drive at .1 intensity at 30 degrees
Wait(0.5); //for .5 seconds
}else{

myRobot->Drive(0.1, -30.0); //drive at .1 intensity at -30 degrees
Wait(0.5); //for .5 seconds
}
}
//stop driving
//raise claw
//move backwards
}
myRobot.SetSafetyEnabled(true);
}
Thank you immensely

Last edited by Matt Daioh : 19-02-2011 at 03:07. Reason: Messed up the link, sorry!
Reply With Quote