public byte toByte() { return (byte) ordinal(); }
public byte toByte() { return (byte) ordinal(); }
public String toString() { return "State= " + highLevelState.toString(); }
@Override public boolean checkCondition() { return handDesiredConfiguration.getEnumValue().equals(HandConfiguration.HOOK); } };
public static HighLevelStateChangeStatusMessage createHighLevelStateChangeStatusMessage(HighLevelControllerName initialState, HighLevelControllerName endState) { HighLevelStateChangeStatusMessage message = new HighLevelStateChangeStatusMessage(); message.setInitialHighLevelControllerName(initialState == null ? -1 : initialState.toByte()); message.setEndHighLevelControllerName(endState == null ? -1 : endState.toByte()); return message; }
@Override public void setFromMessage(HighLevelStateMessage message) { highLevelControllerName = HighLevelControllerName.fromByte(message.getHighLevelControllerName()); }
public double getJointAngle(HandJointName jointName) { double[] source; switch (jointName.getFinger(robotSide)) { case INDEX : source = indexJoints; break; case MIDDLE : source = middleJoints; break; default : source = thumbJoints; } int index = jointName.getHandJointAngleIndex(); if (index == -1) { return 0; } return source[index]; }
public BlindWalkingPacket(Random random) { final double X_MAX = 128.0; final double Y_MAX = 128.0; Point2d point = new Point2d(0.9 * random.nextDouble() * X_MAX, 0.9 * random.nextDouble() * Y_MAX); BlindWalkingDirection direction = BlindWalkingDirection.fromIntegerValue(random.nextInt(4)); BlindWalkingSpeed speed = BlindWalkingSpeed.fromIntegerValue(random.nextInt(3)); Boolean isInMud = random.nextBoolean(); this.desiredDestination = point; this.blindWalkingDirection = direction; this.blindWalkingSpeed = speed; this.isInMud = isInMud; } }
@Override public boolean epsilonEquals(BlindWalkingPacket other, double epsilon) { boolean ret = this.getDesiredDestination().epsilonEquals(other.getDesiredDestination(), epsilon); ret &= (this.getBlindWalkingDirection().equals(other.getBlindWalkingDirection())); ret &= (this.getBlindWalkingSpeed().equals(other.getBlindWalkingSpeed())); return ret; }
@Override public String toString() { return robotSide.toString() + " State= " + handDesiredConfiguration.toString(); }
@Override public boolean checkCondition() { return desiredGraspMode.getEnumValue().equals(RobotiqGraspMode.WIDE_MODE) && handDesiredConfiguration.getEnumValue().equals(HandConfiguration.OPEN_THUMB); } };
public static HighLevelStateMessage createHighLevelStateMessage(HighLevelControllerName highLevelControllerName) { HighLevelStateMessage message = new HighLevelStateMessage(); message.setHighLevelControllerName(highLevelControllerName.toByte()); return message; }
@Override public boolean epsilonEquals(HighLevelStateMessage other, double epsilon) { return this.getHighLevelState().equals(other.getHighLevelState()); }
@Override public boolean checkCondition() { return desiredGraspMode.getEnumValue().equals(RobotiqGraspMode.BASIC_MODE) && handDesiredConfiguration.getEnumValue().equals(HandConfiguration.CLOSE); } };
@Override public boolean checkCondition() { return desiredGraspMode.getEnumValue().equals(RobotiqGraspMode.PINCH_MODE) && handDesiredConfiguration.getEnumValue().equals(HandConfiguration.OPEN_THUMB); } };
@Override public boolean checkCondition() { return desiredGraspMode.getEnumValue().equals(RobotiqGraspMode.PINCH_MODE) && handDesiredConfiguration.getEnumValue().equals(HandConfiguration.CLOSE_FINGERS); } };
@Override public boolean checkCondition() { return desiredGraspMode.getEnumValue().equals(RobotiqGraspMode.WIDE_MODE) && handDesiredConfiguration.getEnumValue().equals(HandConfiguration.CLOSE_FINGERS); } };
@Override public boolean epsilonEquals(HandDesiredConfigurationMessage other, double epsilon) { boolean ret = (this.getRobotSide() == other.getRobotSide()); ret &= (this.getHandDesiredConfiguration().equals(other.getHandDesiredConfiguration())); return ret; } }