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


Java NetworkTable.putNumber方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.networktables.NetworkTable.putNumber方法的典型用法代碼示例。如果您正苦於以下問題:Java NetworkTable.putNumber方法的具體用法?Java NetworkTable.putNumber怎麽用?Java NetworkTable.putNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.networktables.NetworkTable的用法示例。


在下文中一共展示了NetworkTable.putNumber方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: send

import edu.wpi.first.wpilibj.networktables.NetworkTable; //導入方法依賴的package包/類
/**
 * Writes the elements and metadata values of the codex to the NetworkTables that
 * corresponds to the Codex's enum class name.s
 * @param pCodex
 */
public <V, E extends Enum<E> & CodexOf<V>> void send(Codex<V,E> pCodex) {
  int hash = EnumUtils.hashOf(pCodex.meta().getEnum());
  
  if(!mWriters.containsKey(hash) || !mTables.containsKey(hash)) {
    mLog.warn("Cannot send codex " + pCodex.meta().getEnum().getSimpleName() + " because it has not been registered.");
    return;
  }

  @SuppressWarnings("unchecked")
  Put<V> writer = (Put<V>)mWriters.get(hash);
  NetworkTable nt = mTables.get(hash);
  
  nt.putNumber("ID", pCodex.meta().id());
  nt.putNumber("KEY", pCodex.meta().key());
  nt.putNumber("TIME_NS", pCodex.meta().timestamp());
  for(E e : EnumSet.allOf(pCodex.meta().getEnum())) {
    if(pCodex.isSet(e)) {
      writer.write(nt, e.name().toUpperCase(), pCodex.get(e));
    }
    
    // grumble grumble.... NT doesn't have a way to clear a field.
  }
}
 
開發者ID:flybotix,項目名稱:highfrequencyrobots,代碼行數:29,代碼來源:CodexNetworkTables.java

示例2: main

import edu.wpi.first.wpilibj.networktables.NetworkTable; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    NetworkTable.setClientMode();
    InetAddress address = InetAddress.getByName("roborio-1458-frc.local");
    NetworkTable.setIPAddress(address.getHostAddress());

    NetworkTable SmartDashboard = NetworkTable.getTable("SmartDashboard");

    Scanner s = new Scanner(System.in);

    //SmartDashboard.putNumber("TestValueJetson", 42);

    while(true) {
        if(s.hasNextInt()) {
            SmartDashboard.putNumber("TestValueJetson", s.nextInt());
        }
    }
}
 
開發者ID:FRC1458,項目名稱:turtleshell,代碼行數:18,代碼來源:Main.java

示例3: putPersistentNumber

import edu.wpi.first.wpilibj.networktables.NetworkTable; //導入方法依賴的package包/類
public static void putPersistentNumber(NetworkTable table, String key, double fallback) {
  table.setPersistent(key);
  if(!SmartDashboard.containsKey(key)) {
    table.putNumber(key, fallback);
  }
}
 
開發者ID:TeamMeanMachine,項目名稱:meanlib,代碼行數:7,代碼來源:DashboardUtils.java


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