/** * Maps the specified key to the specified value in this table. The key can not be null. The value * can be retrieved by calling the get method with a key that is equal to the original key. * * @param key the key * @param data the value * @throws IllegalArgumentException if key is null */ @SuppressWarnings("unchecked") public static void putData(String key, Sendable data) { ITable dataTable = table.getSubTable(key); dataTable.putString("~TYPE~", data.getSmartDashboardType()); data.initTable(dataTable); tablesToData.put(data, key); }
public void initTable(ITable table) { this.table = table; super.initTable(table); if (table != null) { table.putNumber("error", super.getError()); table.putNumber("output", super.get()); table.putBoolean("onTarget", false); // timer = new Timer(); // timer.schedule(new // org.usfirst.frc330.wpilibj.BeachbotMultiPrefSendablePIDController.SendDataTask(), 0, 250); } }
/** {@inheritDoc} */ public void updateTable() { if (m_table != null) { if (get() == Value.kOn) { m_table.putString("Value", "On"); } else if (get() == Value.kForward) { m_table.putString("Value", "Forward"); } else if (get() == Value.kReverse) { m_table.putString("Value", "Reverse"); } else { m_table.putString("Value", "Off"); } } }
/** {@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); }
public void valueChanged(ITable table, String key, Object value, boolean isNew) { if (key.equals("p") || key.equals("i") || key.equals("d") || key.equals("f")) { if (gains.getP() != table.getNumber("p", 0.0) || gains.getI() != table.getNumber("i", 0.0) || gains.getD() != table.getNumber("d", 0.0)) { System.out.println("Got new PID gains!"); gains.set( table.getNumber("p", 0.0), table.getNumber("i", 0.0), table.getNumber("d", 0.0)); } } else if (key.equals("setpoint")) { if (goal != ((Double) value).doubleValue()) { setGoal(((Double) value).doubleValue()); } } else if (key.equals("enabled")) { if (isEnabled() != ((Boolean) value).booleanValue()) { if (((Boolean) value).booleanValue()) { enable(); } else { disable(); } } } }
/** {@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); }
public void initTable(ITable table) { if (this.table != null) { this.table.removeTableListener(listener); } this.table = table; if (table != null) { table.putNumber("p", gains.getP()); table.putNumber("i", gains.getI()); table.putNumber("d", gains.getD()); table.putNumber("f", gains.getF()); table.putNumber("goal", goal); table.putNumber("source", source.get()); table.putBoolean("enabled", isEnabled()); table.addTableListener(listener, false); } }
/** {@inheritDoc} */ public void updateTable() { if (m_table != null) { m_table.putNumber("Value", getVoltage()); } }
/** {@inheritDoc} */ @Override public void updateTable() { if (m_table != null) { m_table.putBoolean("Value", get()); } }
/** {@inheritDoc} */ public void stopLiveWindowMode() { // TODO: Broken, should only remove the listener from "Value" only. m_table.removeTableListener(m_table_listener); }
public TableWidgetContainer(String key, ITable table, WidgetRegistry widgetRegistry) { this.widgetRegistry = widgetRegistry; this.table = table; this.key = key; table.addTableListener("~TYPE~", this, true); }
/** {@inheritDoc} */ public void stopLiveWindowMode() { setSpeed(0); // Stop for safety // TODO: Broken, should only remove the listener from "Value" only. m_table.removeTableListener(m_table_listener); }