Tabnine Logo
FramePoint2d
Code IndexAdd Tabnine to your IDE (free)

How to use
FramePoint2d
in
us.ihmc.robotics.geometry

Best Java code snippets using us.ihmc.robotics.geometry.FramePoint2d (Showing top 20 results out of 315)

origin: us.ihmc/CommonWalkingControlModules

  private void updatedFinalHeadingLine(double desiredHeadingFinal)
  {
   FramePoint2d endpoint1 = processedSensors.getCenterOfMassGroundProjectionInFrame(ReferenceFrame.getWorldFrame()).toFramePoint2d();
   FramePoint2d endpoint2 = new FramePoint2d(endpoint1);
   double length = 1.0;
   endpoint2.setX(endpoint2.getX() + length * Math.cos(desiredHeadingFinal));
   endpoint2.setY(endpoint2.getY() + length * Math.sin(desiredHeadingFinal));

   FrameLineSegment2d frameLineSegment2d = new FrameLineSegment2d(endpoint1, endpoint2);
   finalHeadingLine.setFrameLineSegment2d(frameLineSegment2d);
  }
}
origin: us.ihmc/CommonWalkingControlModules

private void setReferenceFootstepLocation(int footstepIndex, FramePoint2d referenceFootstepLocation)
{
 referenceFootstepLocation.changeFrame(worldFrame);
 referenceFootstepLocations.get(footstepIndex).set(0, 0, referenceFootstepLocation.getX());
 referenceFootstepLocations.get(footstepIndex).set(1, 0, referenceFootstepLocation.getY());
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Changes frame of this FramePoint2d to the given ReferenceFrame, projects into xy plane, and returns a copy.
*
* @param desiredFrame ReferenceFrame to change the FramePoint2d into.
* @return Copied FramePoint2d in the new reference frame.
*/
public FramePoint2d changeFrameAndProjectToXYPlaneCopy(ReferenceFrame desiredFrame)
{
 FramePoint2d ret = new FramePoint2d(this);
 ret.changeFrameAndProjectToXYPlane(desiredFrame);
 return ret;
}
origin: us.ihmc/CommonWalkingControlModules

private FramePoint2d closestPoint(FramePoint2d point, FramePoint2d candidate1, FramePoint2d candidate2)
{
 if (candidate1.containsNaN() && candidate2.containsNaN())
   return null;
 if (candidate1.containsNaN())
   return candidate2;
 if (candidate2.containsNaN())
   return candidate1;
 if (point.distance(candidate1) <= point.distance(candidate2))
   return candidate1;
 return candidate2;
}
origin: us.ihmc/CommonWalkingControlModules

/**
* This function computes the position of the capture point after the time dt has passed given
* the current capture point and the Cop which is assumed to be at constant position over dt.
*/
public static void predictCapturePoint(FramePoint2d ICP, FramePoint2d CoP, double dt, double omega0, FramePoint2d predictedICPtoPack)
{
 // make sure everything is in the same frame:
 ICP.checkReferenceFrameMatch(CoP);
 ICP.checkReferenceFrameMatch(predictedICPtoPack);
 // CP = (ICP - CoP) * exp(omega0*dt) + CoP
 predictedICPtoPack.set(ICP);
 predictedICPtoPack.sub(CoP);
 predictedICPtoPack.scale(Math.exp(omega0 * dt));
 predictedICPtoPack.add(CoP);
}
origin: us.ihmc/CommonWalkingControlModules

public ContactPoint(FramePoint2d point2d, PlaneContactState parentContactState)
{
 position = new FramePoint(point2d.getReferenceFrame(), point2d.getX(), point2d.getY(), 0.0);
 this.parentContactState = parentContactState;
}
origin: us.ihmc/DarpaRoboticsChallenge

public FrameVector2d computeDesiredMomentumXY(FramePoint2d desiredCoMXY, MutableDouble errorMagnitude)
{
 FrameVector2d ret = new FrameVector2d();
 FramePoint2d errorCoMXY = new FramePoint2d(desiredCoMXY);
 errorCoMXY.changeFrame(referenceFrames.getCenterOfMassFrame());
 errorMagnitude.setValue(MathTools.square(errorCoMXY.getX()) + MathTools.square(errorCoMXY.getY()));
 errorMagnitude.setValue(Math.sqrt(errorMagnitude.doubleValue()));
 errorCoMXY.scale(1.0 / updateDT);
 ret.setIncludingFrame(errorCoMXY);
 ret.scale(toolbox.getTotalRobotMass());
 return ret;
}
origin: us.ihmc/CommonWalkingControlModules

shrunkPolygonCentroid.changeFrame(soleFrame);
desiredCenterOfPressure.setIncludingFrame(soleFrame,
   shrunkPolygonCentroid.getX() + 0.10 * percentRampOut * Math.cos(spiralAngle.getDoubleValue()),
   shrunkPolygonCentroid.getY() + 0.05 * percentRampOut * Math.sin(spiralAngle.getDoubleValue()));
desiredCenterOfPressure.scale(0.9);
currentCorner.changeFrame(soleFrame);
centroid.changeFrame(soleFrame);
desiredCenterOfPressure.changeFrame(soleFrame);
  desiredCenterOfPressure.interpolate(centroid, currentCorner, percent);
  desiredCenterOfPressure.set(currentCorner);
  desiredCenterOfPressure.setIncludingFrame(soleFrame, distanceToMoveFrontBack, 0.0);
  partialFootholdControlModule.projectOntoShrunkenPolygon(desiredCenterOfPressure);
  desiredCenterOfPressure.setIncludingFrame(soleFrame, 0.0, distanceToMoveSideSide);
  partialFootholdControlModule.projectOntoShrunkenPolygon(desiredCenterOfPressure);
  desiredCenterOfPressure.setIncludingFrame(soleFrame, -distanceToMoveFrontBack, 0.0);
  partialFootholdControlModule.projectOntoShrunkenPolygon(desiredCenterOfPressure);
  desiredCenterOfPressure.setIncludingFrame(soleFrame, 0.0, -distanceToMoveSideSide);
  partialFootholdControlModule.projectOntoShrunkenPolygon(desiredCenterOfPressure);
  desiredCenterOfPressure.setIncludingFrame(soleFrame, 0.0, 0.0);
origin: us.ihmc/CommonWalkingControlModules

private void computeCop()
{
 double force = 0.0;
 centerOfPressure.setToZero(worldFrame);
 for (RobotSide robotSide : RobotSide.values)
 {
   footSwitches.get(robotSide).computeAndPackCoP(tempFootCop2d);
   if (tempFootCop2d.containsNaN())
    continue;
   footSwitches.get(robotSide).computeAndPackFootWrench(tempFootWrench);
   double footForce = tempFootWrench.getLinearPartZ();
   force += footForce;
   tempFootCop.setIncludingFrame(tempFootCop2d.getReferenceFrame(), tempFootCop2d.getX(), tempFootCop2d.getY(), 0.0);
   tempFootCop.changeFrame(worldFrame);
   tempFootCop.scale(footForce);
   centerOfPressure.add(tempFootCop.getX(), tempFootCop.getY());
 }
 centerOfPressure.scale(1.0 / force);
 yoCenterOfPressure.set(centerOfPressure);
}
origin: us.ihmc/CommonWalkingControlModules

private void computeEntryCMP(FramePoint entryCMPToPack, RobotSide robotSide, ReferenceFrame soleFrame, FrameConvexPolygon2d footSupportPolygon, FramePoint2d centroidInSoleFrameOfPreviousSupportFoot,
   YoFramePoint previousExitCMP)
{
 if (useTwoCMPsPerSupport)
 {
   if (centroidInSoleFrameOfPreviousSupportFoot != null)
    centroidOfFootstepToConsider.setIncludingFrame(centroidInSoleFrameOfPreviousSupportFoot);
   else
    centroidOfFootstepToConsider.setToZero(soleFrame);
   centroidOfFootstepToConsider.changeFrameAndProjectToXYPlane(soleFrame);
   if (previousExitCMP != null)
   {
    previousExitCMP.getFrameTuple2dIncludingFrame(previousExitCMP2d);
    previousExitCMP2d.changeFrameAndProjectToXYPlane(soleFrame);
    // Choose the laziest option
    if (Math.abs(previousExitCMP2d.getX()) < Math.abs(centroidOfFootstepToConsider.getX()))
      centroidOfFootstepToConsider.set(previousExitCMP2d);
   }
   constrainCMPAccordingToSupportPolygonAndUserOffsets(cmp2d, footSupportPolygon, centroidOfFootstepToConsider, entryCMPUserOffsets.get(robotSide),
      minForwardEntryCMPOffset.getDoubleValue(), maxForwardEntryCMPOffset.getDoubleValue());
 }
 else
 {
   cmp2d.setIncludingFrame(footSupportPolygon.getCentroid());
   YoFrameVector2d offset = entryCMPUserOffsets.get(robotSide);
   cmp2d.add(offset.getX(), offset.getY());
 }
 entryCMPToPack.setXYIncludingFrame(cmp2d);
 entryCMPToPack.changeFrame(worldFrame);
}
origin: us.ihmc/IHMCRoboticsToolkit

public static void projectOntoPolygonAndCheckDistance(FramePoint2d point, FrameConvexPolygon2d polygon, double epsilon)
{
 ReferenceFrame originalReferenceFrame = point.getReferenceFrame();
 point.changeFrame(polygon.getReferenceFrame());
 FramePoint2d originalPoint = new FramePoint2d(point);
 polygon.orthogonalProjection(point);
 double distance = originalPoint.distance(point);
 if (distance > epsilon)
   throw new RuntimeException("point outside polygon by " + distance);
 point.changeFrame(originalReferenceFrame);
}
origin: us.ihmc/IHMCRoboticsToolkit

public static void transformFramePoint2dIntoColumnVector(DenseMatrix64F matrix, FramePoint2d framePoint)
{
 matrix.set(0, 0, framePoint.getX());
 matrix.set(1, 0, framePoint.getY());
}
origin: us.ihmc/CommonWalkingControlModules

public static void computeCapturePoint(FramePoint2d capturePointToPack, FramePoint2d centerOfMassInWorld, FrameVector2d centerOfMassVelocityInWorld,
   double omega0)
{
 centerOfMassInWorld.checkReferenceFrameMatch(worldFrame);
 centerOfMassVelocityInWorld.checkReferenceFrameMatch(worldFrame);
 capturePointToPack.setToZero(worldFrame);
 capturePointToPack.set(centerOfMassVelocityInWorld);
 capturePointToPack.scale(1.0 / omega0);
 capturePointToPack.add(centerOfMassInWorld);
}
origin: us.ihmc/CommonWalkingControlModules

/**
* This function is called at beginning of every DoubleSupport, not frequent enough to preallocate eveything. 
*/
public void updatePointAndPolygon(FrameConvexPolygon2d polygon, Point2d pointInPolygonFrame)
{
 //copy external point back to polygon frame
 framePoint2d = new FramePoint2d(polygon.getReferenceFrame(), pointInPolygonFrame);
 //update polygon class
 point2dInConvexPolygon2d = new Point2dInConvexPolygon2d(polygon.getConvexPolygon2d(), framePoint2d.getX(), framePoint2d.getY());
 angle.set(point2dInConvexPolygon2d.getAngle());
 eccentricity.set(point2dInConvexPolygon2d.getEccentricity());
}
origin: us.ihmc/IHMCHumanoidRobotics

@Override
public StraightLineOverheadPath changeFrameCopy(ReferenceFrame desiredFrame)
{
 FramePoint2d newStartPoint = new FramePoint2d(startPoint);
 newStartPoint.changeFrame(desiredFrame);
 FrameOrientation2d newStartOrientation = new FrameOrientation2d(orientation);
 newStartOrientation.changeFrame(desiredFrame);
 FramePose2d newStartPose = new FramePose2d(newStartPoint, newStartOrientation);
 FramePoint2d newEndPoint = new FramePoint2d(endPoint);
 newEndPoint.changeFrame(desiredFrame);
 return new StraightLineOverheadPath(newStartPose, newEndPoint);
}
origin: us.ihmc/CommonWalkingControlModules

this.desiredCMP.setIncludingFrame(desiredCMP);
this.desiredCMP.changeFrameAndProjectToXYPlane(projectionArea.getReferenceFrame());
this.capturePoint.setIncludingFrame(capturePoint);
this.capturePoint.changeFrameAndProjectToXYPlane(projectionArea.getReferenceFrame());
if (finalCapturePoint != null)
  this.finalCapturePoint.setIncludingFrame(finalCapturePoint);
else
  this.finalCapturePoint.setToNaN();
this.finalCapturePoint.changeFrameAndProjectToXYPlane(projectionArea.getReferenceFrame());
ReferenceFrame returnFrame = desiredCMP.getReferenceFrame();
desiredCMP.setIncludingFrame(projectedCMP);
desiredCMP.changeFrame(returnFrame);
this.desiredCMP.changeFrameAndProjectToXYPlane(worldFrame);
projectedCMP.changeFrameAndProjectToXYPlane(worldFrame);
if (cmpWasProjected.getBooleanValue())
origin: us.ihmc/IHMCAvatarInterfaces

private void findProjectionOntoPlaneFrame(ReferenceFrame planeFrame, FramePoint2d pointInWorld, FramePoint pointProjectedOntoPlaneFrameToPack)
{
 pointInWorld.checkReferenceFrameMatch(worldFrame);
 double z = getPlaneZGivenXY(planeFrame, pointInWorld.getX(), pointInWorld.getY());
 pointProjectedOntoPlaneFrameToPack.setXYIncludingFrame(pointInWorld);
 pointProjectedOntoPlaneFrameToPack.setZ(z);
}
origin: us.ihmc/CommonWalkingControlModules

public void getAdjustedDesiredCapturePoint(FramePoint2d desiredCapturePoint, FramePoint2d adjustedDesiredCapturePoint)
{
 filteredYoAngularMomentum.getFrameTuple(angularMomentum);
 ReferenceFrame comFrame = angularMomentum.getReferenceFrame();
 localDesiredCapturePoint.setIncludingFrame(desiredCapturePoint);
 localDesiredCapturePoint.changeFrameAndProjectToXYPlane(comFrame);
 double scaleFactor = momentumGain.getDoubleValue() * omega0.getDoubleValue() / (totalMass.getDoubleValue() * gravity);
 adjustedDesiredCapturePoint.setIncludingFrame(comFrame, -angularMomentum.getY(), angularMomentum.getX());
 adjustedDesiredCapturePoint.scale(scaleFactor);
 adjustedDesiredCapturePoint.add(localDesiredCapturePoint);
 adjustedDesiredCapturePoint.changeFrameAndProjectToXYPlane(desiredCapturePoint.getReferenceFrame());
}
origin: us.ihmc/CommonWalkingControlModules

public void updatePointAndPolygon(FrameConvexPolygon2d polygon, FramePoint2d pointInAnyFrame)
{
 FramePoint2d temp = new FramePoint2d(pointInAnyFrame);
 temp.changeFrame(polygon.getReferenceFrame());
 updatePointAndPolygon(polygon, temp.getPoint());
}
origin: us.ihmc/CommonWalkingControlModules

  /**
  * Compute the capture point position at a given time.
  * x<sup>ICP<sub>des</sub></sup> = (e<sup>&omega;0 t</sup>) x<sup>ICP<sub>0</sub></sup> + (1-e<sup>&omega;0 t</sup>)x<sup>CMP<sub>0</sub></sup>
  *
  * @param omega0 the natural frequency &omega; = &radic;<span style="text-decoration:overline;">&nbsp; g / z0&nbsp;</span> of the biped.
  * @param time
  * @param initialCapturePoint
  * @param initialCMP
  * @param desiredCapturePointToPack
  */
  public static void computeCapturePointPosition(double omega0, double time, FramePoint2d initialCapturePoint, FramePoint2d initialCMP,
                         FramePoint2d desiredCapturePointToPack)
  {
   desiredCapturePointToPack.setToZero(initialCapturePoint.getReferenceFrame());

   if (initialCapturePoint.distance(initialCMP) > EPSILON)
     desiredCapturePointToPack.interpolate(initialCMP, initialCapturePoint, Math.exp(omega0 * time));
   else
     desiredCapturePointToPack.set(initialCapturePoint);
  }
}
us.ihmc.robotics.geometryFramePoint2d

Javadoc

Title: FramePoint2d

Description: A FramePoint2d is a normal point associated with a specified reference frame

Copyright: Copyright (c) 2006

Company: IHMC

Most used methods

  • <init>
    FramePoint2d A normal point2d associated with a specific reference frame.
  • getX
  • getY
  • changeFrame
  • changeFrameAndProjectToXYPlane
    Changes frame of this FramePoint2d to the given ReferenceFrame, projects into xy plane.
  • checkReferenceFrameMatch
  • distance
  • getReferenceFrame
  • scale
  • set
  • setIncludingFrame
  • add
  • setIncludingFrame,
  • add,
  • containsNaN,
  • get,
  • getPoint,
  • getPointCopy,
  • interpolate,
  • setToNaN,
  • setToZero,
  • distanceSquared

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now