当前位置: 首页>>代码示例>>Java>>正文


Java ITableListener类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.tables.ITableListener的典型用法代码示例。如果您正苦于以下问题:Java ITableListener类的具体用法?Java ITableListener怎么用?Java ITableListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ITableListener类属于edu.wpi.first.wpilibj.tables包,在下文中一共展示了ITableListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
@Override
public void startLiveWindowMode() {
  m_tableListener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      String val = ((String) value);
      if (val.equals("Off")) {
        set(Value.kOff);
      } else if (val.equals("On")) {
        set(Value.kOn);
      } else if (val.equals("Forward")) {
        set(Value.kForward);
      } else if (val.equals("Reverse")) {
        set(Value.kReverse);
      }
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:20,代码来源:Relay.java

示例2: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  set(Value.kOff); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      // TODO: this is bad also
      if (value.toString().equals("Reverse"))
        set(Value.kReverse);
      else if (value.toString().equals("Forward"))
        set(Value.kForward);
      else
        set(Value.kOff);
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:19,代码来源:DoubleSolenoid.java

示例3: createTableListener

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * Creates an ITableListener for the LiveWindow table for this CAN speed
 * controller.
 */
public default ITableListener createTableListener() {
    return (table, key, value, isNew) -> {
        switch(key) {
            case "Enabled":
                if ((Boolean) value) {
                    enable();
                } else {
                    disable();
                }
                break;
            case "Value": set((Double) value); break;
            case "Mode": setControlMode(((Double) value).intValue()); break;
        }
        if(getControlMode().isPID()) {
          switch(key) {
              case "p": setP((Double) value); break;
              case "i": setI((Double) value); break;
              case "d": setD((Double) value); break;
              case "f": setF((Double) value); break;
          }
        }
    };
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:28,代码来源:CANSpeedController.java

示例4: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
  m_table_listener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      String val = ((String) value);
      if (val.equals("Off")) {
        set(Value.kOff);
      } else if (val.equals("On")) {
        set(Value.kOn);
      } else if (val.equals("Forward")) {
        set(Value.kForward);
      } else if (val.equals("Reverse")) {
        set(Value.kReverse);
      }
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:23,代码来源:Relay.java

示例5: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        @Override
        public void valueChanged(ITable itable, String key, Object value,
                                 boolean bln) {
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            } else if (val.equals("On")) {
                set(Value.kOn);
            } else if (val.equals("Forward")) {
                set(Value.kForward);
            } else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:tombot,项目名称:FakeWPILib,代码行数:24,代码来源:Relay.java

示例6: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(Value.kOff); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
//TODO: this is bad also
            if (value.toString().equals("Reverse"))
	set(Value.kReverse);
else if (value.toString().equals("Forward"))
	set(Value.kForward);
else
	set(Value.kOff);
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:19,代码来源:DoubleSolenoid.java

示例7: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            }
            else if (val.equals("Forward")) {
                set(Value.kForward);
            }
            else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:21,代码来源:Relay.java

示例8: initCatcherTable

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
private static void initCatcherTable(){
    
    m_table.putBoolean(NETTABLE_CATCHER_CATCHER_STATE, m_solenoidCatcher.get());
    m_table.putBoolean(NETTABLE_CATCHER_FLIPPER_STATE, m_solenoidFlipper.get());
    m_table.putNumber(NETTABLE_CATCHER_SPINDLE_SCALE, m_spindleScale);
    m_tableListener = new ITableListener(){
        public void valueChanged(ITable table, String key, Object value, boolean isNew){
            if(key.equals(NETTABLE_CATCHER_CATCHER_STATE)){
                m_solenoidCatcher.set(((Boolean)value).booleanValue());
            }else if(key.equals(NETTABLE_CATCHER_FLIPPER_STATE)){
                m_solenoidFlipper.set(((Boolean)value).booleanValue());
            }else if(key.equals(NETTABLE_CATCHER_SPINDLE_SCALE)){
                setSpindleScale(((Double)value).doubleValue());
            }
        }
    };
    
    m_table.addTableListener(m_tableListener, true);
}
 
开发者ID:WestwoodRobotics,项目名称:Robot-Java-2014,代码行数:20,代码来源:SS_BallCatcher.java

示例9: initDriveTable

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
private static void initDriveTable(){
    m_table.putNumber(NETTABLE_DRIVETRAIN_DRIVEMODE, DriveMode.ARCADE.getMode());
    m_table.putString(NETTABLE_DRIVETRAIN_DRIVEMODE_STRING, DriveMode.ARCADE.toString());
    m_table.putBoolean(NETTABLE_DRIVETRAIN_SOLENOID, DriveMode.ARCADE.getSolenoid());
    m_table.putString(NETTABLE_DRIVETRAIN_DEFAULT_COMMAND, DriveMode.ARCADE.getCommand().getName());
    m_table.putNumber(NETTABLE_DRIVETRAIN_SCALE, m_scale);
    m_tableListener = new ITableListener(){
        public void valueChanged(ITable table, String key, Object value, boolean isNew){
            if(key.equalsIgnoreCase(NETTABLE_DRIVETRAIN_DRIVEMODE)){
                new C_ChangeDrivemode(table.getNumber(NETTABLE_DRIVETRAIN_DRIVEMODE)).start();
            }else if(key.equals(NETTABLE_DRIVETRAIN_SCALE)){
                m_scale = table.getNumber(NETTABLE_DRIVETRAIN_SCALE);
            }
        }
    };
    
    m_table.addTableListener(m_tableListener, true);
}
 
开发者ID:WestwoodRobotics,项目名称:Robot-Java-2014,代码行数:19,代码来源:SS_Drivetrain.java

示例10: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(Value.kOff); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
//TODO: this is bad also
            if (value.toString().equals("Reverse"))
	set(Value.kReverse);
else if (value.toString().equals("Forward"))
	set(Value.kForward);
else
	set(Value.kOff);
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:eshsrobotics,项目名称:wpilib-java,代码行数:20,代码来源:DoubleSolenoid.java

示例11: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            }
            else if (val.equals("Forward")) {
                set(Value.kForward);
            }
            else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:eshsrobotics,项目名称:wpilib-java,代码行数:22,代码来源:Relay.java

示例12: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
	stopMotor(); // Stop for safety
	m_table_listener = new ITableListener() {
		@Override
		public void valueChanged(ITable itable, String key, Object value, boolean bln) {
			set(((Double) value).doubleValue());
		}
	};
	m_table.addTableListener("Value", m_table_listener, true);
}
 
开发者ID:chopshop-166,项目名称:frc-2016,代码行数:15,代码来源:MultiSpeedController.java

示例13: initializeTrajectoryListener

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
private void initializeTrajectoryListener()
{

    ITable mTable = NetworkTable.getTable(SmartDashBoardNames.sSPLINE_NAMESPACE);
    ITableListener idealSplineListener = new ITableListener()
    {

        @Override
        public void valueChanged(ITable arg0, String arg1, Object arg2, boolean arg3)
        {
            mCoordinateGui.setPath(IdealSplineSerializer.deserializePath(arg2.toString()));
        }
    };
    mTable.addTableListener(SmartDashBoardNames.sSPLINE_IDEAL_POINTS, idealSplineListener, true);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:16,代码来源:CoordinateWidet2017.java

示例14: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
@Override
public void startLiveWindowMode() {
  m_tableListener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set((Boolean) value);
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:11,代码来源:DigitalOutput.java

示例15: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITableListener; //导入依赖的package包/类
@Override
public void startLiveWindowMode() {
  setSpeed(0); // Stop for safety
  m_tableListener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      setSpeed((Double) value);
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:11,代码来源:PWM.java


注:本文中的edu.wpi.first.wpilibj.tables.ITableListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。