edu.wpi.first.wpilibj.networktables.NetworkTablesJNI的实例源码

项目:Steamworks2017Robot    文件Vision.java   
@Override
public void sendDataToSmartDashboard() {
  // phone handles vision data for us
  SmartDashboard.putBoolean("LED_On",isLedRingOn());

  boolean gearLiftPhone = false;
  boolean boilerPhone = false;
  ConnectionInfo[] connections = NetworkTablesJNI.getConnections();
  for (ConnectionInfo connInfo : connections) {
    if (System.currentTimeMillis() - connInfo.last_update < 100) {
      if (connInfo.remote_id.equals("Android_GEAR_LIFT")) {
        gearLiftPhone = true;
      } else if (connInfo.remote_id.equals("Android_BOILER")) {
        boilerPhone = true;
      }
    }
  }

  SmartDashboard.putBoolean("VisionGearLift",gearLiftPhone);
  SmartDashboard.putBoolean("VisionGearLift_data",isGearVisionDataValid());
  SmartDashboard.putBoolean("VisionBoiler",boilerPhone);
  SmartDashboard.putBoolean("VisionBoiler_data",isBoilerVisionDataValid());
}
项目:grip    文件NTManager.java   
private void addListener() {
  entryListenerFunctionUid = NetworkTablesJNI.addEntryListener(path,(uid,key,value,flags) -> {
        object = value;
        listeners.forEach(c -> c.accept(object));
      },ITable.NOTIFY_IMMEDIATE
          | ITable.NOTIFY_NEW
          | ITable.NOTIFY_UPDATE
          | ITable.NOTIFY_DELETE
          | ITable.NOTIFY_LOCAL);
}
项目:grip    文件NTManager.java   
@Override
public void close() {
  NetworkTablesJNI.removeEntryListener(entryListenerFunctionUid);

  synchronized (NetworkTable.class) {
    // This receiver is no longer used.
    if (NTManager.count.addAndGet(-1) == 0) {
      // We are the last resource using NetworkTables so shut it down
      NetworkTable.shutdown();
    }
  }
}
项目:FB2016    文件Vision.java   
public double getAngle() {
    double offs = (NetworkTablesJNI.getDouble(NT_ANGLE,0) + 30);
    double getting = ANGLE_MULTIPLIER * offs;
    movingAvg = (movingAvg + getting) / 2.;
    return movingAvg;
}
项目:FB2016    文件Vision.java   
public double getRemainingdistance() {
    return NetworkTablesJNI.getDouble(NT_disTANCE,0);
}
项目:grip    文件NTManager.java   
@Inject
NTManager() {
  // We may have another instance of this method lying around
  NetworkTable.shutdown();

  // Redirect NetworkTables log messages to our own log files.  This gets rid of console spam,// and it also lets
  // us grep through NetworkTables messages just like any other messages.
  NetworkTablesJNI.setLogger((level,file,line,msg) -> {
    String filename = new File(file).getName();
    logger.log(ntLogLevels.get(level),String.format("NetworkTables: %s:%d %s",filename,msg));
  },0);

  NetworkTable.setClientMode();

  // When in headless mode,start and stop the pipeline based on the "grip/run" key.  This
  // allows robot programs
  // to control grip without actually restarting the process.
  NetworkTable.getTable("grip").addTableListener("run",(source,isNew) -> {
    if (gripMode == gripMode.HEADLESS) {
      if (!(value instanceof Boolean)) {
        logger.warning("NetworkTables value grip/run should be a boolean!");
        return;
      }

      if ((Boolean) value) {
        if (!pipelineRunner.isRunning()) {
          logger.info("Starting grip from NetworkTables");
          pipelineRunner.startAsync();
        }
      } else if (pipelineRunner.isRunning()) {
        logger.info("Stopping grip from NetworkTables");
        pipelineRunner.stopAsync();

      }
    }
  },true);

  NetworkTable.shutdown();
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...