us.ihmc.robotics.geometry.GeometryTools.constructReferenceFrameFromPointAndAxis()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(74)

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

GeometryTools.constructReferenceFrameFromPointAndAxis介绍

[英]Creates a new reference frame such that it is centered at the given point and with one of its axes aligned with the given alignAxisWithThis vector.

Note that the parent frame is set to the reference frame the given point and alignAxisWithThis are expressed in.
[中]创建一个新参照系,使其以给定点为中心,并且其中一个轴与给定的alignAxisWithThis向量对齐。
请注意,父框架设置为参考框架,给定点和轴与此对齐表示为。

代码示例

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

/**
* Creates a new reference frame such that it is centered at the given {@code point} and with its
* z-axis aligned with the given {@code zAxis} vector.
* <p>
* Note that the parent frame is set to the reference frame the given {@code point} and
* {@code zAxis} are expressed in.
* </p>
*
* @param frameName the name of the new frame.
* @param point location of the reference frame's origin. Not modified.
* @param zAxis orientation the reference frame's z-axis. Not modified.
* @return the new reference frame.
* @throws ReferenceFrameMismatchException if {@code point} and {@code zAxis} are not expressed
*            in the same reference frame.
*/
public static ReferenceFrame constructReferenceFrameFromPointAndZAxis(String frameName, FramePoint3D point, FrameVector3D zAxis)
{
 return constructReferenceFrameFromPointAndAxis(frameName, point, Axis.Z, zAxis);
}

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

private void initializeFourBarWithRandomlyRotatedJointFrames(FramePoint3D jointAPosition, FramePoint3D jointBPosition, FramePoint3D jointCPosition, FramePoint3D jointDPosition,
   FrameVector3D jointAxisA, FrameVector3D jointAxisB, FrameVector3D jointAxisC, FrameVector3D jointAxisD)
{
 ReferenceFrame jointAFrame = GeometryTools.constructReferenceFrameFromPointAndAxis("jointAFrame", jointAPosition, Axis.Z, new FrameVector3D(worldFrame, RandomGeometry.nextVector3D(random, 1.0)));
 ReferenceFrame jointBFrame = GeometryTools.constructReferenceFrameFromPointAndAxis("jointBFrame", jointBPosition, Axis.Z, new FrameVector3D(worldFrame, RandomGeometry.nextVector3D(random, 1.0)));
 ReferenceFrame jointCFrame = GeometryTools.constructReferenceFrameFromPointAndAxis("jointCFrame", jointCPosition, Axis.Z, new FrameVector3D(worldFrame, RandomGeometry.nextVector3D(random, 1.0)));
 ReferenceFrame jointDFrame = GeometryTools.constructReferenceFrameFromPointAndAxis("jointDFrame", jointDPosition, Axis.Z, new FrameVector3D(worldFrame, RandomGeometry.nextVector3D(random, 1.0)));
 Vector3D jointAxisAFrameA = new Vector3D();
 Vector3D jointAxisBFrameB = new Vector3D();
 Vector3D jointAxisCFrameC = new Vector3D();
 Vector3D jointAxisDFrameD = new Vector3D();
 jointAxisA.changeFrame(jointAFrame);
 jointAxisAFrameA.set(jointAxisA);
 jointAxisB.changeFrame(jointBFrame);
 jointAxisBFrameB.set(jointAxisB);
 jointAxisC.changeFrame(jointCFrame);
 jointAxisCFrameC.set(jointAxisC);
 jointAxisD.changeFrame(jointDFrame);
 jointAxisDFrameD.set(jointAxisD);
 RigidBodyTransform jointAtoElevator = jointAFrame.getTransformToDesiredFrame(worldFrame);
 RigidBodyTransform jointBtoA = jointBFrame.getTransformToDesiredFrame(jointAFrame);
 RigidBodyTransform jointCtoB = jointCFrame.getTransformToDesiredFrame(jointBFrame);
 RigidBodyTransform jointDtoC = jointDFrame.getTransformToDesiredFrame(jointCFrame);
 initializeFourBar(jointAtoElevator, jointBtoA, jointCtoB, jointDtoC, jointAxisAFrameA, jointAxisBFrameB, jointAxisCFrameC, jointAxisDFrameD);
}

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

@ContinuousIntegrationTest(estimatedDuration = 0.3)
@Test(timeout = 30000)
public void testConstructFrameFromPointAndAxis()
{
 Random random = new Random(1776L);
 ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame();
 FramePoint3D randomPoint = new FramePoint3D(worldFrame);
 FrameVector3D randomVector = new FrameVector3D(worldFrame);
 int numberOfTests = 100000;
 for (int i = 0; i < numberOfTests; i++)
 {
   randomPoint.setIncludingFrame(EuclidFrameRandomTools.nextFramePoint3D(random, worldFrame, 10.0, 10.0, 10.0));
   randomVector.setIncludingFrame(EuclidFrameRandomTools.nextFrameVector3D(random, worldFrame, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0));
   ReferenceFrame frameA = GeometryTools.constructReferenceFrameFromPointAndZAxis("frameA", randomPoint, randomVector);
   ReferenceFrame frameB = GeometryTools.constructReferenceFrameFromPointAndAxis("frameB", randomPoint, Axis.Z, randomVector);
   EuclidCoreTestTools.assertRigidBodyTransformEquals(frameA.getTransformToRoot(), frameB.getTransformToRoot(), 1.0e-2);
 }
}

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

masterJointAxis.changeFrame(masterJointA.getFrameBeforeJoint());
frameBeforeFourBarWithZAlongJointAxis = GeometryTools
   .constructReferenceFrameFromPointAndAxis(name + "FrameWithZAlongJointAxis", new FramePoint3D(masterJointA.getFrameBeforeJoint()), Axis.Z,
      masterJointAxis);

相关文章