@@ -99,15 +99,21 @@ def sweep_actuation_mapping():
99
99
A = actuation_mapping_fn (params , B_xi , q )
100
100
print ("Evaluating actuation matrix for straight backbone: A =\n " , A )
101
101
102
- kappa_be_pts = jnp .linspace (- jnp .pi , jnp .pi , 500 )
102
+ kappa_be_pts = jnp .linspace (- 3 * jnp .pi , 3 * jnp .pi , 500 )
103
103
sigma_ax_pts = jnp .zeros_like (kappa_be_pts )
104
104
q_pts = jnp .stack ([kappa_be_pts , sigma_ax_pts ], axis = - 1 )
105
105
A_pts = vmap (actuation_mapping_fn , in_axes = (None , None , 0 ))(params , B_xi , q_pts )
106
+ # mark the points that are not controllable as the u1 and u2 terms share the same sign
107
+ non_controllable_selector = A_pts [..., 0 , 0 ] * A_pts [..., 0 , 1 ] >= 0.0
108
+ non_controllable_indices = jnp .where (non_controllable_selector )[0 ]
109
+ non_controllable_boundary_indices = jnp .where (non_controllable_selector [:- 1 ] != non_controllable_selector [1 :])[0 ]
106
110
# plot the mapping on the bending strain for various bending strains
107
111
fig , ax = plt .subplots (num = "pneumatic_planar_pcs_actuation_mapping_bending_torque_vs_bending_strain" )
108
112
plt .title (r"Actuation mapping from $u$ to $\tau_\mathrm{be}$" )
109
- # shade the region where the actuation mapping is negative as we are not able to bend the robot further
110
- ax .axhspan (A_pts [:, 0 , 0 :2 ].min (), 0.0 , facecolor = 'red' , alpha = 0.2 )
113
+ # # shade the region where the actuation mapping is negative as we are not able to bend the robot further
114
+ # ax.axhspan(A_pts[:, 0, 0:2].min(), 0.0, facecolor='red', alpha=0.2)
115
+ for idx in non_controllable_indices :
116
+ ax .axvspan (kappa_be_pts [idx ], kappa_be_pts [idx + 1 ], facecolor = 'red' , alpha = 0.2 )
111
117
ax .plot (kappa_be_pts , A_pts [:, 0 , 0 ], linewidth = 2 , label = r"$\frac{\partial \tau_\mathrm{be}}{\partial u_1}$" )
112
118
ax .plot (kappa_be_pts , A_pts [:, 0 , 1 ], linewidth = 2 , label = r"$\frac{\partial \tau_\mathrm{ax}}{\partial u_2}$" )
113
119
ax .set_xlabel (r"$\kappa_\mathrm{be}$ [rad/m]" )
0 commit comments