From daacc89b634a465c4c16f948df46f2a45444362f Mon Sep 17 00:00:00 2001 From: Thomas Moulard <thomas.moulard@gmail.com> Date: Mon, 25 Apr 2011 12:16:05 +0200 Subject: [PATCH] Implement reset in humanoid_robot.py. --- .../sot/dynamics/humanoid_robot.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/dynamic_graph/sot/dynamics/humanoid_robot.py b/src/dynamic_graph/sot/dynamics/humanoid_robot.py index af3add7..05634fe 100755 --- a/src/dynamic_graph/sot/dynamics/humanoid_robot.py +++ b/src/dynamic_graph/sot/dynamics/humanoid_robot.py @@ -212,6 +212,28 @@ class AbstractHumanoidRobot (object): def __init__(self, name): self.name = name + def reset(self, posture = None): + """ + Restart the control from another position. + + This method has not been extensively tested and + should be used carefully. + + In particular, tasks should be removed from the + solver before attempting a reset. + """ + if not posture: + posture = self.halfSitting + self.device.set(posture) + + self.dynamic.com.recompute(self.device.state.time+1) + self.dynamic.Jcom.recompute(self.device.state.time+1) + self.featureComDes.errorIN.value = self.dynamic.com.value + + for op in self.OperationalPoints: + self.dynamic.signal(op).recompute(self.device.state.time+1) + self.dynamic.signal('J'+op).recompute(self.device.state.time+1) + self.features[op].reference.value = self.dynamic.signal(op).value class HumanoidRobot(AbstractHumanoidRobot): -- GitLab