us.ihmc.euclid.referenceFrame.ReferenceFrame.getName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(69)

本文整理了Java中us.ihmc.euclid.referenceFrame.ReferenceFrame.getName方法的一些代码示例,展示了ReferenceFrame.getName的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReferenceFrame.getName方法的具体详情如下:
包路径:us.ihmc.euclid.referenceFrame.ReferenceFrame
类名称:ReferenceFrame
方法名:getName

ReferenceFrame.getName介绍

[英]Gets the name of this reference frame.

Reference frames usually have a unique name among the reference frames in the same tree but this is not guaranteed.
[中]获取此参照系的名称。
参考帧通常在同一树中的参考帧中具有唯一的名称,但这并不能保证。

代码示例

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public YoGraphicReferenceFrame(ReferenceFrame referenceFrame, YoVariableRegistry registry, boolean useYawPitchRoll, double scale,
               AppearanceDefinition arrowColor)
{
 super(referenceFrame.getName(), "", registry, useYawPitchRoll, scale, arrowColor);
 this.referenceFrame = referenceFrame;
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public YoGraphicReferenceFrame(String prefix, ReferenceFrame referenceFrame, YoVariableRegistry registry, boolean useYawPitchRoll, double scale,
               AppearanceDefinition arrowColor)
{
 super(prefix + referenceFrame.getName(), "", registry, useYawPitchRoll, scale, arrowColor);
 this.referenceFrame = referenceFrame;
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public AfterJointReferenceFrameNameMap(List<ReferenceFrame> frames)
{
 for(ReferenceFrame frame : frames)
 {
   afterJointReferenceFrames.put(frame.getName(), frame);
 }
}

代码示例来源:origin: us.ihmc/euclid-frame

private boolean hasChildWithName(String childName)
{
 updateChildren();
 return children.stream().map(WeakReference::get).filter(child -> child != null).anyMatch(child -> child.getName().equals(childName));
}

代码示例来源:origin: us.ihmc/mecano

private static ScrewTheoryException unhandledReferenceFrameTypeException(ReferenceFrame referenceFrame)
  {
   return new ScrewTheoryException("The reference frame type: " + referenceFrame.getClass().getSimpleName()
      + " is currently not handled. Reference frame name: " + referenceFrame.getName());
  }
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public static String waypointToString(Point3DReadOnly position, Vector3DReadOnly linearVelocity, ReferenceFrame referenceFrame, NumberFormat format)
{
 String referenceFrameToString = referenceFrame == null ? "" : ", " + referenceFrame.getName();
 return "Euclidean waypoint: " + "[" + positionToString(position, format) + ", " + linearVelocityToString(linearVelocity, format) + referenceFrameToString
    + "].";
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public static String waypointToString(QuaternionReadOnly orientation, Vector3DReadOnly angularVelocity, ReferenceFrame referenceFrame, NumberFormat format)
{
 String referenceFrameToString = referenceFrame == null ? "" : ", " + referenceFrame.getName();
 return "SO3 waypoint: " + "[" + orientationToString(orientation, format) + ", " + angularVelocityToString(angularVelocity, format)
    + referenceFrameToString + "].";
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public NumericalMovingReferenceFrame(String nameSuffix, ReferenceFrame originalFrame, double updateDT)
{
 super(originalFrame.getName() + nameSuffix, originalFrame.getRootFrame());
 this.originalFrame = originalFrame;
 this.updateDT = updateDT;
 previousRotation.setToNaN();
 previousTranslation.setToNaN();
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test

private void checkReferenceFramesMatch(ReferenceFrame referenceFrameA, ReferenceFrame referenceFrameB)
{
 assertEquals("reference frame names didnt match", referenceFrameA.getName(), referenceFrameB.getName());
 assertEquals("hash codes didn't match", referenceFrameA.hashCode(), referenceFrameB.hashCode());
 
 if (referenceFrameA.getParent() != null || referenceFrameB.getParent() != null)
 {
   assertEquals("parent reference frame names didnt match", referenceFrameA.getParent().getName(), referenceFrameB.getParent().getName());
   assertEquals("parent hash codes didn't match", referenceFrameA.getParent().hashCode(), referenceFrameB.getParent().hashCode());
 }
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout=300000
public void testGetYoVelocity()
{
  YoFrameVector3D yoVelocity = kinematicPoint.getYoVelocity();
  String frameName = yoVelocity.getReferenceFrame().getName();
  
 assertEquals("( 0.000,  0.000,  0.000 )-" + frameName, yoVelocity.toString());
  yoVelocity.set(new Vector3D(5.0, 5.1, 5.2));
  assertEquals("( 5.000,  5.100,  5.200 )-" + frameName, yoVelocity.toString());
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public static String waypointToString(Point3DReadOnly position, QuaternionReadOnly orientation, Vector3DReadOnly linearVelocity, Vector3DReadOnly angularVelocity, ReferenceFrame referenceFrame,
   NumberFormat format)
{
 String referenceFrameToString = referenceFrame == null ? "" : ", " + referenceFrame.getName();
 return "SE3 waypoint: " + "[" + positionToString(position, format) + ", " + orientationToString(orientation, format) + ", "
    + linearVelocityToString(linearVelocity, format) + ", " + angularVelocityToString(angularVelocity, format) + referenceFrameToString + "].";
}

代码示例来源:origin: us.ihmc/ihmc-yovariables

@Override
  public String toString()
  {
   return "(yaw = " + yaw.getDoubleValue() + ", pitch = " + pitch.getDoubleValue() + ", roll = " + roll.getDoubleValue() + ")-" + getReferenceFrame().getName();
  }
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout=300000
public void testGetYoPosition()
{
  YoFramePoint3D yoPosition = kinematicPoint.getYoPosition();
  String frameName = yoPosition.getReferenceFrame().getName();
  assertEquals("( 0.000,  0.000,  0.000 )-" + frameName, yoPosition.toString());
  yoPosition.set(new Point3D(5.0, 5.1, 5.2));
  assertEquals("( 5.000,  5.100,  5.200 )-" + frameName, yoPosition.toString());
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

/**
* Change the current reference frame for another one that has already been registered.
* @param newCurrentReferenceFrame
* @return ReferenceFrame the previous current reference frame
*/
public ReferenceFrame switchCurrentReferenceFrame(ReferenceFrame newCurrentReferenceFrame)
{
 ReferenceFrame previousReferenceFrame = getCurrentReferenceFrame();
 if(!referenceFrames.contains(newCurrentReferenceFrame.hashCode()))
 {
   throw new RuntimeException("The frame: " + newCurrentReferenceFrame.getName() + " has not been registered.");
 }
 
 currentFrameId.set(newCurrentReferenceFrame.hashCode());
 return previousReferenceFrame;
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testRotatePoseAboutCollinearAxisAndCheckTranslation()
{
 Random random = new Random(1179L);
 double angleToRotate = RandomNumbers.nextDouble(random, Math.toRadians(720.0));
 ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
 FramePose3D framePose = new FramePose3D(worldFrame);
 framePose.setPosition(1.0, 0.0, 1.0);
 framePose.setOrientation(RandomGeometry.nextQuaternion(random));
 GeometryTools.rotatePoseAboutAxis(framePose.getReferenceFrame(), Axis.Z, angleToRotate, framePose);
 Point3D actualPosePositionAfterRotation = new Point3D(framePose.getPosition());
 Point3D desiredPosition = new Point3D(Math.cos(angleToRotate), Math.sin(angleToRotate), 1.0);
 Vector3D positionError = new Vector3D();
 positionError.sub(desiredPosition, actualPosePositionAfterRotation);
 assertTrue("Reference Frame shoud not have changed.  Actual frame: " + framePose.getReferenceFrame().getName() + ", Desired frame: "
    + worldFrame.getName(), framePose.getReferenceFrame() == worldFrame);
 assertEquals("FramePose Position after rotation is wrong.  Desired position: " + desiredPosition + ", actual position: "
    + actualPosePositionAfterRotation, 0.0, positionError.length(), 1e-3);
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testRotateAndUnrotatePoseAboutCollinearAxis()
{
 ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
 double angleToRotate = Math.toRadians(90.0);
 FramePose3D framePose = new FramePose3D(worldFrame);
 framePose.setPosition(0.0, 0.0, 1.0);
 FramePose3D framePoseCopy = new FramePose3D(framePose);
 GeometryTools.rotatePoseAboutAxis(framePose.getReferenceFrame(), Axis.Z, 0.5 * angleToRotate , framePose);
 GeometryTools.rotatePoseAboutAxis(framePose.getReferenceFrame(), Axis.Z, -0.5 * angleToRotate, framePose);
 double positionDistance = framePose.getPositionDistance(framePoseCopy);
 double orientationDistance = framePose.getOrientationDistance(framePoseCopy);
 assertTrue("Reference Frame shoud not have changed.  Actual frame: " + framePose.getReferenceFrame().getName() + ", Desired frame: "
    + worldFrame.getName(), framePose.getReferenceFrame() == worldFrame);
 assertEquals("Change in FramePose Position after rotation is wrong.", 0.0, positionDistance, 1e-3);
 assertEquals("Change in FramePose Orientation after rotation is wrong.", 0.0, orientationDistance, Math.toRadians(0.1));
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testRotatePoseAboutCollinearAxisIncrementally()
{
 Random random = new Random(1179L);
 ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
 double angleToRotate = RandomNumbers.nextDouble(random, Math.toRadians(720.0));
 FramePose3D framePose = new FramePose3D(worldFrame);
 framePose.setPosition(0.0, 0.0, 1.0);
 FramePose3D framePoseCopy = new FramePose3D(framePose);
 GeometryTools.rotatePoseAboutAxis(framePose.getReferenceFrame(), Axis.Z, 0.5 * angleToRotate, framePose);
 GeometryTools.rotatePoseAboutAxis(framePose.getReferenceFrame(), Axis.Z, 0.5 * angleToRotate, framePose);
 double positionDistance = framePose.getPositionDistance(framePoseCopy);
 double orientationDistance = AngleTools.trimAngleMinusPiToPi(framePose.getOrientationDistance(framePoseCopy));
 double desiredOrientationDistance = AngleTools.trimAngleMinusPiToPi(angleToRotate);
 assertTrue("Reference Frame shoud not have changed.  Actual frame: " + framePose.getReferenceFrame().getName() + ", Desired frame: "
    + worldFrame.getName(), framePose.getReferenceFrame() == worldFrame);
 assertEquals("Change in FramePose Position after rotation is wrong.", 0.0, positionDistance, 1e-3);
 assertEquals("Change in FramePose Orientation after rotation is wrong.", desiredOrientationDistance, orientationDistance, Math.toRadians(0.1));
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public YoFramePoint3D buildUpdatedYoFramePointForVisualizationOnly()
{
 if (yoFramePointInWorld == null)
 {
   final ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
   if (!isReferenceFrameRegistered(worldFrame))
    registerReferenceFrame(worldFrame);
   yoFramePointInWorld = new YoFramePoint3D(namePrefix, worldFrame.getName(), worldFrame, registry);
   attachVariableChangedListener(new VariableChangedListener()
   {
    private final FramePoint3D localFramePoint = new FramePoint3D();
    private final YoFramePoint3D point = yoFramePointInWorld;
    @Override
    public void notifyOfVariableChange(YoVariable<?> v)
    {
      localFramePoint.setIncludingFrame(YoFramePointInMultipleFrames.this);
      point.setMatchingFrame(localFramePoint);
    }
   });
 }
 return yoFramePointInWorld;
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public YoFramePoint2D buildUpdatedYoFramePointForVisualizationOnly()
{
 if (yoFramePointInWorld == null)
 {
   final ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
   if (!isReferenceFrameRegistered(worldFrame))
    registerReferenceFrame(worldFrame);
   yoFramePointInWorld = new YoFramePoint2D(namePrefix, worldFrame.getName(), worldFrame, registry);
   attachVariableChangedListener(new VariableChangedListener()
   {
    private final FramePoint2D localFramePoint = new FramePoint2D();
    private final YoFramePoint2D point = yoFramePointInWorld;
    @Override
    public void notifyOfVariableChange(YoVariable<?> v)
    {
      localFramePoint.setIncludingFrame(YoFramePoint2dInMultipleFrames.this);
      point.setMatchingFrame(localFramePoint);
    }
   });
 }
 return yoFramePointInWorld;
}

代码示例来源:origin: us.ihmc/euclid-test

@Ignore
@Test
public void testUniqueNaming()
{
 Random random = new Random(13L);
 ReferenceFrame someFrame = EuclidFrameRandomTools.nextReferenceFrame(random);
 String frameName = someFrame.getName();
 ReferenceFrame parent = someFrame.getParent();
 try
 {
   ReferenceFrameTools.constructFrameWithUnchangingTransformToParent(frameName, parent, new RigidBodyTransform());
   fail("Should have thrown a RuntimeException");
 }
 catch (RuntimeException e)
 {
   // good
 }
 ReferenceFrameTools.removeFrame(someFrame);
 someFrame = ReferenceFrameTools.constructFrameWithUnchangingTransformToParent(frameName, parent, new RigidBodyTransform());
 someFrame.remove();
 someFrame = ReferenceFrameTools.constructFrameWithUnchangingTransformToParent(frameName, parent, new RigidBodyTransform());
 ReferenceFrameTools.clearFrameTree(someFrame);
 someFrame = ReferenceFrameTools.constructFrameWithUnchangingTransformToParent(frameName, parent, new RigidBodyTransform());
 ReferenceFrameTools.clearWorldFrameTree();
 ReferenceFrameTools.constructFrameWithUnchangingTransformToParent(frameName, parent, new RigidBodyTransform());
}

相关文章