Skip to content

Commit 616a2cb

Browse files
authored
Merge pull request #1208 from cmastalli/topic/quadruped-biped-examples
2 parents 7bd546f + 2bdbc2b commit 616a2cb

File tree

5 files changed

+281
-245
lines changed

5 files changed

+281
-245
lines changed

bindings/python/crocoddyl/utils/biped.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,22 @@ def createSwingFootModel(
386386
if self._integrator == "euler":
387387
model = crocoddyl.IntegratedActionModelEuler(dmodel, control, timeStep)
388388
elif self._integrator == "rk4":
389-
model = crocoddyl.IntegratedActionModelRK4(dmodel, control, timeStep)
389+
model = crocoddyl.IntegratedActionModelRK(
390+
dmodel, control, crocoddyl.RKType.four, timeStep
391+
)
392+
elif self._integrator == "rk3":
393+
model = crocoddyl.IntegratedActionModelRK(
394+
dmodel, control, crocoddyl.RKType.three, timeStep
395+
)
396+
elif self._integrator == "rk2":
397+
model = crocoddyl.IntegratedActionModelRK(
398+
dmodel, control, crocoddyl.RKType.two, timeStep
399+
)
400+
else:
401+
model = crocoddyl.IntegratedActionModelEuler(dmodel, control, timeStep)
390402
return model
391403

392-
def createFootSwitchModel(self, supportFootIds, swingFootTask, pseudoImpulse=True):
404+
def createFootSwitchModel(self, supportFootIds, swingFootTask, pseudoImpulse=False):
393405
"""Action model for a foot switch phase.
394406
395407
:param supportFootIds: Ids of the constrained feet
@@ -512,15 +524,15 @@ def createPseudoImpulseModel(self, supportFootIds, swingFootTask):
512524
)
513525
if self._integrator == "euler":
514526
model = crocoddyl.IntegratedActionModelEuler(dmodel, 0.0)
515-
elif self.integrator == "rk4":
527+
elif self._integrator == "rk4":
516528
model = crocoddyl.IntegratedActionModelRK(
517529
dmodel, crocoddyl.RKType.four, 0.0
518530
)
519-
elif self.integrator == "rk3":
531+
elif self._integrator == "rk3":
520532
model = crocoddyl.IntegratedActionModelRK(
521533
dmodel, crocoddyl.RKType.three, 0.0
522534
)
523-
elif self.integrator == "rk2":
535+
elif self._integrator == "rk2":
524536
model = crocoddyl.IntegratedActionModelRK(dmodel, crocoddyl.RKType.two, 0.0)
525537
else:
526538
model = crocoddyl.IntegratedActionModelEuler(dmodel, 0.0)

bindings/python/crocoddyl/utils/quadruped.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def createCoMGoalProblem(self, x0, comGoTo, timeStep, numKnots):
127127
:return shooting problem
128128
"""
129129
# Compute the current foot positions
130-
q0 = self.rmodel.referenceConfigurations["standing"]
130+
q0 = x0[: self.state.nq]
131131
pinocchio.forwardKinematics(self.rmodel, self.rdata, q0)
132132
pinocchio.updateFramePlacements(self.rmodel, self.rdata)
133133
com0 = pinocchio.centerOfMass(self.rmodel, self.rdata, q0)
@@ -739,7 +739,19 @@ def createSwingFootModel(
739739
if self._integrator == "euler":
740740
model = crocoddyl.IntegratedActionModelEuler(dmodel, control, timeStep)
741741
elif self._integrator == "rk4":
742-
model = crocoddyl.IntegratedActionModelRK4(dmodel, control, timeStep)
742+
model = crocoddyl.IntegratedActionModelRK(
743+
dmodel, control, crocoddyl.RKType.four, timeStep
744+
)
745+
elif self._integrator == "rk3":
746+
model = crocoddyl.IntegratedActionModelRK(
747+
dmodel, control, crocoddyl.RKType.three, timeStep
748+
)
749+
elif self._integrator == "rk2":
750+
model = crocoddyl.IntegratedActionModelRK(
751+
dmodel, control, crocoddyl.RKType.two, timeStep
752+
)
753+
else:
754+
model = crocoddyl.IntegratedActionModelEuler(dmodel, control, timeStep)
743755
return model
744756

745757
def createFootSwitchModel(self, supportFootIds, swingFootTask, pseudoImpulse=False):
@@ -864,15 +876,15 @@ def createPseudoImpulseModel(self, supportFootIds, swingFootTask):
864876
)
865877
if self._integrator == "euler":
866878
model = crocoddyl.IntegratedActionModelEuler(dmodel, 0.0)
867-
elif self.integrator == "rk4":
879+
elif self._integrator == "rk4":
868880
model = crocoddyl.IntegratedActionModelRK(
869881
dmodel, crocoddyl.RKType.four, 0.0
870882
)
871-
elif self.integrator == "rk3":
883+
elif self._integrator == "rk3":
872884
model = crocoddyl.IntegratedActionModelRK(
873885
dmodel, crocoddyl.RKType.three, 0.0
874886
)
875-
elif self.integrator == "rk2":
887+
elif self._integrator == "rk2":
876888
model = crocoddyl.IntegratedActionModelRK(dmodel, crocoddyl.RKType.two, 0.0)
877889
else:
878890
model = crocoddyl.IntegratedActionModelEuler(dmodel, 0.0)

0 commit comments

Comments
 (0)