Go to Post FRC: more like the real world than we could ever want. - efoote868 [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 23-01-2011, 19:32
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
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
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2011, 02:29
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2011, 11:18
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
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?






Last edited by krudeboy51 : 25-01-2011 at 13:16.
Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2011, 11:49
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is offline
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
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.
__________________


GSR Dean's List Finalist 2011
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2011, 21:17
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: programming KOP line trackers

Quote:
Originally Posted by krudeboy51 View Post
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?





Well, you could set up a counter so it only prints every tenth value it reads, or every hundredth or whatever.
Reply With Quote
  #6   Spotlight this post!  
Unread 26-01-2011, 20:00
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
Re: programming KOP line trackers

Quote:
Originally Posted by CodeMonkeyMatt View Post
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?
Reply With Quote
  #7   Spotlight this post!  
Unread 26-01-2011, 22:05
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
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();
   }
   ...
}
Reply With Quote
  #8   Spotlight this post!  
Unread 26-01-2011, 22:45
Bot190's Avatar
Bot190 Bot190 is offline
Registered User
FRC #0166 (ChopShop)
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Merrimack NH
Posts: 105
Bot190 will become famous soon enough
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.
__________________

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 03:26.

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