View Single Post
  #3   Spotlight this post!  
Unread 17-03-2012, 20:36
arthurlockman's Avatar
arthurlockman arthurlockman is offline
Team Captain
FRC #0172 (Northern Force)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Gorham, ME
Posts: 29
arthurlockman is an unknown quantity at this point
Send a message via AIM to arthurlockman
Re: CANJaguar position problems

I'd be happy to try to help. I do have a question though: What is your position reference? You need to have an encoder or a potentiometer on it otherwise the position control would do nothing.

The SetX() method on the CAN Jaguar sets the position in terms of rotations of the motor, from where you started.

A few things to note to get it to work:
- In order for the Position mode to work on your Jaguar, you need to set the jaguar to say how many lines the encoder has (assuming it's an encoder).
- You need to set up a PID loop on the jaguar in order for it to do anything.

As an example, here's our turret setup (using position mode). It's in C++, and from your use of SetX() I assume you're in Java. But you'll see still what it's doing.
Code:
	m_turretJaguar.ChangeControlMode(CANJaguar::kPosition);
	m_turretJaguar.ConfigMaxOutputVoltage(k_driveMaxOutputVoltage);
	m_turretJaguar.SetPID(k_turretP,k_turretI,k_turretD);
	m_turretJaguar.SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
	m_turretJaguar.ConfigEncoderCodesPerRev(k_encoderPulsesPerRev);
	m_turretJaguar.ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
	m_turretJaguar.EnableControl();
Hopefully this was sorta helpful. I'd be happy to help further. We just fought for a week on our position controlled turret, so I know how to make it work.
-Arthur
__________________
--
Arthur Lockman
Twitter: @arthurlockman
a.rthr.me