public void run() { int count = 0; while (count < 5) { display(value); Service.sleep(delay); display(" "); Service.sleep(delay); ++count; } if (leaveOn) { display(value); } }
public void startService() { super.startService(); try { serial = getSerial(); // setting callback / message route serial.addListener("publishByte", getName(), "byteReceived"); serial.startService(); if (model == null) { model = MODEL_SICK_LMS200; } // start LIDAR hardware initialization here // data coming back from the hardware will be in byteRecieved if (MODEL_SICK_LMS200.equals(model)) { serial.write(new byte[] {1, 38, 32, 43}); } state = STATE_INITIALIZATION_STAGE_1; } catch (Exception e) { error(e.getMessage()); } }
public static void main(String[] args) throws ClassNotFoundException { // Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); Logging logging = LoggingFactory.getInstance(); logging.configure(); logging.setLevel(Level.INFO); // LoggingFactory.getInstance().setLevel(Level.INFO); int test = 35; log.info("{}", test); log.debug("hello"); log.trace("trace"); log.error("error"); log.info("info"); PID pid = new PID("pid"); pid.startService(); pid.setPID(2.0, 5.0, 1.0); pid.setControllerDirection(DIRECTION_DIRECT); pid.setMode(MODE_AUTOMATIC); pid.setOutputRange(0, 255); pid.setSetpoint(100); pid.setSampleTime(40); GUIService gui = new GUIService("gui"); gui.startService(); for (int i = 0; i < 200; ++i) { pid.setInput(i); Service.sleep(30); if (pid.compute()) { log.info(String.format("%d %f", i, pid.getOutput())); } else { log.warn("not ready"); } } }
public void addPoseListener(Service service) { addListener("publishPose", service.getName(), "onPose", Pose.class); }
public void addOrientationDataListener(Service service) { addListener("publishOrientationData", service.getName(), "onOrientationData"); }
@Override public void startService() { super.startService(); arduino.startService(); attach(arduino); }
public void releaseService() { detach(); super.releaseService(); }