View Single Post
  #9   Spotlight this post!  
Unread 23-01-2011, 16:58
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: setX() not working

Quote:
Originally Posted by JewishDan18 View Post
Ok, I found the issue. Instead of doing something like this

Code:
jag2 = new CANJaguar(2);
jag2.changeControlMode(CANJaguar.ControlMode.kSpeed);
I had to do this

Code:
jag2 = new CANJaguar(2,CANJaguar.ControlMode.kSpeed);
I want to look into switching control modes, since I feel position control would be useful during autonomous, and speed would be used for teleoperated.
Ah yes... your symptoms reminded me of why your code did not work...

setPID() sets the PID constants for the control mode you are in. The original code you posted will work if you move setPID() below changeControlMode().

-Joe
Reply With Quote