|
13 | 13 | from rclpy.qos import (HistoryPolicy, QoSDurabilityPolicy, QoSProfile, |
14 | 14 | ReliabilityPolicy) |
15 | 15 | from reachy2_symbolic_ik.control_ik import ControlIK |
| 16 | + |
| 17 | +from reachy_utils.config import ReachyConfig |
16 | 18 | from reachy2_symbolic_ik.symbolic_ik import SymbolicIK |
17 | 19 | from reachy2_symbolic_ik.utils import (allow_multiturn, |
18 | 20 | get_best_continuous_theta, |
@@ -71,36 +73,12 @@ def __init__(self): |
71 | 73 | ) |
72 | 74 |
|
73 | 75 | self.orbita3D_max_angle = np.deg2rad(42.5) # 43.5 is too much |
74 | | - # Symbolic IK inits. |
75 | | - # A balanced position between elbow down and elbow at 90° |
76 | | - # self.prefered_theta = -4 * np.pi / 6 # 5 * np.pi / 4 # np.pi / 4 |
77 | | - # self.nb_search_points = 20 |
78 | | - # self.previous_theta = {} |
79 | | - # self.previous_sol = {} |
80 | 76 |
|
81 | 77 | for prefix in ("l", "r"): |
82 | 78 | arm = f"{prefix}_arm" |
83 | 79 |
|
84 | 80 | chain, fk_solver, ik_solver = generate_solver(self.urdf, "torso", f"{prefix}_arm_tip") |
85 | 81 |
|
86 | | - # self.symbolic_ik_solver[arm] = SymbolicIK( |
87 | | - # arm=arm, |
88 | | - # upper_arm_size=0.28, |
89 | | - # forearm_size=0.28, |
90 | | - # gripper_size=0.10, |
91 | | - # wrist_limit=np.rad2deg(self.orbita3D_max_angle), |
92 | | - # # This is the "correct" stuff for alpha |
93 | | - # # shoulder_orientation_offset=[10, 0, 15], |
94 | | - # # elbow_orientation_offset=[0, 0, 0], |
95 | | - # # This is the "wrong" values currently used by the alpha |
96 | | - # # shoulder_orientation_offset=[0, 0, 15], |
97 | | - # # shoulder_position=[-0.0479, -0.1913, 0.025], |
98 | | - # ) |
99 | | - |
100 | | - # self.previous_theta[arm] = None |
101 | | - # self.previous_sol[arm] = None |
102 | | - # self.last_call_t[arm] = 0 |
103 | | - |
104 | 82 | # We automatically loads the kinematics corresponding to the config |
105 | 83 | if chain.getNrOfJoints(): |
106 | 84 | self.logger.info(f'Found kinematics chain for "{arm}"!') |
@@ -299,11 +277,15 @@ def __init__(self): |
299 | 277 | self.chain["l_arm"].getNrOfJoints(), |
300 | 278 | ) |
301 | 279 | current_pose = [current_pose_r, current_pose_l] |
| 280 | + |
| 281 | + reachy_config = ReachyConfig() |
| 282 | + |
302 | 283 | self.control_ik = ControlIK( |
303 | 284 | logger=self.logger, |
304 | 285 | current_joints=current_joints, |
305 | 286 | current_pose=current_pose, |
306 | 287 | urdf=self.urdf, |
| 288 | + reachy_model=reachy_config.model, |
307 | 289 | ) |
308 | 290 |
|
309 | 291 | self.logger.info(f"Kinematics node ready!") |
|
0 commit comments