|
7 | 7 |
|
8 | 8 | from rcs import common |
9 | 9 |
|
10 | | -from scipy.spatial.transform import Rotation as R |
11 | | - |
12 | 10 |
|
13 | 11 | @dataclass(kw_only=True) |
14 | 12 | class XArm7Config(common.RobotConfig): |
@@ -37,21 +35,16 @@ def __init__(self, ip: str): |
37 | 35 | center_of_gravity=self._config.payload_tcp, |
38 | 36 | wait=True, |
39 | 37 | ) |
40 | | - |
41 | | - # def get_base_pose_in_world_coordinates(self) -> Pose: ... |
42 | 38 |
|
43 | 39 | def get_cartesian_position(self) -> common.Pose: |
44 | 40 | code, xyzrpy = self._xarm.get_position(is_radian=True) |
45 | 41 | if code != 0: |
46 | 42 | raise RuntimeError("couldn't get cartesian position from xarm") |
47 | 43 |
|
48 | | - translation = np.array(xyzrpy[:3], dtype=np.float64).reshape((3, 1)) * 0.001 |
| 44 | + translation_meter = np.array(xyzrpy[:3], dtype=np.float64) * 0.001 |
49 | 45 | rpy = xyzrpy[3:] |
50 | | - quat = R.from_euler('xyz', rpy).as_quat() # [x, y, z, w] |
51 | | - quat = np.array(quat, dtype=np.float64).reshape((4, 1)) |
52 | 46 |
|
53 | | - # return common.Pose(quaternion=quat, translation=translation) |
54 | | - return common.Pose(rpy_vector=rpy, translation=translation) |
| 47 | + return common.Pose(rpy_vector=rpy, translation=translation_meter) |
55 | 48 |
|
56 | 49 | def get_ik(self) -> common.IK | None: |
57 | 50 | return self.ik |
@@ -92,8 +85,3 @@ def __enter__(self): |
92 | 85 |
|
93 | 86 | def __exit__(self, exc_type, exc_value, traceback): |
94 | 87 | self._xarm.disconnect() |
95 | | - |
96 | | - |
97 | | - # def to_pose_in_robot_coordinates(self, pose_in_world_coordinates: Pose) -> Pose: ... |
98 | | - # def to_pose_in_world_coordinates(self, pose_in_robot_coordinates: Pose) -> Pose: ... |
99 | | - |
0 commit comments