Integrate both method into one comprehensive file.

This commit is contained in:
LiuzhengSJ
2026-08-05 16:01:12 +01:00
parent 2e25951bc0
commit c0e181cc50
6 changed files with 1212 additions and 1219 deletions
+32 -38
View File
@@ -1,48 +1,42 @@
### This repo is for inverse kinematics and verification
In this branch, the qp-based inverse kinematics method is modified as a python class. The user can call it as in `main.py`
In this branch, the **integrated** inverse kinematics method is packed as a python class.
Inverse Kinematics (IK) is numerically obtained through quadratic programming (QP).
The user can call it as in `test1.py`, `test2.py`.
Verification is done with Mujoco simulation.
How to use
Key specifications:
1. Time consumption.
2. Success rate
3. Minial joint variation.
Next:\
Comparison with Realman official IK method.
Embedded with current demo.
### Comparison (05June2026):
- With current dual arm joint limit,
```aiignore
from rm75_kinematics import rm75_kinematics
robot_kine = rm75_kinematics(urdf_path='./urdf_rm75/RM75-SCI.urdf',
mesh_dir='./urdf_rm75',
tcps=["scissor_tcp", "camera_tcp"],
tools_in_ee=tools_in_ee,min_j=lb, max_j=ub)
```
ub = np.array([150.0, 110.0, 170.0, 130, 175.0, 125.0, 179.0])
lb = np.array([-150.0, -30.0, -170.0, -130, -175.0, -125.0, -179.0])
Parameter definition:
- urdf_path: the robot description file, ending with `.urdf`.
- mesh_dir: the robot parts, ending with `.stl`.
- tcps: the tool central points defined in urdf file, if no, ignore it.
- tools_in_ee: the installation of different tools attached to the end-effector of the arm (jont7+link7).
### Current functions ###
1. `get_ik_result`
```aiignore
ret_ik, q = robot_kine.get_ik_result(target_position=[0.2, -0.2 , 0.5 ],
target_rpy=[0.2022060487764064, -0.0097962261845583, -0.6518417572686532],
initial_guess=[0.1] * 7, tool=tool_name)
```
the success rates for **qp-based ik** and **realman Algo ik** are **63%** and **46%**.\
At least one solver works out the ik, rate = **74%**.
- With realman-75 physical joint limit,
2. `get_fk_result`
```aiignore
p = robot_kine.get_fk_result(joint_angles=q,tool=tool_name)
```
ub = np.array([179.0, 129.0, 179.0, 134, 179.0, 127.0, 359.0])
lb = -ub
```
the success rates for **qp-based ik** and **realman Algo ik** are **76%** and **51%**.\
At least one solver works out the ik, rate = **84%**.
### update(1st July 2026)
In each iteration, update optimization formula:
- new cost item for distance from middle of the joint range.
- set up different weight for different joints motion.
<img src="img/optimization.png" alt="Cost" width="400">
<img src="img/cons.png" alt="Cost" width="400">
<img src="img/osqp.png" alt="Cost" width="400">
3. `get_self_collision`
```aiignore
self_collision_sts = robot_kine.get_self_collision(q)
```