/** * Updates the selection state for the angular x-axis, does not change the state of the other * axes. * <p> * Note that it is preferable to also set selection frame to which this selection is referring * to. * </p> * * @param select whether the angular x-axis is an axis of interest. */ public void selectAngularX(boolean select) { angularPart.selectXAxis(select); }
/** * Updates the selection state for the linear x-axis, does not change the state of the other * axes. * <p> * Note that it is preferable to also set selection frame to which this selection is referring * to. * </p> * * @param select whether the linear x-axis is an axis of interest. */ public void selectLinearX(boolean select) { linearPart.selectXAxis(select); }
/** * Selects an axis based on {@code axisIndex} and updates update the selection state to * {@code select}. * <p> * For an {@code axisIndex} of 0, the corresponding component is {@code x}, 1 it is {@code y}, 2 * it is {@code z}. * </p> * * @param axisIndex the index of the axis to update the selection state of. * @param select whether the chosen axis is an axis of interest. * @throws IndexOutOfBoundsException if {@code axisIndex} ∉ [0, 2]. */ public void selectAxis(int axisIndex, boolean select) { switch (axisIndex) { case 0: selectXAxis(select); break; case 1: selectYAxis(select); break; case 2: selectZAxis(select); break; default: throw new IndexOutOfBoundsException(Integer.toString(axisIndex)); } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 300000) public void testSelectionForSimpleObjective() throws Exception { ReferenceFrame taskFrame = ReferenceFrame.getWorldFrame(); SelectionMatrix3D selectionMatrix = new SelectionMatrix3D(); ReferenceFrame selectionFrame; Vector3D objective; Vector3D result; for (int i = 0; i < 1000; i++) { RigidBodyTransform selectionFrameTransform = EuclidCoreRandomTools.nextRigidBodyTransform(random); selectionFrame = ReferenceFrame.constructFrameWithUnchangingTransformFromParent("SelectionFrame", ReferenceFrame.getWorldFrame(), selectionFrameTransform); objective = EuclidCoreRandomTools.nextVector3D(random); selectionMatrix.setSelectionFrame(selectionFrame); selectionMatrix.selectXAxis(random.nextBoolean()); selectionMatrix.selectYAxis(random.nextBoolean()); selectionMatrix.selectZAxis(random.nextBoolean()); result = runTest(taskFrame, selectionMatrix, objective); } if (visualize) { visualize(taskFrame, selectionFrame, objective, result); } }
public SelectionMatrix6D getSelectionMatrix() { SelectionMatrix6D selectionMatrix = new SelectionMatrix6D(); selectionMatrix.clearSelection(); if (trajectorySelectionMatrix.getLinearPart().isXSelected() || explorationSelectionMatrix.getLinearPart().isXSelected()) selectionMatrix.getLinearPart().selectXAxis(true); if (trajectorySelectionMatrix.getLinearPart().isYSelected() || explorationSelectionMatrix.getLinearPart().isYSelected()) selectionMatrix.getLinearPart().selectYAxis(true); if (trajectorySelectionMatrix.getLinearPart().isZSelected() || explorationSelectionMatrix.getLinearPart().isZSelected()) selectionMatrix.getLinearPart().selectZAxis(true); if (trajectorySelectionMatrix.getAngularPart().isXSelected() || explorationSelectionMatrix.getAngularPart().isXSelected()) selectionMatrix.getAngularPart().selectXAxis(true); if (trajectorySelectionMatrix.getAngularPart().isYSelected() || explorationSelectionMatrix.getAngularPart().isYSelected()) selectionMatrix.getAngularPart().selectYAxis(true); if (trajectorySelectionMatrix.getAngularPart().isZSelected() || explorationSelectionMatrix.getAngularPart().isZSelected()) selectionMatrix.getAngularPart().selectZAxis(true); return selectionMatrix; }
selectionMatrix3D.selectZAxis(random.nextBoolean()); selectionMatrix3D.selectYAxis(random.nextBoolean()); selectionMatrix3D.selectXAxis(random.nextBoolean()); selectionMatrix3D.setSelectionFrame(pelvisZUpFrame); chestTrajectoryMessage.getSo3Trajectory().getSelectionMatrix().set(MessageTools.createSelectionMatrix3DMessage(selectionMatrix3D));
zSelected = random.nextBoolean(); selectionMatrix3D.selectXAxis(xSelected); selectionMatrix3D.selectYAxis(ySelected); selectionMatrix3D.selectZAxis(zSelected);
selectionMatrix3D.selectZAxis(false); selectionMatrix3D.selectYAxis(false); selectionMatrix3D.selectXAxis(false); selectionMatrix3D.setSelectionFrame(pelvisZUpFrame); chestTrajectoryMessage.getSo3Trajectory().getSelectionMatrix().set(MessageTools.createSelectionMatrix3DMessage(selectionMatrix3D));
@Override public void setFromMessage(KinematicsToolboxCenterOfMassMessage message) { if (message == null) { clear(); return; } desiredPosition.setIncludingFrame(ReferenceFrame.getWorldFrame(), message.getDesiredPositionInWorld()); selectionMatrix.clearSelection(); selectionMatrix.clearSelection(); selectionMatrix.selectXAxis(message.getSelectionMatrix().getXSelected()); selectionMatrix.selectYAxis(message.getSelectionMatrix().getYSelected()); selectionMatrix.selectZAxis(message.getSelectionMatrix().getZSelected()); weightVector.reshape(3, 1); if (message.getWeights() == null) { weightVector.zero(); } else { weightVector.set(0, 0, message.getWeights().getXWeight()); weightVector.set(1, 0, message.getWeights().getYWeight()); weightVector.set(2, 0, message.getWeights().getZWeight()); } }