return this.doneCycleCount >= this.minDoneCycleCount;
}
- || key.equals(Constants.DriveTrain.D_VAL)
- || key.equals(Constants.DriveTrain.MOTOR_VAL)) {
+
+ private final ITableListener m_listener = (table, key, value, isNew) -> {
+ if (key.equals(Constants.DriveTrain.P_VAL)
+ || key.equals(Constants.DriveTrain.I_VAL)
- table.getNumber(Constants.DriveTrain.D_VAL, 0.0),
- table.getNumber(Constants.DriveTrain.MOTOR_VAL, 0.0));
++ || key.equals(Constants.DriveTrain.D_VAL)) {
+ if (getP() != table.getNumber(Constants.DriveTrain.P_VAL, 0.0)
+ || getP() != table.getNumber(Constants.DriveTrain.I_VAL, 0.0)
+ || getD() != table.getNumber(Constants.DriveTrain.D_VAL, 0.0)) {
+ setConstants(table.getNumber(Constants.DriveTrain.P_VAL, 0.0),
+ table.getNumber(Constants.DriveTrain.I_VAL, 0.0),
++ table.getNumber(Constants.DriveTrain.D_VAL, 0.0));
+ }
+ } else if (key.equals(Constants.DriveTrain.SETPOINT)) {
+ if (getSetpoint() != (Double) value) {
+ setSetPoint((Double) value);
+ }
+ }
+ };
+
+ @Override
+ public void initTable(ITable table) {
+
+ if (this.table != null) {
+ table.removeTableListener(m_listener);
+ }
+ this.table = table;
+ if (table != null) {
+ table.putNumber(Constants.DriveTrain.P_VAL, getP());
+ table.putNumber(Constants.DriveTrain.I_VAL, getI());
+ table.putNumber(Constants.DriveTrain.D_VAL, getD());
+ table.putNumber(Constants.DriveTrain.SETPOINT, getSetpoint());
+ table.addTableListener(m_listener, false);
+ }
+
+ }
+
+ private double getP() {
+ return this.pConst;
+ }
+
+ private double getI() {
+ return this.iConst;
+ }
+
+ private double getD() {
+ return this.dConst;
+ }
+
+ private double getSetpoint() {
+ return this.setPoint;
+ }
+
+ @Override
+ public ITable getTable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSmartDashboardType() {
+ return "Drive Controller";
+ }
+
+ @Override
+ public void updateTable() {
+
+ }
+
+ @Override
+ public void startLiveWindowMode() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopLiveWindowMode() {
+ // TODO Auto-generated method stub
+
+ }
}