File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<mujoco >
2+ <!-- custom tcp offset -->
3+ <custom >
4+ <numeric name =" tcp_offset_translation" data =" 0.0 0.0 0.1034" />
5+ <!-- rotation matrix is row major -->
6+ <numeric name =" tcp_offset_rotation_matrix" data =" 0.707 0.707 0 -0.707 0.707 0 0 0 1" />
7+ </custom >
28 <default >
39 <default class =" fr3" >
410 <joint armature =" 0.1" damping =" 1" />
Original file line number Diff line number Diff line change 11<mujoco >
2+ <!-- custom tcp offset -->
3+ <custom >
4+ <numeric name =" tcp_offset_translation" data =" 0.0 0.0 0.1034" />
5+ <!-- rotation matrix is row major -->
6+ <numeric name =" tcp_offset_rotation_matrix" data =" 0.707 0.707 0 -0.707 0.707 0 0 0 1" />
7+ </custom >
28 <default >
39 <default class =" fr3" >
410 <joint armature =" 0.1" damping =" 1" />
Original file line number Diff line number Diff line change @@ -88,12 +88,14 @@ def get_tcp_offset(mjcf: str | Path) -> rcs.common.Pose:
8888 elif mjcf .suffix == ".mjb" :
8989 model = mj .MjModel .from_binary_path (str (mjcf ))
9090 else :
91- msg = f"Expected .mjb, .mjcf or.xml, got { mjcf .suffix } "
91+ msg = f"Expected .mjb, .mjcf or.xml, got { mjcf .suffix } and { mjcf } "
9292 raise AssertionError (msg )
9393 try :
94- tcp_offset = np .array (model .numeric ("tcp_offset" ).data )
95- pose_offset = rcs .common .Pose (translation = tcp_offset )
96- return pose_offset
94+ tcp_offset_translation = np .array (model .numeric ("tcp_offset_translation" ).data )
95+ tcp_offset_rotation_matrix = np .array (model .numeric ("tcp_offset_rotation_matrix" ).data )
96+ return rcs .common .Pose (
97+ translation = tcp_offset_translation , rotation = tcp_offset_rotation_matrix .reshape ((3 , 3 ))
98+ ) # type: ignore
9799 except KeyError :
98100 msg = "No tcp offset found in the model. Using the default tcp offset."
99101 logging .info (msg )
You can’t perform that action at this time.
0 commit comments