-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Example of inverse dynamic #107
base: main
Are you sure you want to change the base?
Conversation
Are you ok if we do the review with Anais too ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ANaaim)
examples/inverse_dynamics/Validation_Dynamic_BioNC.py
line 315 at r1 (raw file):
from bionc.bionc_numpy.cartesian_vector import vector_projection_in_non_orthogonal_basis point = vector_projection_in_non_orthogonal_basis(center_of_plateform - rp_foot, u_foot, rp_foot - rd_foot, w_foot)
useless
examples/inverse_dynamics/Validation_Dynamic_BioNC.py
line 318 at r1 (raw file):
# Projection of the force on the segment frame position_point_application = rp_foot - np.repeat(PF1_origin[:, np.newaxis], Qopt_sqp.shape[1], axis=1)
useless
examples/inverse_dynamics/Validation_Dynamic_BioNC.py
line 325 at r1 (raw file):
list_external_force = ExternalForceList.empty_from_nb_segment(model.nb_segments) # Integration of the force in the list list_external_force.add_external_force(3, GRF)
class ExternalForce:
"""
This class represents an external force applied to a segment.
Attributes ---------- application_point_in_local : np.ndarray The application point of the force in the natural coordinate system of the segment external_forces : np.ndarray The external force vector in the global coordinate system (torque, force)
Methods ------- from_components(application_point_in_local, force, torque) This function creates an external force from its components. force This function returns the force vector of the external force. torque This function returns the torque vector of the external force. compute_pseudo_interpolation_matrix() This function computes the pseudo interpolation matrix of the external force. to_natural_force This function returns the external force in the natural coordinate format. """
def __init__(self, application_point_in_local: np.ndarray, external_forces: np.ndarray):
self.application_point_in_local = application_point_in_local
self.external_forces = external_forces
@classmethod
def from\_components(cls, application\_point\_in\_local: np.ndarray, force: np.ndarray, torque: np.ndarray):
"""
This function creates an external force from its components.
Parameters ---------- application\_point\_in\_local : np.ndarray The application point of the force in the natural coordinate system of the segment force The force vector in the global coordinate system torque The torque vector in the global coordinate system
Returns ------- ExternalForce """
return cls(application\_point\_in\_local, np.concatenate((torque, force)))
@classmethod
def from\_components\_in\_global(cls, application\_point\_in\_global: np.ndarray, force: np.ndarray, torque: np.ndarray, Qi):
return cls(application\_point\_in\_local, np.concatenate((torque, force)))
examples/inverse_dynamics/Validation_Dynamic_BioNC.py
line 331 at r1 (raw file):
tuple_of_Q = [ SegmentNaturalCoordinates.from_components( u=Qopt_sqp[i * 12 : i * 12 + 3, ind_frame],
Qopt.u
Qopt.rp
Qopt.rd
...
Okay, my implementation of External Forces is too drafty. A refactor need to be made see #112. |
Helping me with #87 |
black . -l120
This change is