當前位置: 首頁>>代碼示例>>Java>>正文


Java ITable類代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.tables.ITable的典型用法代碼示例。如果您正苦於以下問題:Java ITable類的具體用法?Java ITable怎麽用?Java ITable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ITable類屬於edu.wpi.first.wpilibj.tables包,在下文中一共展示了ITable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void updateTable() {
  ITable table = getTable();
  if (table != null) {
    table.putNumber("Value", getAngle());
    table.putNumber("Pitch", getPitch());
    table.putNumber("Roll", getRoll());
    table.putNumber("Yaw", getYaw());
    table.putNumber("AccelX", getAccelX());
    table.putNumber("AccelY", getAccelY());
    table.putNumber("AccelZ", getAccelZ());
    table.putNumber("AngleX", getAngleX());
    table.putNumber("AngleY", getAngleY());
    table.putNumber("AngleZ", getAngleZ());
  }
}
 
開發者ID:2141-Spartonics,項目名稱:Spartonics-Code,代碼行數:20,代碼來源:ADIS16448_IMU.java

示例2: initPhoneVars

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
private void initPhoneVars(VisionContainer container, double defaultTargetWidth,
    double defaultTargetHeight) {
  ITable range = container.table.getSubTable("colorRange");
  if (!range.containsKey("lower")) {
    range.putNumberArray("lower", new double[] {0, 0, 0});
  }
  if (!range.containsKey("upper")) {
    range.putNumberArray("upper", new double[] {0, 0, 0});
  }
  range.setPersistent("lower");
  range.setPersistent("upper");

  ITable target = container.table.getSubTable("target");
  if (!target.containsKey("width")) {
    target.putNumber("width", defaultTargetWidth);
  }
  if (!target.containsKey("height")) {
    target.putNumber("height", defaultTargetHeight);
  }
  target.setPersistent("width");
  target.setPersistent("height");
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:23,代碼來源:Vision.java

示例3: poll

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
@Override
protected void poll() throws Exception
{
    ITable robotTable = Robot.getTable();

    if (robotTable != null && mCoordinateGui != null)
    {
        double x = Robot.getTable().getNumber(SmartDashBoardNames.sX_POSITION, 0) / 12;
        double y = Robot.getTable().getNumber(SmartDashBoardNames.sY_POSITION, 0) / 12;
        double angle = Robot.getTable().getNumber(SmartDashBoardNames.sORIENTATION, 0);

        Coordinate coord = new Coordinate(x, y, angle);
        mCoordinateGui.addCoordinate(coord);

        List<Ray> rays = parseRays();
        mCoordinateGui.setRays(rays);
    }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:19,代碼來源:CoordinateWidet2017.java

示例4: initializeLiveWindowComponents

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
/**
 * Initialize all the LiveWindow elements the first time we enter LiveWindow mode. By holding off
 * creating the NetworkTable entries, it allows them to be redefined before the first time in
 * LiveWindow mode. This allows default sensor and actuator values to be created that are replaced
 * with the custom names from users calling addActuator and addSensor.
 */
private static void initializeLiveWindowComponents() {
  System.out.println("Initializing the components first time");
  livewindowTable = NetworkTable.getTable("LiveWindow");
  statusTable = livewindowTable.getSubTable("~STATUS~");
  for (Enumeration e = components.keys(); e.hasMoreElements(); ) {
    LiveWindowSendable component = (LiveWindowSendable) e.nextElement();
    LiveWindowComponent liveWindowComponent = (LiveWindowComponent) components.get(component);
    String subsystem = liveWindowComponent.getSubsystem();
    String name = liveWindowComponent.getName();
    System.out.println("Initializing table for '" + subsystem + "' '" + name + "'");
    livewindowTable.getSubTable(subsystem).putString("~TYPE~", "LW Subsystem");
    ITable table = livewindowTable.getSubTable(subsystem).getSubTable(name);
    table.putString("~TYPE~", component.getSmartDashboardType());
    table.putString("Name", name);
    table.putString("Subsystem", subsystem);
    component.initTable(table);
    if (liveWindowComponent.isSensor()) {
      sensors.addElement(component);
    }
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:28,代碼來源:LiveWindow.java

示例5: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的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

示例6: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的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

示例7: updateTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
@Override
public default void updateTable() {
    ITable table = getTable();
    if(table != null) {
        table.putString("~TYPE~", SMART_DASHBOARD_TYPE);
        table.putString("Type", getClass().getSimpleName()); // "CANTalon", "CANJaguar"
        table.putNumber("Mode", getControlMode().getValue());
        if (getControlMode().isPID()) {
            // CANJaguar throws an exception if you try to get its PID constants
            // when it's not in a PID-compatible mode
            table.putNumber("p", getP());
            table.putNumber("i", getI());
            table.putNumber("d", getD());
            table.putNumber("f", getF());
        }
        table.putBoolean("Enabled", isEnabled());
        table.putNumber("Value", get());
    }
}
 
開發者ID:trc492,項目名稱:Frc2016FirstStronghold,代碼行數:20,代碼來源:CANSpeedController.java

示例8: initTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
@Override
public void initTable(ITable table) {
  m_table = table;
  if (table != null) {
    if (m_defaultCommand != null) {
      table.putBoolean("hasDefault", true);
      table.putString("default", m_defaultCommand.getName());
    } else {
      table.putBoolean("hasDefault", false);
    }
    if (m_currentCommand != null) {
      table.putBoolean("hasCommand", true);
      table.putString("command", m_currentCommand.getName());
    } else {
      table.putBoolean("hasCommand", false);
    }
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:19,代碼來源:Subsystem.java

示例9: initTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
public void initTable(ITable subtable) {
    if (this.m_table != null)
        this.m_table.removeTableListener(m_listener);
    this.m_table = subtable;
    m_table.addTableListener(m_listener);

    // values expected to come from robot or dashboard
    this.AutoAimEnabled = m_table.getBoolean("AutoAimEnabled", false);
    this.TargetHigh = m_table.getBoolean("TargetHigh", true);

    // values expected to arrive from jetson
    this.FPS = (int) m_table.getNumber("FPS", 0.);
    this.TargetAcquired = (int) m_table.getNumber("TargetAcquired", 0);
    this.TargetX = m_table.getNumber("TargetX", 0);
    this.TargetY = m_table.getNumber("TargetY", 0);
}
 
開發者ID:Spartronics4915,項目名稱:2016-Stronghold,代碼行數:17,代碼來源:VisionState.java

示例10: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  setSpeed(0); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      setSpeed(((Double) value).doubleValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
 
開發者ID:trc492,項目名稱:Frc2016FirstStronghold,代碼行數:13,代碼來源:PWM.java

示例11: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的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

示例12: getData

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
/**
 * Returns the value at the specified key.
 *
 * @param key the key
 * @return the value
 * @throws NetworkTableKeyNotDefined if there is no value mapped to by the key
 * @throws IllegalArgumentException  if the key is null
 */
public static Sendable getData(String key) {
  ITable subtable = table.getSubTable(key);
  Object data = tablesToData.get(subtable);
  if (data == null) {
    throw new IllegalArgumentException("SmartDashboard data does not exist: " + key);
  } else {
    return (Sendable) data;
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:18,代碼來源:SmartDashboard.java

示例13: initTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
@Override
public void initTable(ITable table) {
  m_table = table;
  if (table != null) {
    table.putStringArray(OPTIONS, m_map.keySet().toArray(new String[0]));
    if (m_defaultChoice != null) {
      table.putString(DEFAULT, m_defaultChoice);
    }
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:11,代碼來源:SendableChooser.java

示例14: startLiveWindowMode

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  set(false); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Boolean) value).booleanValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
 
開發者ID:trc492,項目名稱:Frc2016FirstStronghold,代碼行數:13,代碼來源:Solenoid.java

示例15: initTable

import edu.wpi.first.wpilibj.tables.ITable; //導入依賴的package包/類
@Override
public void initTable(ITable table) {
  m_table = table;
  if (table != null) {
    table.putBoolean("pressed", get());
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:8,代碼來源:Trigger.java


注:本文中的edu.wpi.first.wpilibj.tables.ITable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。