This weekend I experimented with data logging, and got some odd results. The cycles were about 20ms apart, which is correct. Yet the sensor readings from the TalonSRX’s gave identical outputs for approximately 100ms at a time. Is there something fundamental I’m missing, like making an internal call too often? Is this normal behavior for 50hz data? Is there a resource lock internal to the SRX (similar to the PDP), where I shouldn’t log everything every cycle?
@Override
public void update(double pNow) {
data.drivetrain.meta().setTimestamp(pNow);
set(TIME_SECONDS, Timer.getFPGATimestamp());
set(LEFT_POSITION_ROT, (double)mLeftMaster.getEncPosition());
set(RIGHT_POSITION_ROT,(double)mRightMaster.getEncPosition());
set(LEFT_VELOCITY_RPM, (double)mLeftMaster.getEncVelocity());
set(RIGHT_VELOCITY_RPM, (double)mRightMaster.getEncVelocity());
set(LEFT_TALON_MASTER_CURRENT, mLeftMaster.getOutputCurrent());
set(LEFT_TALON_MASTER_VOLTAGE, mLeftMaster.getOutputVoltage());
set(LEFT_TALON_FOLLOW_CURRENT, mLeftFollow.getOutputCurrent());
set(LEFT_TALON_FOLLOW_VOLTAGE, mLeftFollow.getOutputVoltage());
set(RIGHT_TALON_MASTER_CURRENT, mRightMaster.getOutputCurrent());
set(RIGHT_TALON_MASTER_VOLTAGE, mRightMaster.getOutputVoltage());
set(RIGHT_TALON_FOLLOW_CURRENT, mRightFollow.getOutputCurrent());
set(RIGHT_TALON_FOLLOW_VOLTAGE, mRightFollow.getOutputVoltage());
set(TALON_VBUS, (mLeftMaster.getBusVoltage() + mRightMaster.getBusVoltage())/2);
mLeftMaster.set(get(DESIRED_LEFT_POWER) * -1);
mRightMaster.set(get(DESIRED_RIGHT_POWER));
gearShifter.set(data.drivetrain. isSet(IS_SHIFT));
if(data.driverinput.isSet(ELogitech310.BACK)) {
resetEncoders();
}
}