@Override public Double getMax() { return getRange().getMax(); }
@Override public Double getMin() { return getRange().getMin(); }
@Override public NormalizedDouble normalizeValue(Double t) { return getRange().normalizeValue(t); }
public static ConfigurationNode writeNormalizableRange( NormalizableRange range) { if(range == null) { return null; } ConfigurationNode node = XMLConfigUtils.node(NORMALIZABLE_RANGE); node.addChild(XMLConfigUtils.node(RANGE_MIN, range.getMin())); node.addChild(XMLConfigUtils.node(RANGE_MAX, range.getMax())); return node; }
@Override public boolean isValid(Double t) { return getRange().isValid(t); }
@Override public Double denormalizeValue(NormalizedDouble v) { return getRange().denormalizeValue(v); }
/** * * @param xs * @param range * @throws IOException */ public static void writeNormalizableRange( XmlSerializer xs, NormalizableRange range) throws IOException { xs.startTag(NAMESPACE, RANGE_MIN); xs.text(range.getMin().toString()); xs.endTag(NAMESPACE, RANGE_MIN); xs.startTag(NAMESPACE, RANGE_MAX); xs.text(range.getMax().toString()); xs.endTag(NAMESPACE, RANGE_MAX); }
private NormalizedDouble getJointPosition(Joint joint){ JointProperty prop = joint.getProperty(ReadCurrentPosition.PROPERTY_NAME); if(prop == null){ return null; } NormalizableRange range = prop.getNormalizableRange(); Object val = prop.getValue(); if(range == null || val == null){ return null; } return range.normalizeValue(val); }
@Override public RobotPositionMap getCurrentPositions() { if(myJointMap == null){ throw new NullPointerException(); } RobotPositionMap posMap = new RobotPositionHashMap(myJointMap.size()); for(Entry<Robot.JointId, J> e : myJointMap.entrySet()){ Robot.JointId id = e.getKey(); if(id == null){ throw new NullPointerException(); } J joint = e.getValue(); if(joint == null){ throw new NullPointerException(); } NormalizedDouble val; JointProperty curPos = joint.getProperty(ReadCurrentPosition.PROPERTY_NAME); if(curPos != null){ NormalizableRange range = curPos.getNormalizableRange(); Object obj = curPos.getValue(); val = range.normalizeValue(obj); }else{ val = joint.getGoalPosition(); } posMap.put(id, val); } return posMap; }