Exemplo n.º 1
0
 def test_walk_20cm_quasistatic(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "walk_20cm_quasistatic.cs"))
     self.assertEqual(cs.size(), 23)
     self.assertFalse(cs.haveFriction())
     self.assertFalse(cs.haveContactModelDefined())
     self.assertTrue(cs.haveConsistentContacts())
Exemplo n.º 2
0
 def test_step_in_place(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "step_in_place.cs"))
     self.assertEqual(cs.size(), 9)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertFalse(cs.haveFriction())
     self.assertFalse(cs.haveContactModelDefined())
Exemplo n.º 3
0
 def test_com_motion_above_feet_COM(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "com_motion_above_feet_COM.cs"))
     self.assertEqual(cs.size(), 1)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertTrue(cs.haveTimings())
     self.assertTrue(cs.haveCentroidalValues())
     self.assertTrue(cs.haveCentroidalTrajectories())
     checkCS(self, cs)
Exemplo n.º 4
0
 def test_walk_20cm_quasistatic_COM(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "walk_20cm_quasistatic_COM.cs"))
     self.assertEqual(cs.size(), 23)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertTrue(cs.haveTimings())
     self.assertTrue(cs.haveCentroidalValues())
     self.assertTrue(cs.haveCentroidalTrajectories())
     self.assertFalse(cs.haveFriction())
     self.assertFalse(cs.haveContactModelDefined())
     checkCS(self, cs, quasistatic=True, effector=False, wholeBody=False)
Exemplo n.º 5
0
 def test_step_in_place_REF(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "step_in_place_REF.cs"))
     self.assertEqual(cs.size(), 9)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertTrue(cs.haveTimings())
     self.assertTrue(cs.haveCentroidalValues())
     self.assertTrue(cs.haveCentroidalTrajectories())
     self.assertTrue(cs.haveEffectorsTrajectories())
     self.assertTrue(cs.haveEffectorsTrajectories(1e-6, False))
     self.assertTrue(cs.haveFriction())
     self.assertTrue(cs.haveContactModelDefined())
     checkCS(self, cs, root=True, effector=True, wholeBody=False)
Exemplo n.º 6
0
 def test_com_motion_above_feet_WB(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "com_motion_above_feet_WB.cs"))
     self.assertEqual(cs.size(), 1)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertTrue(cs.haveTimings())
     self.assertTrue(cs.haveCentroidalValues())
     self.assertTrue(cs.haveCentroidalTrajectories())
     self.assertTrue(cs.haveJointsTrajectories())
     self.assertTrue(cs.haveJointsDerivativesTrajectories())
     self.assertTrue(cs.haveContactForcesTrajectories())
     self.assertTrue(cs.haveZMPtrajectories())
     checkCS(self, cs, wholeBody=True)
Exemplo n.º 7
0
 def test_walk_20cm_quasistatic_WB(self):
     cs = ContactSequence()
     cs.loadFromBinary(str(PATH / "walk_20cm_quasistatic_WB.cs"))
     self.assertEqual(cs.size(), 23)
     self.assertTrue(cs.haveConsistentContacts())
     self.assertTrue(cs.haveTimings())
     self.assertTrue(cs.haveCentroidalValues())
     self.assertTrue(cs.haveCentroidalTrajectories())
     self.assertTrue(cs.haveEffectorsTrajectories(1e-1))
     self.assertTrue(cs.haveJointsTrajectories())
     self.assertTrue(cs.haveJointsDerivativesTrajectories())
     self.assertTrue(cs.haveContactForcesTrajectories())
     self.assertTrue(cs.haveZMPtrajectories())
     self.assertTrue(cs.haveFriction())
     self.assertTrue(cs.haveContactModelDefined())
     checkCS(self, cs, quasistatic=True, effector=True, wholeBody=True)
v.addLandmark(sceneName, 1)
#initialize an empty contact sequence
cs = ContactSequence(0)

# start from the reference configuration of the robot :
q_ref = fb.referenceConfig[::] + [0] * 6
#q_ref[0:2] = [ , ] # change the x,y position of the base as needed
# q_ref[2] +=  # the z position of the base already correspond to a floor at z=0, change it accordingly to the environment
# q_ref[3:7] =   # quaternion (x,y,z) of the base

# display the configuration
v(q_ref)
com = array(fb.getCenterOfMass())

# create a first contact phase corresponding to this configuration
limbsInContact = [fb.rLegId, fb.lLegId
                  ]  # define the limbs in contact for this first phase
addPhaseFromConfig(fb, cs, q_ref, limbsInContact)

transform = SE3.Identity()
cs.moveEffectorOf(fb.rfoot, transform)
cs.moveEffectorOf(fb.lfoot, transform)
cs.moveEffectorOf(fb.rfoot, transform)
cs.moveEffectorOf(fb.lfoot, transform)

setFinalState(cs, com, q_ref)

assert cs.haveConsistentContacts()

cs.saveAsBinary("talos_flatGround.cs")