@OPERATION void move(double x, double y, double speed) { try { execLinkedOp("env-link", "move", ID, x, y, speed); } catch (Exception e) { e.printStackTrace(); failed("Move linked operation failed", "fail", ID, e); } }
@OPERATION void stopDevice() { try { execLinkedOp("to-device", "stopDevice"); } catch (Exception e) { e.printStackTrace(); failed("stopDevice linked operation failed", "fail", e.getMessage()); } }
@OPERATION void sense() { OpFeedbackParam<PersonSenseData[]> people = new OpFeedbackParam<>(); OpFeedbackParam<PoTSenseData[]> points = new OpFeedbackParam<>(); try { execLinkedOp("env-link", "sense", ID, people, points); ObsProperty peoplep = getObsProperty("people"); ObsProperty pointsp = getObsProperty("points"); peoplep.updateValue(toArray(people.get())); pointsp.updateValue(toArray(points.get())); } catch (Exception e) { e.printStackTrace(); failed("Sense linked operation failed", "fail", ID, e); } }
/** The command code */ public void exec() { try { ObsProperty prop = getObsProperty(propertyName); prop.updateValues( checkNan(currentScan[0]), checkNan(currentScan[(int) (laserScanSize * 0.25)]), checkNan(currentScan[(int) (laserScanSize * 0.5)]), checkNan(currentScan[(int) (laserScanSize * 0.75)]), checkNan(currentScan[laserScanSize - 1])); // prop.updateValues(checkNan(currentScan[0]), checkNan(currentScan[182]), // checkNan(currentScan[363]), checkNan(currentScan[544]), // checkNan(currentScan[laserScanSize-1])); } catch (Exception ex) { ex.printStackTrace(); } }
@SuppressWarnings("unchecked") @OPERATION void input_data() { String file = "simulation.yaml"; Yaml yaml = new Yaml(); Object data; try { data = yaml.load(new FileInputStream(file)); } catch (FileNotFoundException e) { failed("User Input failed", "fail", file, e.getMessage()); return; } LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) data; try { for (Entry<String, Object> entry : map.entrySet()) { switch (entry.getKey()) { case "World": defineObsProperty("parameter", "world"); readWorld((LinkedHashMap<String, Object>) entry.getValue()); break; case "Simulation": defineObsProperty("parameter", "simulation"); readSimulation((LinkedHashMap<String, Object>) entry.getValue()); break; case "Analysis": defineObsProperty("parameter", "analysis"); readAnalysis((LinkedHashMap<String, Object>) entry.getValue()); break; case "People": defineObsProperty("parameter", "people"); readPeople((ArrayList<Object>) entry.getValue()); break; case "Hovering": defineObsProperty("parameter", "hovering"); readHovering((ArrayList<Object>) entry.getValue()); break; } } } catch (Exception e) { failed("Parameter parsing failed", "fail", file, e.getMessage()); return; } }