miller_viz.py
def add_custom_plots(ocp: OptimalControlProgram, dynamics_type: MillerDynamics):
    """
    Add extra plots to the OCP.

    Parameters
    ----------
    ocp: OptimalControlProgram
        Optimal control program
    dynamics_type: MillerDynamics
        Type of dynamics of the Miller optimal control problem
    """
    for i, nlp in enumerate(ocp.nlp):

        ocp.add_plot(
            "LinearMomentum",
            lambda t, x, u, p: plot_linear_momentum(x, nlp),
            phase=i,
            legend=["Linear Momentum x", "Linear Momentum y", "Linear Momentum z"],
            plot_type=PlotType.PLOT,
        )

        ocp.add_plot(
            "AngularMomentum",
            lambda t, x, u, p: plot_angular_momentum(x, nlp),
            phase=i,
            legend=["Angular Momentum x", "Angular Momentum y", "Angular Momentum z"],
            plot_type=PlotType.PLOT,
        )
        if "implicit" in dynamics_type.value:
            ocp.add_plot(
                "TorqueResiduals",
                lambda t, x, u, p: plot_residual_torque(x, u, nlp),
                phase=i,
                legend=[
                    "TorqueResiduals x",
                    "TorqueResiduals y",
                    "TorqueResiduals z",
                    "TorqueResiduals Rx",
                    "TorqueResiduals Ry",
                    "TorqueResiduals Rz",
                ],
                plot_type=PlotType.PLOT,
            )

    Add extra plots to the OCP.

    Parameters
    ----------
    ocp: OptimalControlProgram
        Optimal control program
    dynamics_type: MillerDynamics
        Type of dynamics of the Miller optimal control problem
    
Add extra plots to the OCP.
Parameters

OptimalControlProgram
Optimal control program
dynamics_type: MillerDynamics
Type of dynamics of the Miller optimal control problem
Add extra plots to the OCP . Parameters OptimalControlProgram Optimal control program dynamics_type : MillerDynamics Type of dynamics of the Miller optimal control problem
def add_custom_plots(ocp: OptimalControlProgram, dynamics_type: MillerDynamics):
    for i, nlp in enumerate(ocp.nlp):
        ocp.add_plot(
            "LinearMomentum",
            lambda t, x, u, p: plot_linear_momentum(x, nlp),
            phase=i,
            legend=["Linear Momentum x", "Linear Momentum y", "Linear Momentum z"],
            plot_type=PlotType.PLOT,
        )
        ocp.add_plot(
            "AngularMomentum",
            lambda t, x, u, p: plot_angular_momentum(x, nlp),
            phase=i,
            legend=["Angular Momentum x", "Angular Momentum y", "Angular Momentum z"],
            plot_type=PlotType.PLOT,
        )
        if "implicit" in dynamics_type.value:
            ocp.add_plot(
                "TorqueResiduals",
                lambda t, x, u, p: plot_residual_torque(x, u, nlp),
                phase=i,
                legend=[
                    "TorqueResiduals x",
                    "TorqueResiduals y",
                    "TorqueResiduals z",
                    "TorqueResiduals Rx",
                    "TorqueResiduals Ry",
                    "TorqueResiduals Rz",
                ],
                plot_type=PlotType.PLOT,
            )
def add_custom_plots ( ocp : OptimalControlProgram , dynamics_type : MillerDynamics ) : for i , nlp in enumerate ( ocp . nlp ) : ocp . add_plot ( "LinearMomentum" , lambda t , x , u , p : plot_linear_momentum ( x , nlp ) , phase = i , legend = [ "Linear Momentum x" , "Linear Momentum y" , "Linear Momentum z" ] , plot_type = PlotType . PLOT , ) ocp . add_plot ( "AngularMomentum" , lambda t , x , u , p : plot_angular_momentum ( x , nlp ) , phase = i , legend = [ "Angular Momentum x" , "Angular Momentum y" , "Angular Momentum z" ] , plot_type = PlotType . PLOT , ) if "implicit" in dynamics_type . value : ocp . add_plot ( "TorqueResiduals" , lambda t , x , u , p : plot_residual_torque ( x , u , nlp ) , phase = i , legend = [ "TorqueResiduals x" , "TorqueResiduals y" , "TorqueResiduals z" , "TorqueResiduals Rx" , "TorqueResiduals Ry" , "TorqueResiduals Rz" , ] , plot_type = PlotType . PLOT , )
Add extra plots to the OCP.
Add extra plots to the OCP .
"""
    Add extra plots to the OCP.

    Parameters
    ----------
    ocp: OptimalControlProgram
        Optimal control program
    dynamics_type: MillerDynamics
        Type of dynamics of the Miller optimal control problem
    """
ocp
OptimalControlProgram
dynamics_type
MillerDynamics