Tabnine Logo
FrameConvexPolygon2d.setIncludingFrameAndUpdate
Code IndexAdd Tabnine to your IDE (free)

How to use
setIncludingFrameAndUpdate
method
in
us.ihmc.robotics.geometry.FrameConvexPolygon2d

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

origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates an empty convex polygon attached to the reference frame of the frame vertex, adds N new vertices using a list of {@code FrameTuple2dArrayList<FramePoint2d>}, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* @param vertices {@code FrameTuple2dArrayList<FramePoint2d>} the list of points that is used to creates the vertices.
* @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon.
* Note the: pointList.size() can be greater or equal to numberOfVertices.
* @throws ReferenceFrameMismatchException
*/
public FrameConvexPolygon2d(FrameTuple2dArrayList<FramePoint2d> frameVertices)
{
 this();
 setIncludingFrameAndUpdate(frameVertices);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates an empty convex polygon attached to a reference frame, adds N new vertices using a list of Point2d, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* @param referenceFrame {@code ReferenceFrame} reference frame to which this polygon will be attached.
* @param vertices {@code List<Point2d>} the list of points that is used to creates the vertices.
* @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon.
* Note the: pointList.size() can be greater or equal to numberOfVertices.
*/
public FrameConvexPolygon2d(ReferenceFrame referenceFrame, List<Point2d> vertices)
{
 this(referenceFrame);
 setIncludingFrameAndUpdate(referenceFrame, vertices);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates an empty convex polygon attached to the reference frame of the frame vertex, adds N new vertices using a list of {@code List<FramePoint2d>}, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* @param vertices {@code List<FramePoint2d>} the list of points that is used to creates the vertices.
* @param numberOfVertices {@code int} that is used to determine the number of vertices of the polygon.
* Note the: pointList.size() can be greater or equal to numberOfVertices.
* @throws ReferenceFrameMismatchException
*/
public FrameConvexPolygon2d(List<FramePoint2d> frameVertices)
{
 this();
 setIncludingFrameAndUpdate(frameVertices);
}
origin: us.ihmc/IHMCRoboticsToolkit

public FrameConvexPolygon2d(ReferenceFrame referenceFrame, Point2d[] vertices)
{
 this(referenceFrame);
 setIncludingFrameAndUpdate(referenceFrame, vertices);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates an empty convex polygon attached to a reference frame, adds N new vertices using an array of Point2d, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* @param referenceFrame {@code ReferenceFrame} reference frame to which this polygon will be attached.
* @param vertices {@code double[N][>=2]} the array of points that is used to creates the vertices. Each row contains one point whereas the (at least) two columns contains the coordinates x and y.
* The number of vertices of this polygon will be equal to the length of the point array.
*/
public FrameConvexPolygon2d(ReferenceFrame referenceFrame, double[][] vertices)
{
 this(referenceFrame);
 setIncludingFrameAndUpdate(referenceFrame, vertices);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates a polygon with the same properties as the other polygon.
* @param otherPolygon {@code FrameConvexPolygon2d} the other convex polygon.
*/
public FrameConvexPolygon2d(FrameConvexPolygon2d otherPolygon)
{
 this();
 setIncludingFrameAndUpdate(otherPolygon);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates a new convex polygon by combining two other convex polygons. The result is the smallest convex hull that contains both polygons.
* Then it updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* <p/> TODO: Make this more efficient by finding the rotating calipers, as in the intersection method.<p/>
*
* @param firstPolygon {@code ConvexPolygon2d}
* @param secondPolygon {@code ConvexPolygon2d}
* @throws ReferenceFrameMismatchException
*/
public FrameConvexPolygon2d(FrameConvexPolygon2d firstPolygon, FrameConvexPolygon2d secondPolygon)
{
 this();
 setIncludingFrameAndUpdate(firstPolygon, secondPolygon);
}
origin: us.ihmc/CommonWalkingControlModules

public void setSupportPolygon(FrameConvexPolygon2d supportPolygon)
{
 this.supportPolygon.setIncludingFrameAndUpdate(supportPolygon);
 this.supportPolygon.changeFrameAndProjectToXYPlane(worldFrame);
 supportUpToDate = true;
}
origin: us.ihmc/CommonWalkingControlModules

public void setCMPProjectionArea(FrameConvexPolygon2d areaToProjectInto, FrameConvexPolygon2d safeArea)
{
 this.areaToProjectInto.setIncludingFrameAndUpdate(areaToProjectInto);
 this.safeArea.setIncludingFrameAndUpdate(safeArea);
 yoSafeAreaPolygon.setFrameConvexPolygon2d(safeArea);
 yoProjectionPolygon.setFrameConvexPolygon2d(areaToProjectInto);
}
origin: us.ihmc/CommonWalkingControlModules

public void setContactPoints(List<Point2d> contactPointLocations)
{
 int contactPointLocationsSize = contactPointLocations.size();
 if (contactPointLocationsSize != totalNumberOfContactPoints)
   throw new RuntimeException("contactPointLocationsSize != totalNumberOfContactPoints");
 for (int i = 0; i < contactPointLocationsSize; i++)
 {
   Point2d contactPointLocation = contactPointLocations.get(i);
   YoContactPoint yoContactPoint = contactPoints.get(i);
   yoContactPoint.setPosition2d(contactPointLocation);
 }
 contactPointsPolygon.setIncludingFrameAndUpdate(planeFrame, contactPointLocations);
 this.contactPointCentroid.set(contactPointsPolygon.getCentroid());
}
origin: us.ihmc/CommonWalkingControlModules

public void setContactFramePoints(List<FramePoint2d> contactPointLocations)
{
 int contactPointLocationsSize = contactPointLocations.size();
 if (contactPointLocationsSize != totalNumberOfContactPoints)
   throw new RuntimeException("contactPointLocationsSize != totalNumberOfContactPoints");
 for (int i = 0; i < contactPointLocationsSize; i++)
 {
   FramePoint2d contactPointLocation = contactPointLocations.get(i);
   YoContactPoint yoContactPoint = contactPoints.get(i);
   yoContactPoint.setPosition(contactPointLocation);
 }
 contactPointsPolygon.setIncludingFrameAndUpdate(contactPointLocations);
 this.contactPointCentroid.set(contactPointsPolygon.getCentroid());
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Creates an empty convex polygon attached to a reference frame, adds N new vertices using the vertices of another {code ConvexPolygon2d}, updates the vertices so they are clockwise ordered, and initializes some essential numbers such as the centroid.
* @param referenceFrame {@code ReferenceFrame} reference frame to which this polygon will be attached.
* @param otherPolygon {@code ConvexPolygon2d} the other convex polygon.
*/
public FrameConvexPolygon2d(ReferenceFrame referenceFrame, ConvexPolygon2d otherPolygon)
{
 super(referenceFrame, new ConvexPolygon2d());
 this.convexPolygon = this.getGeometryObject();
 setIncludingFrameAndUpdate(referenceFrame, otherPolygon);
}
origin: us.ihmc/CommonWalkingControlModules

private void updateCombinedPolygon()
{
 for (RobotSide robotSide : RobotSide.values)
 {
   FrameConvexPolygon2d footPolygonInWorldFrame = footPolygonsInWorldFrame.get(robotSide);
   footPolygonInWorldFrame.setIncludingFrameAndUpdate(footPolygons.get(robotSide));
   footPolygonInWorldFrame.changeFrameAndProjectToXYPlane(worldFrame);
 }
 combinedFootPolygon.setIncludingFrameAndUpdate(footPolygonsInWorldFrame.get(RobotSide.LEFT), footPolygonsInWorldFrame.get(RobotSide.RIGHT));
 // If there is a nextFootstep, increase the polygon to include it.
 if (isUsingNextFootstep.getBooleanValue())
   combinedFootPolygonWithNextFootstep.setIncludingFrameAndUpdate(combinedFootPolygon, nextFootstepPolygon);
}
origin: us.ihmc/CommonWalkingControlModules

private void computeEntryCMPForFootstep(FramePoint entryCMPToPack, Footstep footstep, FramePoint2d centroidInSoleFrameOfPreviousSupportFoot,
   YoFramePoint previousExitCMP)
{
 ReferenceFrame soleFrame = footstep.getSoleReferenceFrame();
 List<Point2d> predictedContactPoints = footstep.getPredictedContactPoints();
 RobotSide robotSide = footstep.getRobotSide();
 if (predictedContactPoints != null)
   tempSupportPolygon.setIncludingFrameAndUpdate(soleFrame, predictedContactPoints);
 else
   tempSupportPolygon.setIncludingFrameAndUpdate(soleFrame, defaultFootPolygons.get(robotSide));
 computeEntryCMP(entryCMPToPack, robotSide, soleFrame, tempSupportPolygon, centroidInSoleFrameOfPreviousSupportFoot, previousExitCMP);
}
origin: us.ihmc/CommonWalkingControlModules

public void updateCaptureRegion(double swingTimeRemaining, double omega0, RobotSide swingSide, FramePoint2d capturePoint2d)
{
 footPolygon.setIncludingFrameAndUpdate(bipedSupportPolygon.getFootPolygonInAnkleZUp(swingSide.getOppositeSide()));
 captureRegionCalculator.calculateCaptureRegion(swingSide, swingTimeRemaining, capturePoint2d, omega0, footPolygon);
}
origin: us.ihmc/CommonWalkingControlModules

private void computeEntryCMPForSupportFoot(FramePoint entryCMPToPack, RobotSide robotSide, FramePoint2d centroidInSoleFrameOfPreviousSupportFoot,
   YoFramePoint previousLateCMP)
{
 ReferenceFrame soleFrame = soleZUpFrames.get(robotSide);
 tempSupportPolygon.setIncludingFrameAndUpdate(supportFootPolygonsInSoleZUpFrame.get(robotSide));
 tempSupportPolygon.changeFrame(soleFrame);
 computeEntryCMP(entryCMPToPack, robotSide, soleFrame, tempSupportPolygon, centroidInSoleFrameOfPreviousSupportFoot, previousLateCMP);
}
origin: us.ihmc/CommonWalkingControlModules

  private void updateOnToesSupportPolygon(RobotSide trailingSide, FrameConvexPolygon2d leadingFootSupportPolygon)
  {
   computeToePoints(trailingSide);
   middleToePoint.changeFrame(worldFrame);

   onToesSupportPolygon.setIncludingFrameAndUpdate(leadingFootSupportPolygon);
   onToesSupportPolygon.changeFrameAndProjectToXYPlane(worldFrame);
   onToesSupportPolygon.addVertexByProjectionOntoXYPlane(middleToePoint);
   onToesSupportPolygon.update();
  }
}
origin: us.ihmc/CommonWalkingControlModules

public void setNextFootstep(Footstep nextFootstep)
{
 isUsingNextFootstep.set(nextFootstep != null);
 if (isUsingNextFootstep.getBooleanValue())
 {
   ReferenceFrame footstepSoleFrame = nextFootstep.getSoleReferenceFrame();
   ConvexPolygon2d footPolygon = footPolygons.get(nextFootstep.getRobotSide()).getConvexPolygon2d();
   nextFootstepPolygon.setIncludingFrameAndUpdate(footstepSoleFrame, footPolygon);
   nextFootstepPolygon.changeFrameAndProjectToXYPlane(worldFrame);
 }
}
origin: us.ihmc/CommonWalkingControlModules

/**
* This function takes a footstep and calculates the touch-down polygon in the
* desired reference frame
*/
private void calculateTouchdownFootPolygon(Footstep footstep, ReferenceFrame desiredFrame, FrameConvexPolygon2d polygonToPack)
{
 footstep.getPositionIncludingFrame(centroid3d);
 centroid3d.getFramePoint2d(centroid2d);
 centroid2d.changeFrame(desiredFrame);
 polygonToPack.setIncludingFrameAndUpdate(footstep.getSoleReferenceFrame(), defaultSupportPolygons.get(footstep.getRobotSide()));
 polygonToPack.changeFrameAndProjectToXYPlane(desiredFrame);
 // shrink the polygon for safety by pulling all the corner points towards the center
 polygonToPack.scale(centroid2d, SHRINK_TOUCHDOWN_POLYGON_FACTOR);
}
origin: us.ihmc/CommonWalkingControlModules

private void putExitCMPOnToes(FrameConvexPolygon2d footSupportPolygon, FramePoint2d exitCMPToPack)
{
 // Set x to have the CMP slightly inside the support polygon
 exitCMPToPack.setToZero(footSupportPolygon.getReferenceFrame());
 exitCMPToPack.setX(footSupportPolygon.getMaxX() - 1.6e-2);
 exitCMPToPack.setY(footSupportPolygon.getCentroid().getY());
 // Then constrain the computed CMP to be inside a safe support region
 tempSupportPolygonForShrinking.setIncludingFrameAndUpdate(footSupportPolygon);
 convexPolygonShrinker.shrinkConstantDistanceInto(tempSupportPolygonForShrinking, safeDistanceFromCMPToSupportEdgesWhenSteppingDown.getDoubleValue(),
    footSupportPolygon);
 footSupportPolygon.orthogonalProjection(exitCMPToPack);
}
us.ihmc.robotics.geometryFrameConvexPolygon2dsetIncludingFrameAndUpdate

Javadoc

If the list of vertices is empty, this polygon will be empty and its reference frame won't be changed. If the list of vertices is not empty, this method does: 1- clear(vertices.get(0).getReferenceFrame()); 2- addVertices(vertices); 3- update().

Popular methods of FrameConvexPolygon2d

  • <init>
    Creates an empty convex polygon attached to a reference frame, adds N new vertices using an array of
  • getNumberOfVertices
  • changeFrameAndProjectToXYPlane
  • getFrameVertex
  • isPointInside
    isPointInside Determines whether a point is inside the convex polygon (point in polygon test). Uses
  • getConvexPolygon2d
  • getVertex
  • intersectionWith
  • addVertex
    Add a vertex to this polygon. Note that this method recycles memory.
  • addVertexByProjectionOntoXYPlane
    Add a vertex to this polygon after doing newVertex2d.changeFrameAndProjectToXYPlane(this.referenceFr
  • addVertices
  • clear
    After calling this method, the polygon has no vertex, area, or centroid, and is attached to a new re
  • addVertices,
  • clear,
  • getCentroid,
  • getReferenceFrame,
  • isEmpty,
  • orthogonalProjection,
  • scale,
  • update,
  • addVertexAndChangeFrame

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Best plugins for Eclipse
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