本文整理了Java中us.ihmc.robotics.robotSide.RobotSide.generateRandomRobotSide
方法的一些代码示例,展示了RobotSide.generateRandomRobotSide
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RobotSide.generateRandomRobotSide
方法的具体详情如下:
包路径:us.ihmc.robotics.robotSide.RobotSide
类名称:RobotSide
方法名:generateRandomRobotSide
暂无
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public FootTrajectoryCommand(Random random)
{
se3Trajectory = new SE3TrajectoryControllerCommand(random);
robotSide = RobotSide.generateRandomRobotSide(random);
}
代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics
public ManualHandControlPacket(Random random)
{
this.robotSide = RobotSide.generateRandomRobotSide(random);
double[] angles = RandomTools.generateRandomDoubleArray(random, 4, 0, 1);
this.index = angles[0];
this.middle = angles[1];
this.thumb = angles[2];
this.spread = angles[3];
this.controlType = 0;
}
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public HandTrajectoryCommand(Random random)
{
se3Trajectory = new SE3TrajectoryControllerCommand(random);
wrenchTrajectory = new WrenchTrajectoryControllerCommand(random);
robotSide = RobotSide.generateRandomRobotSide(random);
}
代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics
public GraspCylinderPacket(Random random)
{
robotSide = RobotSide.generateRandomRobotSide(random);
graspPointInWorld = RandomTools.generateRandomPoint(random, -10.0, -10.0, -10.0, 10.0, 10.0, 10.0);
cylinderLongAxisInWorld = RandomTools.generateRandomVector(random);
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public HandHybridJointspaceTaskspaceTrajectoryCommand(Random random)
{
this(RobotSide.generateRandomRobotSide(random), new SE3TrajectoryControllerCommand(random), new JointspaceTrajectoryCommand(random));
}
代码示例来源:origin: us.ihmc/IHMCHumanoidRobotics
public HandstepPacket(Random random)
{
double TRAJECTORY_TIME_MIN = 0.5;
double TRAJECTORY_TIME_MAX = 10;
this.robotSide = RobotSide.generateRandomRobotSide(random);
this.location = RandomTools.generateRandomPoint(random, 0.5, 0.5, 0.5);
this.orientation = RandomTools.generateRandomQuaternion(random, Math.PI / 4.0);
this.surfaceNormal = RandomTools.generateRandomVector(random, 1.0);
this.swingTrajectoryTime = RandomTools.generateRandomDouble(random, TRAJECTORY_TIME_MIN, TRAJECTORY_TIME_MAX);
}
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning
public static FootstepNode generateRandomFootstepNode(Random random, double minMaxXY)
{
return new FootstepNode(EuclidCoreRandomTools.nextDouble(random, minMaxXY), EuclidCoreRandomTools.nextDouble(random, minMaxXY),
EuclidCoreRandomTools.nextDouble(random, Math.PI), RobotSide.generateRandomRobotSide(random));
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testWithoutPlanarRegions()
{
TestSnapper testSnapper = new TestSnapper();
for (int i = 0; i < xIndices.length; i++)
{
for (int j = 0; j < yIndices.length; j++)
{
for (int k = 0; k < yawIndices.length; k++)
{
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
FootstepNodeSnapData snapData = testSnapper.snapFootstepNode(new FootstepNode(xIndices[i], yIndices[j], yawIndices[k], robotSide));
assertTrue(!testSnapper.dirtyBit);
assertTrue(snapData.getSnapTransform().epsilonEquals(new RigidBodyTransform(), epsilon));
assertTrue(snapData.getCroppedFoothold().isEmpty());
}
}
}
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testGetNodeTransform()
{
int numTests = 1000;
for (int i = 0; i < numTests; i++)
{
int xLatticeIndex = random.nextInt(1000) - 500;
int yLatticeIndex = random.nextInt(1000) - 500;
int yawLatticeIndex = random.nextInt(100) - 50;
double x = xLatticeIndex * FootstepNode.gridSizeXY;
double y = yLatticeIndex * FootstepNode.gridSizeXY;
double yaw = AngleTools.trimAngleMinusPiToPi(yawLatticeIndex * FootstepNode.gridSizeYaw);
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
checkNodeTransform(x, y, yaw, robotSide, 0.0, 0.0, 0.0);
checkNodeTransform(x, y, yaw, robotSide, 0.4995 * FootstepNode.gridSizeXY, 0.0, 0.0);
checkNodeTransform(x, y, yaw, robotSide, -0.4995 * FootstepNode.gridSizeXY, 0.0, 0.0);
checkNodeTransform(x, y, yaw, robotSide, 0.0, 0.4995 * FootstepNode.gridSizeXY, 0.0);
checkNodeTransform(x, y, yaw, robotSide, 0.0, -0.4995 * FootstepNode.gridSizeXY, 0.0);
checkNodeTransform(x, y, yaw, robotSide, 0.0, 0.0, 0.4995 * FootstepNode.gridSizeYaw);
checkNodeTransform(x, y, yaw, robotSide, 0.0, 0.0, -0.4995 * FootstepNode.gridSizeYaw);
}
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public static FootLoadBearingMessage nextFootLoadBearingMessage(Random random)
{
FootLoadBearingMessage next = new FootLoadBearingMessage();
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
next.setExecutionDelayTime(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setLoadBearingRequest(RandomNumbers.nextEnum(random, LoadBearingRequest.class).toByte());
return next;
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testFootstepCacheing()
{
TestSnapper testSnapper = new TestSnapper();
PlanarRegionsList planarRegionsList = new PlanarRegionsList(new PlanarRegion());
testSnapper.setPlanarRegions(planarRegionsList);
for (int i = 0; i < xIndices.length; i++)
{
for (int j = 0; j < yIndices.length; j++)
{
for (int k = 0; k < yawIndices.length; k++)
{
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
testSnapper.snapFootstepNode(new FootstepNode(xIndices[i], yIndices[j], yawIndices[k], robotSide));
assertTrue(testSnapper.dirtyBit);
testSnapper.dirtyBit = false;
testSnapper.snapFootstepNode(new FootstepNode(xIndices[i], yIndices[j], yawIndices[k], robotSide));
assertTrue(!testSnapper.dirtyBit);
}
}
}
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public static HandLoadBearingMessage nextHandLoadBearingMessage(Random random)
{
HandLoadBearingMessage next = new HandLoadBearingMessage();
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
next.setUseJointspaceCommand(random.nextBoolean());
next.getJointspaceTrajectory().set(nextJointspaceTrajectoryMessage(random));
next.setExecutionDelayTime(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.getLoadBearingMessage().set(nextLoadBearingMessage(random));
return next;
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationTest(estimatedDuration = 2.0)
@Test(timeout = 30000)
public void testRandomPoses()
{
boolean assertPlannerReturnedResult = assertPlannerReturnedResult();
double xGoal = random.nextDouble();
double yGoal = random.nextDouble();
double yawGoal = 0.0;
Point2D goalPosition = new Point2D(xGoal, yGoal);
FramePose2D goalPose = new FramePose2D(ReferenceFrame.getWorldFrame(), goalPosition, yawGoal);
double xInitialStanceFoot = random.nextDouble();
double yInitialStanceFoot = random.nextDouble();
double yawInitial = 0.0;
Point2D initialStanceFootPosition = new Point2D(xInitialStanceFoot, yInitialStanceFoot);
FramePose2D initialStanceFootPose = new FramePose2D(ReferenceFrame.getWorldFrame(), initialStanceFootPosition, yawInitial);
RobotSide initialStanceFootSide = RobotSide.generateRandomRobotSide(random);
FramePose3D initialStanceFootPose3d = FlatGroundPlanningUtils.poseFormPose2d(initialStanceFootPose);
FramePose3D goalPose3d = FlatGroundPlanningUtils.poseFormPose2d(goalPose);
FootstepPlan footstepPlan =
PlannerTools.runPlanner(getPlanner(), initialStanceFootPose3d, initialStanceFootSide, goalPose3d, null, assertPlannerReturnedResult);
if (visualize())
PlanningTestTools.visualizeAndSleep(null, footstepPlan, goalPose3d);
if (assertPlannerReturnedResult) assertTrue(PlannerTools.isGoalNextToLastStep(goalPose3d, footstepPlan));
}
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public static ManualHandControlPacket nextManualHandControlPacket(Random random)
{
ManualHandControlPacket next = new ManualHandControlPacket();
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
double[] angles = RandomNumbers.nextDoubleArray(random, 4, 0, 1);
next.setIndex(angles[0]);
next.setMiddle(angles[1]);
next.setThumb(angles[2]);
next.setSpread(angles[3]);
next.setControlType(0);
return next;
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testEqualsAndHashMethodsWithRandomTransforms()
{
Random random = new Random(3823L);
int numTrials = 100;
FootstepNode nodeA, nodeB;
for (int i = 0; i < numTrials; i++)
{
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
// test for exact same transform
double x = EuclidCoreRandomTools.nextDouble(random, 1.0);
double y = EuclidCoreRandomTools.nextDouble(random, 1.0);
double yaw = EuclidCoreRandomTools.nextDouble(random, 1.0);
nodeA = new FootstepNode(x, y, yaw, robotSide);
nodeB = new FootstepNode(x, y, yaw, robotSide);
assertTrue(nodeA.equals(nodeB));
assertTrue(nodeA.hashCode() == nodeB.hashCode());
}
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
private static FootstepDataMessage nextFootstepDataMessage(Random random)
{
FootstepDataMessage next = new FootstepDataMessage();
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
next.getLocation().set(EuclidCoreRandomTools.nextPoint3D(random));
next.getOrientation().set(EuclidCoreRandomTools.nextQuaternion(random));
IntStream.range(0, random.nextInt(10)).forEach(i -> next.getPredictedContactPoints2d().add().set(EuclidCoreRandomTools.nextPoint2D(random)));
next.setTrajectoryType(RandomNumbers.nextEnum(random, TrajectoryType.class).toByte());
next.setSwingHeight(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setSwingTrajectoryBlendDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setSwingDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setTransferDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setTouchdownDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setExecutionDelayTime(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
return next;
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testGetSnappedNodeTransform()
{
int numTests = 10;
for (int i = 0; i < numTests; i++)
{
double x = EuclidCoreRandomTools.nextDouble(random, 1.0);
double y = EuclidCoreRandomTools.nextDouble(random, 1.0);
double yaw = EuclidCoreRandomTools.nextDouble(random, 4.0);
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
FootstepNode node = new FootstepNode(x, y, yaw, robotSide);
RigidBodyTransform snapTransform = EuclidCoreRandomTools.nextRigidBodyTransform(random);
RigidBodyTransform snappedNodeTransform = new RigidBodyTransform();
FootstepNodeTools.getSnappedNodeTransform(node, snapTransform, snappedNodeTransform);
RigidBodyTransform expectedSnappedNodeTransform = new RigidBodyTransform();
FootstepNodeTools.getNodeTransform(node, expectedSnappedNodeTransform);
snapTransform.transform(expectedSnappedNodeTransform);
assertTrue(expectedSnappedNodeTransform.epsilonEquals(snappedNodeTransform, epsilon));
}
}
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public static FootstepStatusMessage nextFootstepStatusMessage(Random random)
{
FootstepStatusMessage next = new FootstepStatusMessage();
next.setFootstepStatus(RandomNumbers.nextEnum(random, FootstepStatus.class).toByte());
next.setFootstepIndex(RandomNumbers.nextIntWithEdgeCases(random, 0.1));
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
next.getDesiredFootPositionInWorld().set(RandomGeometry.nextPoint3D(random, 1.0, 1.0, 1.0));
next.getDesiredFootOrientationInWorld().set(RandomGeometry.nextQuaternion(random));
next.getActualFootPositionInWorld().set(RandomGeometry.nextPoint3D(random, 1.0, 1.0, 1.0));
next.getActualFootOrientationInWorld().set(RandomGeometry.nextQuaternion(random));
return next;
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-robotics
public static FootstepDataMessage nextFootstepDataMessage(Random random)
{
FootstepDataMessage next = new FootstepDataMessage();
next.setRobotSide(RobotSide.generateRandomRobotSide(random).toByte());
next.getLocation().set(EuclidCoreRandomTools.nextPoint3D(random));
next.getOrientation().set(EuclidCoreRandomTools.nextQuaternion(random));
IntStream.range(0, random.nextInt(10)).forEach(i -> next.getPredictedContactPoints2d().add().set(EuclidCoreRandomTools.nextPoint2D(random)));
next.setTrajectoryType(RandomNumbers.nextEnum(random, TrajectoryType.class).toByte());
next.setSwingHeight(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
if (next.getTrajectoryType() == TrajectoryType.CUSTOM.toByte())
{
next.getCustomPositionWaypoints().add().set(RandomGeometry.nextPoint3D(random, -10.0, 10.0));
next.getCustomPositionWaypoints().add().set(RandomGeometry.nextPoint3D(random, -10.0, 10.0));
}
else if (next.getTrajectoryType() == TrajectoryType.WAYPOINTS.toByte())
{
MessageTools.copyData(nextSE3TrajectoryPointMessages(random), next.getSwingTrajectory());
}
next.setSwingTrajectoryBlendDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setSwingDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setTransferDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setTouchdownDuration(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
next.setExecutionDelayTime(RandomNumbers.nextDoubleWithEdgeCases(random, 0.1));
return next;
}
代码示例来源:origin: us.ihmc/ihmc-simulation-toolkit-test
RobotSide robotSide = RobotSide.generateRandomRobotSide(random);
内容来源于网络,如有侵权,请联系作者删除!