@Override public void setValue(DeviceAttribute value) throws Exception { if (attributeName == null) throw new NullPointerException("Cannot read attribute " + null); tangoProxy.write_attribute(value); // Does not block for spec motors! // TODO Talk to Andy about blocking until setValue has completed? Spec does not... // For now we check value // FIXME // START BODGE WARNING try { Thread.sleep(50); // Fudge incase tango is not blocking properly again. } catch (Exception ignored) { } try { double current = getValue().extractDouble(); double required = value.extractDouble(); double tolerance = 0.001; // That does not really work!! int total = 0; while (current > (required + tolerance) || current < (required - tolerance)) { if (total > 5000) { logger.error("TIMEOUT: Cannot set motor value " + getUri() + " synchronously!"); return; } try { Thread.sleep(200); } catch (Exception ne) { break; } total += 200; current = getValue().extractDouble(); } } catch (Exception ignored) { return; } // END BODGE WARNING }