Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   programming KOP line trackers (http://www.chiefdelphi.com/forums/showthread.php?t=89907)

krudeboy51 23-01-2011 19:32

programming KOP line trackers
 
can any one please explain to me how to program the KOP line tracker in c++, or explain in full detail the example code which confused me alot. I do know that They are digital inputs, but im wondering if you have to use a specific ".h" in the file wpilib. to declare a line tracker variable, or DigitalInput, and what kind of data does it read and how to test it if it is working whether by using "printf" which never seems to print anything to the driverstation or something else. It is the first time my team is using one.


-thanks in advance :yikes:

CodeMonkeyMatt 25-01-2011 02:29

Re: programming KOP line trackers
 
I haven't looked into the line trackers, so I can't help you there, but I can help on the printf statement. It prints not to the driverstation, but to the target console. Normally, you won't see this. To pull it up, go into windriver while connected to the robot, right click the VxWorks connection in the bottom left, and go to "Target Tools" -> "Target Console"*.

*May not be perfect. I don't have windriver on this computer.

krudeboy51 25-01-2011 11:18

Re: programming KOP line trackers
 
thanks man i have been looking all over for the target console, but one question, is there any way to slow down the way the target console reads the values?





:D ::ouch:: :o ::safety:: :cool:

demosthenes2k8 25-01-2011 11:49

Re: programming KOP line trackers
 
Nope, they're just default DigitalInputs. You can use .Get() to get its status - 1 is tripped, 0 is not tripped. On carpet, though, you'll have to do !sensor.Get(), because carpet's dark and the lines are light.

CodeMonkeyMatt 25-01-2011 21:17

Re: programming KOP line trackers
 
Quote:

Originally Posted by krudeboy51 (Post 1007965)
thanks man i have been looking all over for the target console, but one question, is there any way to slow down the way the target console reads the values?





:D ::ouch:: :o ::safety:: :cool:

Well, you could set up a counter so it only prints every tenth value it reads, or every hundredth or whatever.

krudeboy51 26-01-2011 20:00

Re: programming KOP line trackers
 
Quote:

Originally Posted by CodeMonkeyMatt (Post 1008383)
Well, you could set up a counter so it only prints every tenth value it reads, or every hundredth or whatever.

How do i do that?

CodeMonkeyMatt 26-01-2011 22:05

Re: programming KOP line trackers
 
Something along the lines of this:

Code:

int count = 0;

while(IsOperatorControl())
{
  readInput(); //However you get the data
  count++;

  if(count >= 10)
  {
      count = 0;
      printData();
  }
  ...
}


Bot190 26-01-2011 22:45

Re: programming KOP line trackers
 
To elaborate on what Demosthenes2k8 said, The values you get are dependent on a couple things. First, the sensor has two outputs, one is normally high, while the other is normally low. Depending on which wire you hooked up to your Digital Sidecar will affect what you read in the code. Also, the sensors have an adjustment knob on them. The sensors will most likely have to be calibrated to work on what ever test surface you are using. Just make sure it has a good contrast.


All times are GMT -5. The time now is 18:11.

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