public AlphaFilteredYoFrameVector2d(String namePrefix, String nameSuffix, YoVariableRegistry registry, DoubleProvider alpha, FrameTuple2DReadOnly unfilteredFrameTuple2D) { this(namePrefix, nameSuffix, registry, alpha, unfilteredFrameTuple2D.getReferenceFrame(), unfilteredFrameTuple2D); }
/** * Sets position, orientation, and reference frame. * * @param position the tuple with the new position coordinates. Not modified. * @param orientation the orientation with the new angle value for this. Not modified. * @throws ReferenceFrameMismatchException if {@code position} and {@code orientation} are not * expressed in the same reference frame. */ default void setIncludingFrame(FrameTuple2DReadOnly position, FrameOrientation2DReadOnly orientation) { position.checkReferenceFrameMatch(orientation); setIncludingFrame(position.getReferenceFrame(), position, orientation); }
@Test public void testEpsilonEquals() throws Exception { Random random = new Random(621541L); double epsilon = 0.0; ReferenceFrame frame1 = ReferenceFrame.getWorldFrame(); ReferenceFrame frame2 = EuclidFrameRandomTools.nextReferenceFrame(random); double x = random.nextDouble(); double y = random.nextDouble(); F tuple1 = createFrameTuple(frame1, x, y); F tuple2 = createFrameTuple(frame1, x, y); F tuple3 = createFrameTuple(frame2, x, y); F tuple4 = createFrameTuple(frame2, x, y); assertTrue(tuple1.epsilonEquals(tuple2, epsilon)); assertFalse(tuple1.epsilonEquals(tuple3, epsilon)); assertFalse(tuple3.epsilonEquals(tuple2, epsilon)); assertTrue(tuple3.epsilonEquals(tuple4, epsilon)); }
@Test public void testEquals() throws Exception { Random random = new Random(621541L); ReferenceFrame frame1 = ReferenceFrame.getWorldFrame(); ReferenceFrame frame2 = EuclidFrameRandomTools.nextReferenceFrame(random); double x = random.nextDouble(); double y = random.nextDouble(); F tuple1 = createFrameTuple(frame1, x, y); F tuple2 = createFrameTuple(frame1, x, y); F tuple3 = createFrameTuple(frame2, x, y); F tuple4 = createFrameTuple(frame2, x, y); assertTrue(tuple1.equals(tuple2)); assertFalse(tuple1.equals(tuple3)); assertFalse(tuple3.equals(tuple2)); assertTrue(tuple3.equals(tuple4)); assertTrue(tuple1.equals((Object) tuple2)); assertFalse(tuple1.equals((Object) tuple3)); assertFalse(tuple3.equals((Object) tuple2)); assertTrue(tuple3.equals((Object) tuple4)); }
public RateLimitedYoFramePoint2D(String namePrefix, String nameSuffix, YoVariableRegistry registry, DoubleProvider maxRate, double dt, FrameTuple2DReadOnly rawPosition) { this(namePrefix, nameSuffix, registry, maxRate, dt, rawPosition, rawPosition.getReferenceFrame()); }
public AlphaFilteredYoFramePoint2d(String namePrefix, String nameSuffix, YoVariableRegistry registry, DoubleProvider alpha, FrameTuple2DReadOnly unfilteredFrameTuple2D) { this(namePrefix, nameSuffix, registry, alpha, unfilteredFrameTuple2D.getReferenceFrame(), unfilteredFrameTuple2D); }
/** * Tests on a per component basis, if this tuple is exactly equal to {@code other}. * <p> * If the two tuples have different frames, this method returns {@code false}. * </p> * * @param other the other tuple to compare against this. Not modified. * @return {@code true} if the two tuples are exactly equal component-wise and are expressed in the * same reference frame, {@code false} otherwise. */ default boolean equals(FrameTuple2DReadOnly other) { if (other == null || getReferenceFrame() != other.getReferenceFrame()) return false; return Tuple2DReadOnly.super.equals(other); } }
/** * Tests on a per component basis if this tuple is equal to the given {@code other} to an * {@code epsilon}. * <p> * If the two tuples have different frames, this method returns {@code false}. * </p> * * @param other the other tuple to compare against this. Not modified. * @param epsilon the tolerance to use when comparing each component. * @return {@code true} if the two tuples are equal and are expressed in the same reference frame, * {@code false} otherwise. */ default boolean epsilonEquals(FrameTuple2DReadOnly other, double epsilon) { if (getReferenceFrame() != other.getReferenceFrame()) return false; return Tuple2DReadOnly.super.epsilonEquals(other, epsilon); }
public AlphaFilteredYoFramePoint2d(String namePrefix, String nameSuffix, YoVariableRegistry registry, double alpha, FrameTuple2DReadOnly unfilteredFrameTuple2D) { this(namePrefix, nameSuffix, registry, AlphaFilteredYoVariable.createAlphaYoDouble(namePrefix + nameSuffix, alpha, registry), unfilteredFrameTuple2D.getReferenceFrame(), unfilteredFrameTuple2D); }
public final F createFrameTuple(F frameTuple) { return createFrameTuple(frameTuple.getReferenceFrame(), frameTuple); }
public AlphaFilteredYoFrameVector2d(String namePrefix, String nameSuffix, YoVariableRegistry registry, double alpha, FrameTuple2DReadOnly unfilteredFrameTuple2D) { this(namePrefix, nameSuffix, registry, AlphaFilteredYoVariable.createAlphaYoDouble(namePrefix + nameSuffix, alpha, registry), unfilteredFrameTuple2D.getReferenceFrame(), unfilteredFrameTuple2D); }
public RateLimitedYoFramePoint2D(String namePrefix, String nameSuffix, YoVariableRegistry registry, double maxRate, double dt, FrameTuple2DReadOnly rawPosition) { this(namePrefix, nameSuffix, registry, createMaxRateYoDouble(namePrefix, nameSuffix, maxRate, registry), dt, rawPosition, rawPosition.getReferenceFrame()); }
public void setIncludingFrame(FrameTuple2DReadOnly frameTuple2d) { multipleFramesHelper.switchCurrentReferenceFrame(frameTuple2d.getReferenceFrame()); set(frameTuple2d); }
public void setIncludingFrame(FrameTuple2DReadOnly frameTuple2d, double z) { multipleFramesHelper.switchCurrentReferenceFrame(frameTuple2d.getReferenceFrame()); set(frameTuple2d, z); }
/** * Sets this frame tuple to {@code other}. * * @param other the other frame tuple to copy the values and reference frame from. Not modified. */ default void setIncludingFrame(FrameTuple2DReadOnly other) { setReferenceFrame(other.getReferenceFrame()); set((Tuple2DReadOnly) other); } }
/** * Sets this frame tuple x and y components to {@code tuple2DReadOnly}'s x and y components, the * z-component to the given {@code z}, and sets the current frame to * {@code frameTuple2DReadOnly.getReferenceFrame()}. * * @param frameTuple2DReadOnly the tuple to copy the values and reference frame from. Not modified. * @param z the new z-coordinate for this frame tuple. */ default void setIncludingFrame(FrameTuple2DReadOnly frameTuple2DReadOnly, double z) { setReferenceFrame(frameTuple2DReadOnly.getReferenceFrame()); set((Tuple2DReadOnly) frameTuple2DReadOnly, z); }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param messagePrefix prefix to add to the automated message. * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @param format the format to use for printing each component when an {@code AssertionError} is * thrown. * @throws AssertionError if the two frame tuples are not equal or not expressed in the reference * frame. If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple2DEquals(String messagePrefix, FrameTuple2DReadOnly expected, FrameTuple2DReadOnly actual, double epsilon, String format) { if (expected == null && actual == null) return; if (expected != null ^ actual != null) throwNotEqualAssertionError(messagePrefix, expected, actual, format); if (expected.getReferenceFrame() != actual.getReferenceFrame()) { throwNotEqualAssertionError(messagePrefix, expected, actual, format); } assertTuple2DEquals(messagePrefix, expected, actual, epsilon, format); }
/** * Sets this frame tuple to {@code other}. * <p> * If {@code other} is expressed in the frame as {@code this}, then this method is equivalent to * {@link #set(FrameTuple2DReadOnly)}. * </p> * <p> * If {@code other} is expressed in a different frame than {@code this}, then {@code this} is set to * {@code other} and then transformed to be expressed in {@code this.getReferenceFrame()}. * </p> * * @param other the other frame tuple to set this to. Not modified. */ default void setMatchingFrame(FrameTuple2DReadOnly other) { Tuple2DBasics.super.set(other); other.getReferenceFrame().transformFromThisToDesiredFrame(getReferenceFrame(), this); }