当前位置: 首页>>代码示例>>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;未经允许,请勿转载。