Newer
Older
import numpy as np
from .ProblemData import ProblemData
import pinocchio as pin
self.gait = ([] + \
[[0, 0, 0, 0]] * pd.init_steps + \
[[0, 0, 0, 0]] * pd.target_steps )
self.contactSequence = [self.patternToId(p) for p in self.gait]
pin.forwardKinematics(pd.model, pd.rdata, q, v)
pin.updateFramePlacements(pd.model, pd.rdata)
self.FR_foot0 = pd.rdata.oMf[pd.rfFootId].translation.copy()
self.offset = np.array([0.05, -0.02, 0.06])
return tuple(self.pd.allContactIds[i] for i, c in enumerate(gait) if c == 1)
def shift_gait(self):
self.gait.pop(0)
self.gait += [self.gait[-1]]
self.contactSequence = [self.patternToId(p) for p in self.gait]
target += [
self.FR_foot0
+ self.offset
+ self.A
* np.sin(2 * np.pi * self.freq * (n + t) * self.dt + self.phase)
]
return {e: self.target[e][t] for e in self.target}