-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from Ipuch/another_fext_xp
[huge PR] Projecting joint torques into euler basis, transformation matrices, projection of natural coordinates into minimal coordinates, euler joint torque on going, custom ik function, more examples, more tests.
- Loading branch information
Showing
71 changed files
with
5,870 additions
and
1,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,3 +128,9 @@ dmypy.json | |
*.c3d | ||
|
||
sandbox/ | ||
|
||
.vscode/ | ||
|
||
tests/pendulum.nmod | ||
|
||
examples/forward_dynamics/pendulum_3d.nmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from enum import Enum | ||
from .joint import Joint, GroundJoint | ||
|
||
|
||
class JointType(Enum): | ||
""" | ||
This class represents the different types of joints | ||
""" | ||
|
||
# WELD = "not implemented yet" | ||
GROUND_FREE = GroundJoint.Free | ||
GROUND_WELD = GroundJoint.Weld | ||
GROUND_REVOLUTE = GroundJoint.Hinge | ||
GROUND_UNIVERSAL = GroundJoint.Universal | ||
GROUND_SPHERICAL = GroundJoint.Spherical | ||
CONSTANT_LENGTH = Joint.ConstantLength | ||
REVOLUTE = Joint.Hinge | ||
# PRISMATIC = "not implemented yet" | ||
UNIVERSAL = Joint.Universal | ||
SPHERICAL = Joint.Spherical | ||
SPHERE_ON_PLANE = Joint.SphereOnPlane | ||
|
||
# PLANAR = "planar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from biorbd_casadi import Rotation | ||
from casadi import MX | ||
import numpy as np | ||
|
||
|
||
def rotation_matrix_from_mx_to_biorbd(R: np.ndarray | MX) -> Rotation: | ||
""" | ||
This function returns the rotation matrix in biorbd formalism | ||
Parameters | ||
--------- | ||
R : np.ndarray | ||
Rotation matrix (3x3) | ||
Returns | ||
--------- | ||
biorbd.Rotation | ||
The rotation matrix object | ||
""" | ||
|
||
return Rotation( | ||
R[0, 0], | ||
R[0, 1], | ||
R[0, 2], | ||
R[1, 0], | ||
R[1, 1], | ||
R[1, 2], | ||
R[2, 0], | ||
R[2, 1], | ||
R[2, 2], | ||
) | ||
|
||
|
||
def rotation_matrix_to_euler_angles(rotation_matrix: MX, seq: str = "xyz") -> MX: | ||
""" | ||
This function returns the rotation matrix in euler angles vector | ||
Parameters | ||
--------- | ||
rotation_matrix : np.ndarray | ||
Rotation matrix (3x3) | ||
seq: str = "xyz" | ||
order of the coordinates in the returned vector | ||
Returns | ||
--------- | ||
MX | ||
The Euler vector in radian as an MX | ||
""" | ||
|
||
rotation_matrix_biorbd = rotation_matrix_from_mx_to_biorbd(rotation_matrix) | ||
return Rotation.toEulerAngles(rotation_matrix_biorbd, seq).to_mx() | ||
|
||
|
||
# not possible to use scipy with casadi ... |
Oops, something went wrong.