Quote:
Originally Posted by goldenguy00
Through a bit of troubleshooting, I found that this works...
Code:
public class TalonCan {
CANTalon talon;
public TalonCan(int canID){
talon = new CANTalon(canID);
talon.changeControlMode(ControlMode.PercentVbus);
}
}
And this doesn't...
Code:
public class TalonCan {
CANTalon talon;
public TalonCan(int canID){
talon = new CANTalon(canID);
talon.changeControlMode(ControlMode.Speed);
talon.setPID(0.1, 0.001, 1, 0.0001, 100, 36, 0);
talon.set(0);
talon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
}
}
I believe it's from not using the encoders, so my question is, what am I doing wrong in the second example? The robot does not move in autonomous, nor in teleop.
|
I assume that since you are only showing the constructor that you are not changing anything else. That would be your problem I suspect. When you change modes, you change the units of "set();". That means you need to select a velocity based on your joystick. If you are using it like you should for a typical open-loop robot, then the values you are sending to set() are -1 to 1. This means that when you switch to closed loop you are asking for a velocity of -1 to 1. Depending on your sensor (you indicated an encoder) that is incredibly slow. Depending on how your PID constants are tuned, it may give the results you described.