Commit d1f81b9 1 parent b38ff1d commit d1f81b9 Copy full SHA for d1f81b9
File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -960,22 +960,27 @@ def coriolis_matrix(self) -> jtp.Matrix:
960
960
xfb = self .data .model_state .xfb (),
961
961
)
962
962
963
- if self .velocity_representation is VelRepr .Inertial :
964
- return C
965
-
966
- elif self .velocity_representation is VelRepr .Body :
963
+ def body (C ):
967
964
W_H_B = self .base_transform ()
968
965
B_X_W = sixd .se3 .SE3 .from_matrix (W_H_B ).inverse ().adjoint ()
969
- return B_X_W .T @ C @ B_X_W
966
+ C = B_X_W .T @ C @ B_X_W
970
967
971
- elif self . velocity_representation is VelRepr . Mixed :
968
+ def mixed ( C ) :
972
969
W_H_B = self .base_transform ()
973
970
W_H_BW = W_H_B .at [0 :3 , 0 :3 ].set (jnp .eye (3 ))
974
971
BW_X_W = sixd .se3 .SE3 .from_matrix (W_H_BW ).inverse ().adjoint ()
975
- return BW_X_W .T @ C @ BW_X_W
972
+ C = BW_X_W .T @ C @ BW_X_W
976
973
977
- else :
978
- raise ValueError (self .velocity_representation )
974
+ to_active = {
975
+ VelRepr .Body : body ,
976
+ VelRepr .Mixed : mixed ,
977
+ VelRepr .Inertial : lambda x : x ,
978
+ }
979
+
980
+ try :
981
+ C = to_active [self .velocity_representation ](C )
982
+ except ValueError as e :
983
+ raise e
979
984
980
985
return M , M_dot , C
981
986
You can’t perform that action at this time.
0 commit comments