View Single Post
  #4   Spotlight this post!  
Unread 24-01-2011, 17:20
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,995
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Gear Tooth Counter for height

It is possible, legal, and should work fine. Just have the code reset the 'known' position at the start of each match.

A PID loop is used to control a setpoint. One example is a car cruise control (maintains constant speed), another is a kitchen oven (maintains constant temperature).

What you may want to use is called an "Interrupt". This is a special hardware connection (to the Digital sidecar) that signals the cRio's processor "STOP Whatever you are doing and run this piece of code. Immediately. Now". In your case, that code might add +1 (or subtract -1 if the lift motor is running backwards) to a counter that keeps track of lift position. Clearly, the code must be as brief as possible, since your processor is literally unable to do ANYthing else while the interrupt is active. (The interrupt gets activated by the sensor signal)

Do your own research on the highlighted words to understand and do it.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote