Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ANaaim
Copy link
Contributor

@ANaaim ANaaim commented Oct 31, 2023

  • Linked issue related to your pull request using '#XXX'
  • Used the tag [WIP] or [RTR] for on-going changes, or for ready to review
  • Did you write new tests to cover your changes?
  • Did you write a proper documentation (docstrings and ReadMe)
  • Please black your code black . -l120

This change is Reviewable

@Ipuch
Copy link
Owner

Ipuch commented Oct 31, 2023

Are you ok if we do the review with Anais too ?
By that time, if you want to target specific question. Write comment on lines in the Reviewable.

@Ipuch Ipuch added the new example illustrates the possibilities with bioNC label Nov 2, 2023
Copy link
Owner

@Ipuch Ipuch left a 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
...

@Ipuch
Copy link
Owner

Ipuch commented Nov 20, 2023

Okay, my implementation of External Forces is too drafty. A refactor need to be made see #112.

@Ipuch
Copy link
Owner

Ipuch commented Nov 20, 2023

Helping me with #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new example illustrates the possibilities with bioNC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants