gpt4 book ai didi

us.ihmc.robotics.testing.YoVariableTestGoal类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 02:03:31 25 4
gpt4 key购买 nike

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

YoVariableTestGoal介绍

暂无

代码示例

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

@Override
public boolean currentlyMeetsGoal()
{
 return goalX.currentlyMeetsGoal() && goalY.currentlyMeetsGoal() && goalZ.currentlyMeetsGoal();
}

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

@Override
  public String toString()
  {
   return "\n" + goalX.toString() + "\n" + goalY.toString() + "\n" + goalZ.toString();
  }
};

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

public static YoVariableTestGoal timeInFuture(YoDouble timeYoVariable, double durationFromNow)
{
 return doubleGreaterThan(timeYoVariable, timeYoVariable.getDoubleValue() + durationFromNow);
}

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

public void testWalkingForwardSlow() throws SimulationExceededMaximumTimeException, ControllerFailureException, IOException
{
 QuadrupedTestBehaviors.standUp(conductor, variables);
 
 variables.getYoPlanarVelocityInputX().set(0.06);
 conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addSustainGoal(YoVariableTestGoal.doubleLessThan(variables.getYoTime(), variables.getYoTime().getDoubleValue() + 35.0));
 conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), 0.35));
 conductor.simulate();
}

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

private void testWalkingInASemiCircle(double endPhaseShift, double walkingSpeed, double angularVelocity)
{
 stepTeleopManager.setShiftPlanBasedOnStepAdjustment(false);
 QuadrupedTestBehaviors.readyXGait(conductor, variables, stepTeleopManager);
 double radius = Math.abs(walkingSpeed / angularVelocity);
 double expectedSemiCircleWalkTime = Math.PI / Math.abs(angularVelocity);
 stepTeleopManager.requestXGait();
 stepTeleopManager.getXGaitSettings().setEndPhaseShift(endPhaseShift);
 stepTeleopManager.setDesiredVelocity(walkingSpeed, 0.0, angularVelocity);
 conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addTimeLimit(variables.getYoTime(), expectedSemiCircleWalkTime * 1.5);
 conductor.addWaypointGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), Math.signum(angularVelocity) * Math.PI / 2, 0.1));
 conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyX(), 0.0, 0.2));
 conductor.addTerminalGoal(YoVariableTestGoal.or(
    YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), -Math.PI, 0.2),
    YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), Math.PI, 0.2)));
 if(Math.signum(walkingSpeed) > 0.0)
 {
   conductor.addWaypointGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), radius * walkingSpeed * 0.6));
 }
 else
 {
   conductor.addWaypointGoal(YoVariableTestGoal.doubleLessThan(variables.getRobotBodyX(), radius * walkingSpeed * 0.6));
 }
 conductor.simulate();
}

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

private void testFlatGroundPacing(double walkingSpeed)
{
 stepTeleopManager.getXGaitSettings().setStanceWidth(getPacingWidth());
 QuadrupedTestBehaviors.readyXGait(conductor, variables, stepTeleopManager);
 stepTeleopManager.getXGaitSettings().setEndPhaseShift(0.0);
 double walkTime = 5.0;
 stepTeleopManager.requestXGait();
 stepTeleopManager.setDesiredVelocity(walkingSpeed, 0.0, 0.0);
 conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), walkTime));
 double finalPositionX = walkTime * walkingSpeed * 0.7;
 if(walkingSpeed > 0.0)
 {
   conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), finalPositionX));
 }
 else
 {
   conductor.addTerminalGoal(YoVariableTestGoal.doubleLessThan(variables.getRobotBodyX(), finalPositionX));
 }
 conductor.simulate();
}

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

@ContinuousIntegrationTest(estimatedDuration = 120.0)
  @Test(timeout = 800000)
  public void rotate360InPlaceRight() throws SimulationExceededMaximumTimeException, ControllerFailureException, IOException
  {
   QuadrupedTestBehaviors.standUp(conductor, variables);
   
   variables.getYoPlanarVelocityInputZ().set(-0.1);
   
   int numSpins = 1;
   for (int i = 0; i < numSpins; i++)
   {
     conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
     conductor.addSustainGoal(YoVariableTestGoal.doubleLessThan(variables.getYoTime(), variables.getYoTime().getDoubleValue() + 50.0));
//         conductor.addWaypointGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), -Math.PI / 4.0, 1e-2));
     conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), -Math.PI / 2.0, 1e-2));
     conductor.simulate();
//
     conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
     conductor.addSustainGoal(YoVariableTestGoal.doubleLessThan(variables.getYoTime(), variables.getYoTime().getDoubleValue() + 50.0));
//         conductor.addWaypointGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), Math.PI / 4.0, 1e-2));
     conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), 0.0, 1e-2));
     conductor.simulate();
   }
  }

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

stepTeleopManager.setDesiredVelocity(walkingSpeed, 0.0, 0.0);
conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), walkTime));
conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), minimumXPositionAfterWalking));
conductor.simulate();
conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), 1.0));
conductor.simulate();

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

private void testFlatGroundWalking(double endPhaseShift, double walkingSpeed)
{
 QuadrupedTestBehaviors.readyXGait(conductor, variables, stepTeleopManager);
 stepTeleopManager.getXGaitSettings().setEndPhaseShift(endPhaseShift);
 double walkTime = 6.0;
 stepTeleopManager.requestXGait();
 stepTeleopManager.setDesiredVelocity(walkingSpeed, 0.0, 0.0);
 conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), walkTime));
 double finalPositionX = walkTime * walkingSpeed * 0.7;
 if(walkingSpeed > 0.0)
 {
   conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), finalPositionX));
 }
 else
 {
   conductor.addTerminalGoal(YoVariableTestGoal.doubleLessThan(variables.getRobotBodyX(), finalPositionX));
 }
 conductor.simulate();
 stepTeleopManager.setDesiredVelocity(0.0, 0.0, 0.0);
 conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), 1.0));
 conductor.simulate();
 stepTeleopManager.requestStanding();
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getSteppingState(), QuadrupedSteppingStateEnum.STAND));
 conductor.addTerminalGoal(YoVariableTestGoal.timeInFuture(variables.getYoTime(), 0.5));
 conductor.simulate();
 QuadrupedTestBehaviors.sitDown(conductor, variables);
}

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

private void lowerHeightUntilFailure(double originalHeight) throws AssertionFailedError
{
 for (double heightDelta = 0.0; (originalHeight + heightDelta) > 0.38; heightDelta -= 0.01)
 {
   double desiredCoMHeight = originalHeight + heightDelta;
   stepTeleopManager.setDesiredBodyHeight(desiredCoMHeight);
   variables.getLimitJointTorques().set(false);
   conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
   conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getCurrentHeightInWorld(), originalHeight + heightDelta, 0.01));
   conductor.simulate();
   try
   {
    variables.getLimitJointTorques().set(true);
    conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
    conductor.addSustainGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getCurrentHeightInWorld(), originalHeight + heightDelta, 0.01));
    conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getYoTime(), variables.getYoTime().getDoubleValue() + 1.0));
    conductor.simulate();
   }
   catch (AssertionFailedError assertionFailedError)
   {
    PrintTools.info("Failed to stand at " + desiredCoMHeight);
    break;
   }
 }
}

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

public void addTimeLimit(YoDouble timeYoVariable, double timeLimit)
{
 sustainGoals.add(YoVariableTestGoal.doubleLessThan(timeYoVariable, timeYoVariable.getDoubleValue() + timeLimit));
}

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

if (!sustainGoals.get(i).currentlyMeetsGoal())
if (!waypointGoals.get(i).hasMetGoal())
if (!terminalGoals.get(i).currentlyMeetsGoal())

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

public static YoVariableTestGoal boundingBox(YoFramePoint3D yoFramePoint, Point3DReadOnly boxCenter, double boxEpsilon)
  {
   YoVariableTestGoal goalX = YoVariableTestGoal.doubleWithinEpsilon(yoFramePoint.getYoX(), boxCenter.getX(), boxEpsilon);
   YoVariableTestGoal goalY = YoVariableTestGoal.doubleWithinEpsilon(yoFramePoint.getYoY(), boxCenter.getY(), boxEpsilon);
   YoVariableTestGoal goalZ = YoVariableTestGoal.doubleWithinEpsilon(yoFramePoint.getYoZ(), boxCenter.getZ(), boxEpsilon);
   
   return new YoVariableTestGoal(yoFramePoint.getYoX(), yoFramePoint.getYoY(), yoFramePoint.getYoZ())
   {
     @Override
     public boolean currentlyMeetsGoal()
     {
      return goalX.currentlyMeetsGoal() && goalY.currentlyMeetsGoal() && goalZ.currentlyMeetsGoal();
     }

     @Override
     public String toString()
     {
      return "\n" + goalX.toString() + "\n" + goalY.toString() + "\n" + goalZ.toString();
     }
   };
  }
}

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

public static YoVariableTestGoal notFallen(QuadrupedForceTestYoVariables variables)
{
 return YoVariableTestGoal.deltaGreaterThan(variables.getRobotBodyZ(), variables.getGroundPlanePointZ(), 0.0);
}

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

public static void standUp(GoalOrientedTestConductor conductor, QuadrupedPositionTestYoVariables variables) throws AssertionFailedError
{
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getPositionControllerState(), QuadrupedPositionControllerState.DO_NOTHING));
 conductor.addTerminalGoal(QuadrupedTestGoals.timeInFuture(variables, 1.0));
 conductor.simulate();
 variables.getUserTrigger().set(QuadrupedPositionControllerRequestedEvent.REQUEST_STAND_PREP);
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getPositionControllerState(), QuadrupedPositionControllerState.STAND_READY));
 conductor.addTerminalGoal(QuadrupedTestGoals.timeInFuture(variables, 2.0));
 conductor.simulate();
 variables.getUserTrigger().set(QuadrupedPositionControllerRequestedEvent.REQUEST_CRAWL);
 conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyZ(), variables.getYoComPositionInputZ().getDoubleValue(), 0.1));
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getPositionControllerState(), QuadrupedPositionControllerState.CRAWL));
 conductor.addTerminalGoal(QuadrupedTestGoals.timeInFuture(variables, 2.0));
 conductor.simulate();
}

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

public static YoVariableTestGoal booleanEquals(final BooleanYoVariable booleanYoVariable, final boolean booleanValue)
{
 return new YoVariableTestGoal(booleanYoVariable)
 {
   @Override
   public boolean currentlyMeetsGoal()
   {
    return booleanYoVariable.getBooleanValue() == booleanValue;
   }
   @Override
   public String toString()
   {
    return getFormattedBooleanYoVariable(booleanYoVariable) + " == " + booleanValue;
   }
 };
}

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

public void addDurationGoal(YoDouble timeYoVariable, double durationFromNow)
{
 terminalGoals.add(YoVariableTestGoal.timeInFuture(timeYoVariable, durationFromNow));
}

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

public static void startBalancing(GoalOrientedTestConductor conductor, QuadrupedForceTestYoVariables variables, QuadrupedTeleopManager teleopManager) throws AssertionFailedError
{
 teleopManager.requestSteppingState();
 conductor.addTerminalGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addTerminalGoal(QuadrupedTestGoals.bodyHeight(variables, 0.1));
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getControllerState(), HighLevelControllerName.WALKING));
 conductor.addTerminalGoal(YoVariableTestGoal.enumEquals(variables.getSteppingState(), QuadrupedSteppingStateEnum.STAND));
 conductor.addTimeLimit(variables.getYoTime(), stateCompletionSafetyFactory * variables.getToWalkingTransitionDuration());
 conductor.simulate();
}

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

public void testWalkingForwardFast() throws SimulationExceededMaximumTimeException, ControllerFailureException, IOException
{
 QuadrupedTestBehaviors.standUp(conductor, variables);
 
 variables.getYoPlanarVelocityInputX().set(0.15);
 conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
 conductor.addSustainGoal(YoVariableTestGoal.doubleLessThan(variables.getYoTime(), variables.getYoTime().getDoubleValue() + 25.0));
 conductor.addTerminalGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), 1.5));
 conductor.simulate();
}

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

conductor.addSustainGoal(QuadrupedTestGoals.notFallen(variables));
conductor.addTimeLimit(variables.getYoTime(), expectedSemiCircleWalkTime * 1.5);
conductor.addWaypointGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), Math.signum(angularVelocity) * Math.PI / 2, 0.1));
conductor.addTerminalGoal(YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyX(), 0.0, 0.2));
conductor.addTerminalGoal(YoVariableTestGoal.or(
   YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), -Math.PI, 0.2),
   YoVariableTestGoal.doubleWithinEpsilon(variables.getRobotBodyYaw(), Math.PI, 0.2)));
  conductor.addWaypointGoal(YoVariableTestGoal.doubleGreaterThan(variables.getRobotBodyX(), radius * walkingSpeed * 0.6));
  conductor.addWaypointGoal(YoVariableTestGoal.doubleLessThan(variables.getRobotBodyX(), radius * walkingSpeed * 0.6));

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com