本文整理汇总了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);
}
示例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);
}
示例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;
}
}
};
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}