we are trying to use the position setting for out CAN jaguars, but whenever we run it, it is either unresponsive, or does not stop.
As it runs and is not moving, the jaguar flashes red.
We use the setX() function to move the motor to certain positions, but it does not seem to do what we want it to do.
if anyone can clarify what exactly position control setX() does, and how to properly use position control for a CAN jaguar that would be great
thanks
We use speed mode for our canbus but it should be similar. First, make sure you change to position mode and also set position reference. Then enable control and to set them use the Set() function. I do not know what the SetX() does.
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.
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