us.ihmc.simulationconstructionset.Robot.update()方法的使用及代码示例

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

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

Robot.update介绍

暂无

代码示例

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

@Override
  public void updateContactPoints()
  {
   robot.update();
   robot.updateVelocities();
  }
}

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

private static void updateRobot(Robot robot)
{
 try
 {
   robot.update();
   robot.doDynamicsButDoNotIntegrate();
   robot.update();
 }
 catch (UnreasonableAccelerationException e)
 {
   throw new RuntimeException("UnreasonableAccelerationException");
 }
}

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

public SDFRobotWriter(Class<? extends Robot> robotClass) throws JAXBException, InstantiationException, IllegalAccessException
{
 System.out.println("Creating SDFRobot for: " + robotClass.getSimpleName());
 scsRobot = robotClass.newInstance();
 scsRobot.update();
 String resourceDirectory = robotClass.getResource(".").getFile();
 sdfModelName = scsRobot.getName();
 sdfFilePath = resourceDirectory + sdfModelName + ".sdf";
 System.out.println("SDF file location: " + sdfFilePath);
 writeSDFRobotDescriptionFile();
}

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

@Override
public void updateContactPoints()
{
 robot.update();
 robot.updateVelocities();
}

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

public SDFRobotWriter(Class<? extends Robot> robotClass) throws JAXBException, InstantiationException, IllegalAccessException
{
 System.out.println("Creating SDFRobot for: " + robotClass.getSimpleName());
 scsRobot = robotClass.newInstance();
 scsRobot.update();
 String resourceDirectory = robotClass.getResource(".").getFile();
 sdfModelName = scsRobot.getName();
 sdfFilePath = resourceDirectory + sdfModelName + ".sdf";
 System.out.println("SDF file location: " + sdfFilePath);
 writeSDFRobotDescriptionFile();
}

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

@Test// timeout=300000
public void testCalculateAngularMomentum()
{
  double epsilon = 1e-7;
  Robot robot1 = new Robot("r1");
  FloatingJoint floatingJoint1 = new FloatingJoint("joint1", new Vector3D(),robot1);
  robot1.addRootJoint(floatingJoint1);
  Link onlyLink=new Link("SphericalLink");
  onlyLink.setComOffset(new Vector3D(0.0, 0.0, 0.0));
  onlyLink.setMass(1.0);
  onlyLink.setMomentOfInertia(1.0, 1.0, 1.0);
  floatingJoint1.setLink(onlyLink);
  floatingJoint1.setPosition(new Point3D(1.0,1.0,1.0));
  floatingJoint1.setAngularVelocityInBody(new Vector3D(1.0,0.0,0.0));
  floatingJoint1.setVelocity(-1.0, 0.0, 0.0);
  Vector3D angularMomentumReturned = new Vector3D();
  robot1.computeAngularMomentum(angularMomentumReturned);
  EuclidCoreTestTools.assertTuple3DEquals(new Vector3D(0.0, 0.0, 0.0), angularMomentumReturned, epsilon);
  robot1.update();
  robot1.computeAngularMomentum(angularMomentumReturned);
  EuclidCoreTestTools.assertTuple3DEquals(new Vector3D(0.0, 0.0, 0.0), angularMomentumReturned, epsilon);
  robot1.updateVelocities();
  robot1.computeAngularMomentum(angularMomentumReturned);
  //System.out.printf("Momentum <%+3.4f,%+3.4f,%+3.4f>", angularMomentumReturned.x,angularMomentumReturned.y,angularMomentumReturned.z);
  EuclidCoreTestTools.assertTuple3DEquals(new Vector3D(1.0, -1.0, 1.0), angularMomentumReturned, epsilon);
  floatingJoint1.setPosition(new Vector3D());
  }

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

private void setPosition(FloatingJoint cubeJoint, double x, double y, double z)
  {
   cubeJoint.setPosition(x, y, z);
   cubeJoint.getRobot().update();
  }
}

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

robot.update();
  robot.update();

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

public synchronized void updateRobot()
{
 if (viewportPanel != null)
 {
   for (Robot robot : simulation.getRobots())
   {
    robot.update();
   }
   for (GraphicsRobot graphicsRobot : graphicsRobotsToUpdate)
   {
    graphicsRobot.update();
   }
 }
}

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

robot.update();
robot.updateVelocities();
robot.doDynamicsButDoNotIntegrate();

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

public void packRobotComCopSeries(ArrayList<Point3D> outCom, ArrayList<Point3D> outCop)
{
 outCom.clear();
 outCop.clear();
 for (int i = 0; i < selectedFrames.length; i++)
 {
   dataBuffer.setIndexButDoNotNotifySimulationRewoundListeners(selectedFrames[i]);
   // model predicted CoM
   robot.update(); //this pull data from dataBuffer magically through YoVariables
   Point3D modelCoM = new Point3D();
   robot.computeCenterOfMass(modelCoM);
   outCom.add(modelCoM);
   // sensedCoP
   Point3D sensedCoP = new Point3D(dataBuffer.getVariable("sensedCoPX").getValueAsDouble(), dataBuffer.getVariable("sensedCoPY").getValueAsDouble(),
      dataBuffer.getVariable("sensedCoPZ").getValueAsDouble());
   outCop.add(sensedCoP);
 }
}

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

public void testBoxCloseButNoCollisions()
{
 ScsCollisionDetector collisionDetector = createCollisionDetector();
 FloatingJoint cubeA = cube(collisionDetector, "A", 10, 0.5, 1.0, 1.5);
 FloatingJoint cubeB = cube(collisionDetector, "B", 10, 0.75, 1.2, 1.7);
 double a[] = new double[] { 0.5 + 0.75, 1.0 + 1.2, 1.5 + 1.7 };
 // add a bit of separation to ensure they don't collide
 double tau = 0.001;
 // should just barely not intersect
 for (int i = 0; i < 3; i++)
 {
   double Tx, Ty, Tz;
   Tx = Ty = Tz = 0.0;
   if (i == 0)
    Tx = a[i] / 2.0 + tau;
   if (i == 1)
    Ty = a[i] / 2.0 + tau;
   if (i == 2)
    Tz = a[i] / 2.0 + tau;
   cubeA.setPosition(Tx, Ty, Tz);
   cubeB.setPosition(-Tx, -Ty, -Tz);
   cubeA.getRobot().update();
   cubeB.getRobot().update();
   RigidBodyTransform transformToWorld = new RigidBodyTransform();
   cubeA.getTransformToWorld(transformToWorld);
   CollisionDetectionResult result = new CollisionDetectionResult();
   collisionDetector.performCollisionDetection(result);
   assertEquals(0, result.getNumberOfCollisions());
 }
}

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

cubeB.setPosition(-Tx, -Ty, -Tz);
cubeA.getRobot().update();
cubeB.getRobot().update();

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

@Test// timeout = 30000
public void testOneRigidJointWithTranslation()
{
 Robot robot = new Robot("Test");
 RigidJoint rigidJointOne = new RigidJoint("rigidJointOne", new Vector3D(), robot);
 Vector3D translation = new Vector3D(1.1, 2.2, 3.3);
 rigidJointOne.setRigidTranslation(translation);
 RigidBodyTransform transform = new RigidBodyTransform();
 transform.setTranslation(translation);
 Link rigidLinkOne = new Link("rigidLinkOne");
 double massOne = 1.0;
 rigidLinkOne.setMassAndRadiiOfGyration(massOne, 0.1, 0.1, 0.1);
 Vector3D centerOfMassOffset = new Vector3D(0.99, -0.4, 1.1);
 rigidLinkOne.setComOffset(centerOfMassOffset);
 rigidJointOne.setLink(rigidLinkOne);
 robot.addRootJoint(rigidJointOne);
 robot.update();
 Point3D centerOfMass = new Point3D();
 double totalMass = robot.computeCenterOfMass(centerOfMass);
 assertEquals(massOne, totalMass, 1e-7);
 Point3D expectedCenterOfMass = new Point3D(centerOfMassOffset);
 expectedCenterOfMass.add(translation);
 EuclidCoreTestTools.assertTuple3DEquals(expectedCenterOfMass, centerOfMass, 1e-10);
}

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

@Test// timeout = 30000
public void testOneRigidJointWithRotation()
{
 Robot robot = new Robot("Test");
 RigidJoint rigidJointOne = new RigidJoint("rigidJointOne", new Vector3D(), robot);
 RotationMatrix rotation = new RotationMatrix();
 Vector3D eulerAngles = new Vector3D(0.3, 0.1, 0.2);
 rotation.setEuler(eulerAngles);
 rigidJointOne.setRigidRotation(rotation);
 Link rigidLinkOne = new Link("rigidLinkOne");
 double massOne = 1.0;
 rigidLinkOne.setMassAndRadiiOfGyration(massOne, 0.1, 0.1, 0.1);
 Vector3D centerOfMassOffset = new Vector3D(0.3, 0.7, 1.11);
 rigidLinkOne.setComOffset(centerOfMassOffset);
 rigidJointOne.setLink(rigidLinkOne);
 robot.addRootJoint(rigidJointOne);
 robot.update();
 Point3D centerOfMass = new Point3D();
 double totalMass = robot.computeCenterOfMass(centerOfMass);
 assertEquals(massOne, totalMass, 1e-7);
 Point3D expectedCenterOfMass = new Point3D(centerOfMassOffset);
 rotation.transform(expectedCenterOfMass);
 EuclidCoreTestTools.assertTuple3DEquals(expectedCenterOfMass, centerOfMass, 1e-10);
}

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

@Test// timeout = 30000
public void testOneRigidJointWithRotationAndTranslation()
{
 Robot robot = new Robot("Test");
 RigidJoint rigidJointOne = new RigidJoint("rigidJointOne", new Vector3D(), robot);
 RotationMatrix rotation = new RotationMatrix();
 Vector3D eulerAngles = new Vector3D(0.3, 0.1, 0.2);
 rotation.setEuler(eulerAngles);
 rigidJointOne.setRigidRotation(rotation);
 Vector3D translation = new Vector3D(0.3, -0.99, 1.11);
 rigidJointOne.setRigidTranslation(translation);
 RigidBodyTransform transform = new RigidBodyTransform();
 transform.setTranslation(translation);
 transform.setRotation(rotation);
 Link rigidLinkOne = new Link("rigidLinkOne");
 double massOne = 1.0;
 rigidLinkOne.setMassAndRadiiOfGyration(massOne, 0.1, 0.1, 0.1);
 Vector3D centerOfMassOffset = new Vector3D(0.3, 0.7, 1.11);
 rigidLinkOne.setComOffset(centerOfMassOffset);
 rigidJointOne.setLink(rigidLinkOne);
 robot.addRootJoint(rigidJointOne);
 robot.update();
 Point3D centerOfMass = new Point3D();
 double totalMass = robot.computeCenterOfMass(centerOfMass);
 assertEquals(massOne, totalMass, 1e-7);
 Point3D expectedCenterOfMass = new Point3D(centerOfMassOffset);
 transform.transform(expectedCenterOfMass);
 EuclidCoreTestTools.assertTuple3DEquals(expectedCenterOfMass, centerOfMass, 1e-10);
}

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

robot.update();
robot.update();
robot.update();
robot.update();

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

pinJointB.setQd(0.145);
robotA.update();
robotB.update();

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

sliderJointB.setQd(0.145);
robotA.update();
robotB.update();

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

sliderJointB.setQd(qdTwo);
robotA.update();
robotB.update();

相关文章