View Single Post
  #2   Spotlight this post!  
Unread 03-12-2012, 22:53
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Implementing a switchable control scheme

Assuming you use Java (I deduced from your previous posts), the best OOP way to do something like this is to attach something of a "Drive" class to the SendableChooser, and have "TankDrive", "ArcadeDrive", etc. classes to represent the different driving techniques. With this you can just have an abstract method like "drive(Joystick)" and call that (based on the SendableChooser or something like that).

Otherwise, you can use a state machine do the work for you, and have a Smartdashboard (or Preferences - which would be better suited) field called driver type. (We did that last year, worked out fine)
__________________
All opinions are my own.