Java 类edu.wpi.first.wpilibj.tables.ITable 实例源码

项目:Spartonics-Code    文件:ADIS16448_IMU.java   
/**
 * {@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());
  }
}
项目:Steamworks2017Robot    文件:Vision.java   
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");
}
项目:CasseroleLib    文件:ADIS16448_IMU.java   
/**
 * {@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());
  }
}
项目:snobot-2017    文件:CoordinateWidet2017.java   
@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);
    }
}
项目:snobot-2017    文件:LiveWindow.java   
/**
 * 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);
    }
  }
}
项目:Frc2016FirstStronghold    文件:Relay.java   
/**
 * {@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);
}
项目:snobot-2017    文件:Relay.java   
@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);
}
项目:Frc2016FirstStronghold    文件:CANSpeedController.java   
@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());
    }
}
项目:snobot-2017    文件:Subsystem.java   
@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);
    }
  }
}
项目:2016-Stronghold    文件:VisionState.java   
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);
}
项目:FRC2017    文件:ADIS16448_IMU.java   
/**
 * {@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());
  }
}
项目:Frc2016FirstStronghold    文件:PWM.java   
/**
 * {@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);
}
项目:snobot-2017    文件:PWM.java   
@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);
}
项目:snobot-2017    文件:SmartDashboard.java   
/**
 * 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;
  }
}
项目:snobot-2017    文件:SendableChooser.java   
@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);
    }
  }
}
项目:Frc2016FirstStronghold    文件:Solenoid.java   
/**
 * {@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);
}
项目:snobot-2017    文件:Trigger.java   
@Override
public void initTable(ITable table) {
  m_table = table;
  if (table != null) {
    table.putBoolean("pressed", get());
  }
}
项目:Frc2016FirstStronghold    文件:DigitalOutput.java   
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
  m_table_listener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Boolean) value).booleanValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:snobot-2017    文件:Command.java   
@Override
public void initTable(ITable table) {
  if (m_table != null) {
    m_table.removeTableListener(m_listener);
  }
  m_table = table;
  if (table != null) {
    table.putString("name", getName());
    table.putBoolean("running", isRunning());
    table.putBoolean("isParented", m_parent != null);
    table.addTableListener("running", m_listener, false);
  }
}
项目:snobot-2017    文件:Scheduler.java   
@Override
public void initTable(ITable subtable) {
  m_table = subtable;

  m_table.putStringArray("Names", new String[0]);
  m_table.putNumberArray("Ids", new double[0]);
  m_table.putNumberArray("Cancel", new double[0]);
}
项目:snobot-2017    文件:CommandParser.java   
/**
 * Creates a CommandParser object.
 * 
 * @param aSnobot
 *            The robot using the CommandParser.
 * @param aStartPosition
 */
public CommandParser(Snobot aSnobot, ITable aAutonTable, String aParserName, SelectStartPosition aStartPosition, CommandParser aDefenseParser,
        DefenseInFront aDefenseGetter)
{
    super(" ", "#");
    mSnobot = aSnobot;
    mAutonTable = aAutonTable;
    mParserName = aParserName;
    mDefenseParser = aDefenseParser;
    mDefenseGetter = aDefenseGetter;
    mStartPosition = aStartPosition;
}
项目:2016-Stronghold    文件:VisionState.java   
@Override
public void valueChanged(ITable table, String key, Object value,
        boolean isNew) {
    /*
     * All numbers are stored as doubles in the network tables, event
     * those posted as int, float.
     */
    /* debug:
    System.out.println(key + " " + value + " " +
            value.getClass().getName());
    */

    if (key.equals("~TYPE~")) {
        return;
    }
    else if (key.equals("AutoAimEnabled")) {
        s_instance.AutoAimEnabled = (boolean) value;
    }
    else {
        // System.out.println(key + " " + value);
        double num = (Double) value;
        int ival = (int) num;
        if (key.equals("FPS"))
            s_instance.FPS = ival;
        else if (key.equals("TargetAcquired"))
            s_instance.TargetAcquired = ival;
        else if (key.equals("TargetX")) {
            s_instance.TargetX = num;
        }
        else if (key.equals("TargetY"))
            s_instance.TargetY = num;
        else
            System.out.println(key + " " + value + " " +
                    value.getClass().getName());
    }
}
项目:FRC2016    文件:VisionHandler.java   
@Override
public void valueChangedEx(ITable table, String key, Object value, int newP) {
    timeLastSeen = time.get();
    boolean newKey = (newP & 0x04) != 0;
    boolean updated = (newP & 0x10) != 0;
    if (updated) {
        VisionHandler.getInstance().update(table);
    }
}
项目:FRC2016    文件:VisionHandler.java   
public Line[] getLines(ITable lineReport) { // This marshals stuff from the
                                            // NetworkTable to
                                            // a bunch of line objects.
    double[] x1s = lineReport.getNumberArray("x1", Constants.emptydoubleTable);
    double[] x2s = lineReport.getNumberArray("x2", Constants.emptydoubleTable);
    double[] y1s = lineReport.getNumberArray("y1", Constants.emptydoubleTable);
    double[] y2s = lineReport.getNumberArray("y2", Constants.emptydoubleTable);
    double[] lengths = lineReport.getNumberArray("length", Constants.emptydoubleTable);
    double[] angles = lineReport.getNumberArray("angle", Constants.emptydoubleTable);
    Line[] lineTable = new Line[x1s.length + 10];
    for (int i = 0; i < x1s.length; i++) {
        lineTable[i] = new Line();
    }
    for (int i = 0; i < x1s.length; i++) {
        lineTable[i].x1 = x1s[i];
    }
    for (int i = 0; i < x2s.length; i++) {
        lineTable[i].x2 = x2s[i];
    }
    for (int i = 0; i < y1s.length; i++) {
        lineTable[i].y1 = y1s[i];
    }
    for (int i = 0; i < y2s.length; i++) {
        lineTable[i].y2 = y2s[i];
    }
    for (int i = 0; i < lengths.length; i++) {
        lineTable[i].length = lengths[i];
    }
    for (int i = 0; i < angles.length; i++) {
        lineTable[i].angle = angles[i];
    }
    return lineTable;
}
项目:StormRobotics2017    文件:StringPot.java   
@Override
public void initTable(ITable subtable) {
    _table = subtable;
    updateTable();
}
项目:StormRobotics2017    文件:StringPot.java   
@Override
public ITable getTable() {
    return _table;
}
项目:StormRobotics2017    文件:HallEffectSensor.java   
@Override
public void initTable(ITable subtable) {
    _table = subtable;
    updateTable();
}
项目:StormRobotics2017    文件:HallEffectSensor.java   
@Override
public ITable getTable() {
    return _table;
}
项目:StormRobotics2017    文件:RotaryPot.java   
@Override
public void initTable(ITable subtable) {
    _table = subtable;
    updateTable();
}
项目:StormRobotics2017    文件:RotaryPot.java   
@Override
public ITable getTable() {
    return _table;
}
项目:Frc2016FirstStronghold    文件:Preferences.java   
@Override
public void valueChanged(ITable table, String key, Object value, boolean isNew) {
  // unused
}
项目:Frc2016FirstStronghold    文件:Compressor.java   
@Override
public ITable getTable() {
  return m_table;
}
项目:frc-2016    文件:MultiSpeedController.java   
/**
 * {@inheritDoc}
 */
@Override
public void initTable(ITable subtable) {
    m_table = subtable;
    updateTable();
}
项目:frc-2016    文件:MultiSpeedController.java   
/**
 * {@inheritDoc}
 */
@Override
public ITable getTable() {
    return m_table;
}
项目:Frc2016FirstStronghold    文件:AnalogInput.java   
/**
 * {@inheritDoc}
 */
public void initTable(ITable subtable) {
  m_table = subtable;
  updateTable();
}
项目:Frc2016FirstStronghold    文件:Relay.java   
/**
 * {@inheritDoc}
 */
@Override
public ITable getTable() {
  return m_table;
}
项目:2016Robot    文件:IMU.java   
public void initTable(ITable itable) {
    m_table = itable;
    updateTable();
}
项目:Frc2016FirstStronghold    文件:PWM.java   
/**
 * {@inheritDoc}
 */
public void initTable(ITable subtable) {
  m_table = subtable;
  updateTable();
}
项目:Stronghold2016    文件:AHRS.java   
public void initTable(ITable itable) {
    m_table = itable;
    updateTable();
}
项目:Frc2016FirstStronghold    文件:ADXL345_SPI.java   
/** {@inheritDoc} */
public ITable getTable() {
  return m_table;
}