def fkine(self, stance, unit='rad', apply_stance=False, actor_list=None, timer=None):
"""
Calculates forward kinematics for a list of joint angles.
:param stance: stance is list of joint angles.
:param unit: unit of input angles.
:param apply_stance: If True, then applied tp actor_list.
:param actor_list: Passed to apply transformations computed by fkine.
:param timer: internal use only (for animation).
:return: homogeneous transformation matrix.
"""
if type(stance) is np.ndarray:
stance = np.asmatrix(stance)
if unit == 'deg':
stance = stance * pi / 180
if timer is None:
timer = 0
t = self.base
for i in range(self.length):
if apply_stance:
actor_list[i].SetUserMatrix(transforms.np2vtk(t))
t = t * self.links[i].A(stance[timer, i])
t = t * self.tool
if apply_stance:
actor_list[self.length].SetUserMatrix(transforms.np2vtk(t))
return t
评论列表
文章目录