View Single Post
  #2   Spotlight this post!  
Unread 31-01-2013, 01:04
westin444's Avatar
westin444 westin444 is offline
C++ Programmer
AKA: Westin Miller
FRC #1983 (Skunkworks)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Seattle, WA
Posts: 7
westin444 is on a distinguished road
Send a message via MSN to westin444
Re: Calling Joysticks from Command Group

Check to make sure that you schedule the tank drive command after you create the controller object. (new OI() before new TankDrive()) Otherwise, you may by trying to de-reference a null pointer.

However, as you have your code right now, you will never change your speed from the initial value of the joysticks, since it is set in the constructor, which is only called once. (Unless you have the command group only execute once before finishing) To me it seems like it would be more efficient to make the tank drive class a command, and remove the two commands that set the left and right speeds separately. http://pastie.org/pastes/5980425/text is what my team has for a tank drive. The setSpeed(float,float) method would simply change the setpoints of the two PIDs.

PS: Something that my team has had trouble with is the integral term of the PIDs growing out of control. To fix this we simply reset the PIDs when the joysticks are in the 'deadband', or close to 0.

Last edited by westin444 : 31-01-2013 at 03:46.