33 from sensor_msgs.msg
import JointState
34 from numpy
import matrix
39 Wraps a full set of transforms, including a joint_chain 43 fixed links before -- chain -- fixed links after 53 self.
root = robot_params.base_link
55 chain = robot_params.chains[self.
chain_id]
56 before_chain = robot_params.urdf.get_chain(self.
root, chain.root, links=
False)
57 full_chain = robot_params.urdf.get_chain(chain.root, chain.tip)
59 after_chain = robot_params.urdf.get_chain(chain.tip, self.
tip, links=
False)
63 tip_chain = robot_params.urdf.get_chain(chain.root,self.
tip)
64 new_root = full_chain[0]
67 while i < len(full_chain):
68 if full_chain[i]
in tip_chain:
69 if full_chain[i]
in chain._active:
71 new_root = full_chain[i+1]
73 after_chain = robot_params.urdf.get_chain(new_root, self.
tip, links=
False)
76 before_chain = robot_params.urdf.get_chain(self.
root, self.
tip, links=
False)
79 before_chain_Ts = [robot_params.transforms[transform_name]
for transform_name
in before_chain]
80 after_chain_Ts = [robot_params.transforms[transform_name]
for transform_name
in after_chain]
81 self.calc_block.update_config(before_chain_Ts, chain, link_num, after_chain_Ts)
85 Build a dictionary that defines which parameters will in fact affect a measurement for a sensor using this chain. 88 sparsity[
'transforms'] = {}
89 sparsity[
'chains'] = {}
91 for cur_transform
in ( self.calc_block._before_chain_Ts + \
92 self.calc_block._chain._transforms.values() + \
93 self.calc_block._after_chain_Ts ):
94 sparsity[
'transforms'][cur_transform._name] = [1, 1, 1, 1, 1, 1]
95 sparsity[
'chains'][self.
chain_id] = {}
96 link_num = self.calc_block._link_num
98 link_num = self.calc_block._chain._M
99 sparsity[
'chains'][self.
chain_id][
'gearing'] = [1
for i
in range(link_num)]
101 for cur_transform
in ( self.calc_block._before_chain_Ts + \
102 self.calc_block._after_chain_Ts ):
103 sparsity[
'transforms'][cur_transform._name] = [1, 1, 1, 1, 1, 1]
113 def fk(self, chain_state):
114 pose = matrix(numpy.eye(4))
118 pose = pose * before_chain_T.transform
121 if self.
_chain is not None:
122 chain_T = self._chain.fk(chain_state, self.
_link_num)
123 pose = pose * chain_T
127 pose = pose * after_chain_T.transform
def update_config(self, robot_params)
def update_config(self, before_chain_Ts, chain, link_num, after_chain_Ts)
def build_sparsity_dict(self)
def __init__(self, chain_id, tip, root=None)
def fk(self, chain_state)