View Single Post
  #2   Spotlight this post!  
Unread 19-02-2011, 12:38
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Line Tracking Code

There's a lot of problems.

1)
Code:
/*DigitalInput(UINT32 slot, UINT32 channel);*/
DigitalInput photoSensor1(8,3);
DigitalInput photoSensor2(8,4);
DigitalInput photoSensor3(8,5);
You can't have those sensors in that slot. Your digital sidecars have to be in slots 4 and 6, not 8.


2)
Code:
/*getting digital input*/
photoSensor1.Get(); //get for sensor 1
photoSensor2.Get(); // get for sensor 2
photoSensor3.Get(); //get for sensor 3
This doesn't do anything useful. You need to assign the result of those function calls to a variable, otherwise the data is lost. Something like:
Code:
bool left, middle, right;

left = photoSensor1.Get(); //get for sensor 1
middle = photoSensor2.Get(); // get for sensor 2
right = photoSensor3.Get(); //get for sensor 3
Then in your if/if else lines you'd use left, middle, and right instead of photoSensorX, e.g.
Code:
if((!left) && (!middle) && (right)){

3)
Code:
myRobot->Drive(0.1, 30.0);
You're using this same command for every case; why? Don't you want it to do different things depending on which sensors are active? Also, 0.1 is probably too slow. I'd say you should be doing at least 0.7 for your speed.



EDIT: There might be more, but that's what jumped out at me.
__________________


Which badges can you claim?

Last edited by Redneck : 19-02-2011 at 13:24.
Reply With Quote