View Single Post
  #3   Spotlight this post!  
Unread 09-02-2009, 17:10
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Encoder for Crab Steering

If you don't want to reset the crab modules to 0* each match, you would need to add an index to the encoder (limit switch, reflective tape, etc) to know your absolute angle. Or you could check out one of these US Digital Absolute Kit Encoders. These mount the same way as the KOP encoder, but let you read absolute rotation (0-360*) on an analog input pin.

To remember variables across methods in your code, just declare the object globally in the class.
Code:
class YourRobot : public SimpleRobot{

    Encoder *crab;

    YourRobot(void){
        crab = new Encoder(1,2);
    }
}