Hello all!
I’ve returned once again to the glorious lands of CD to get some help with a puzzling problem I’m having.
This year our shooter will be mounted on a pivot point and will be attached to a CAM…(http://en.wikipedia.org/wiki/Cam)
I need to be able to rotate this CAM a specific distance/#ofdegrees from a set base position. I will need to be able to push a button and have the CAM rotate to the desired position and stay there until the button is released. Once released I would like the CAM to return to the home position. Or position 0.
I would imagine this would be simple to do…but I have been having some issues with my test-bed not functioning as expected.
Whenever the button is pushed the motor does travel the short distance expected, but when the button is released the motor does not return to 0.
Also, my getDistance(); method is not returning the distance of 5. It returns a value of about 2.35 when the motor stops. I tried using some of the other encoderDrive, PIDexample programs that use connection to the Jaguar through PWM and had zero success getting them to work at all.
At this juncture…I’m stumped by such a simple problem.
public void robotInit() {
TEST_Speed = 0;
try{
PIDTEST = new CANJaguar(3);
PIDTEST.changeControlMode(CANJaguar.ControlMode.kPosition);
PIDTEST.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
PIDTEST.configMaxOutputVoltage(100);
PIDTEST.configEncoderCodesPerRev(80);
PIDTEST.setPID(2.0, 0.0, 0.0);
PIDTEST.enableControl();
}
catch (Exception e){}
}
Public void CAM_Control(){
if(joy1.getRawButton(7)){
try {
TEST_Distance = PIDTEST.getPosition();
PIDTEST.setX(5);
} catch(Exception e) {}
}
else{
try {
TEST_Tistance = PIDTEST.getPosition();
PIDTEST.setX(0);
} catch(Exception e) { }
}
}