|
58 | 58 | auxiliary_fns["jacobian_fn"],
|
59 | 59 | )
|
60 | 60 |
|
61 |
| -def sweep_local_tip_force_to_bending_torque_mapping(): |
62 |
| - def compute_bending_torque(q: Array) -> Array: |
63 |
| - # backbone coordinate of the end-effector |
64 |
| - s_ee = jnp.sum(params["l"]) |
65 |
| - # compute the pose of the end-effector |
66 |
| - chi_ee = forward_kinematics_fn(params, q, s_ee) |
67 |
| - # orientation of the end-effector |
68 |
| - th_ee = chi_ee[2] |
69 |
| - # compute the jacobian of the end-effector |
70 |
| - J_ee = auxiliary_fns["jacobian_fn"](params, q, s_ee) |
71 |
| - # local tip force |
72 |
| - f_ee_local = jnp.array([0.0, 1.0]) |
73 |
| - # tip force in inertial frame |
74 |
| - f_ee = jnp.array([[jnp.cos(th_ee), -jnp.sin(th_ee)], [jnp.sin(th_ee), jnp.cos(th_ee)]]) @ f_ee_local |
75 |
| - # compute the generalized torque |
76 |
| - tau_be = J_ee[:2, 0].T @ f_ee |
77 |
| - return tau_be |
78 |
| - |
79 |
| - kappa_be_pts = jnp.arange(-2*jnp.pi, 2*jnp.pi, 0.01) |
80 |
| - sigma_ax_pts = jnp.zeros_like(kappa_be_pts) |
81 |
| - q_pts = jnp.stack([kappa_be_pts, sigma_ax_pts], axis=-1) |
82 |
| - |
83 |
| - tau_be_pts = vmap(compute_bending_torque)(q_pts) |
84 |
| - |
85 |
| - # plot the mapping on the bending strain |
86 |
| - fig, ax = plt.subplots(num="planar_pcs_local_tip_force_to_bending_torque_mapping") |
87 |
| - plt.title(r"Mapping from $f_\mathrm{ee}$ to $\tau_\mathrm{be}$") |
88 |
| - ax.plot(kappa_be_pts, tau_be_pts, linewidth=2.5) |
89 |
| - ax.set_xlabel(r"$\kappa_\mathrm{be}$ [rad/m]") |
90 |
| - ax.set_ylabel(r"$\tau_\mathrm{be}$ [N m]") |
91 |
| - plt.grid(True) |
92 |
| - plt.tight_layout() |
93 |
| - plt.show() |
94 |
| - |
95 | 61 |
|
96 | 62 | def sweep_actuation_mapping():
|
97 | 63 | # evaluate the actuation matrix for a straight backbone
|
@@ -285,6 +251,5 @@ def simulate_robot():
|
285 | 251 | plt.show()
|
286 | 252 |
|
287 | 253 | if __name__ == "__main__":
|
288 |
| - sweep_local_tip_force_to_bending_torque_mapping() |
289 | 254 | sweep_actuation_mapping()
|
290 | 255 | simulate_robot()
|
0 commit comments