miller_viz.py
def plot_angular_momentum(x, nlp: NonLinearProgram):
    """
    Compute the angular momentum of the system.

    Parameters
    ----------
    x
        State vector
    nlp: NonLinearProgram
        Non linear program
    """
    angular_momentum_func = biorbd.to_casadi_func(
        "AngularMomentum", nlp.model.angularMomentum, nlp.states["q"].mx, nlp.states["qdot"].mx, expand=False
    )

    q = nlp.states["q"].mapping.to_second.map(x[nlp.states["q"].index, :])
    qdot = nlp.states["qdot"].mapping.to_second.map(x[nlp.states["qdot"].index, :])

    return np.array(angular_momentum_func(q, qdot))

    Compute the angular momentum of the system.

    Parameters
    ----------
    x
        State vector
    nlp: NonLinearProgram
        Non linear program
    
Compute the angular momentum of the system.
Parameters

x
State vector
nlp: NonLinearProgram
Non linear program
Compute the angular momentum of the system . Parameters x State vector nlp : NonLinearProgram Non linear program
def plot_angular_momentum(x, nlp: NonLinearProgram):
    angular_momentum_func = biorbd.to_casadi_func(
        "AngularMomentum", nlp.model.angularMomentum, nlp.states["q"].mx, nlp.states["qdot"].mx, expand=False
    )
    q = nlp.states["q"].mapping.to_second.map(x[nlp.states["q"].index, :])
    qdot = nlp.states["qdot"].mapping.to_second.map(x[nlp.states["qdot"].index, :])
    return np.array(angular_momentum_func(q, qdot))
def plot_angular_momentum ( x , nlp : NonLinearProgram ) : angular_momentum_func = biorbd . to_casadi_func ( "AngularMomentum" , nlp . model . angularMomentum , nlp . states [ "q" ] . mx , nlp . states [ "qdot" ] . mx , expand = False ) q = nlp . states [ "q" ] . mapping . to_second . map ( x [ nlp . states [ "q" ] . index , : ] ) qdot = nlp . states [ "qdot" ] . mapping . to_second . map ( x [ nlp . states [ "qdot" ] . index , : ] ) return np . array ( angular_momentum_func ( q , qdot ) )
Compute the angular momentum of the system.
Compute the angular momentum of the system .
"""
    Compute the angular momentum of the system.

    Parameters
    ----------
    x
        State vector
    nlp: NonLinearProgram
        Non linear program
    """
x
nlp
NonLinearProgram