Karana.Models
=============

.. py:module:: Karana.Models

.. autoapi-nested-parse::

   General models used in a variety of simulations.



Submodules
----------

.. toctree::
   :maxdepth: 1

   /generated/python_api/Karana/Models/GeneralKModels_types/index


Attributes
----------

.. autoapisummary::

   Karana.Models.P
   Karana.Models.Sc
   Karana.Models.S
   Karana.Models.C


Classes
-------

.. autoapisummary::

   Karana.Models.KModelParams
   Karana.Models.NoParams
   Karana.Models.NoScratch
   Karana.Models.NoDiscreteStates
   Karana.Models.NoContinuousStates
   Karana.Models.KModel
   Karana.Models.BaseKModel
   Karana.Models.CppKModelContinuousStates
   Karana.Models.CppKModelDiscreteStates
   Karana.Models.CppKModelScratch
   Karana.Models.KModelContinuousStates
   Karana.Models.KModelDiscreteStates
   Karana.Models.KModelScratch
   Karana.Models.MultibodyObjs
   Karana.Models.OutputUpdateType
   Karana.Models.PyKModelBase
   Karana.Models.ArrayVecProfileGeneratorVars
   Karana.Models.ComputedTorque
   Karana.Models.ComputedTorqueKModel
   Karana.Models.DataLogger
   Karana.Models.DataLoggerKModel
   Karana.Models.DataLoggerParams
   Karana.Models.DataPlotter
   Karana.Models.DataPlotterKModel
   Karana.Models.DataPlotterParams
   Karana.Models.FloatConstantProfileGenerator
   Karana.Models.FloatCubicSplineProfileGenerator
   Karana.Models.FloatLinearProfileGenerator
   Karana.Models.FloatProfileGeneratorVars
   Karana.Models.GilRelease
   Karana.Models.GilReleaseKModel
   Karana.Models.GraphicalSceneMovie
   Karana.Models.GraphicalSceneMovieKModel
   Karana.Models.GraphicalSceneMovieParams
   Karana.Models.Gravity
   Karana.Models.GravityInterface
   Karana.Models.GravityKModel
   Karana.Models.GravityOutput
   Karana.Models.GravityVars
   Karana.Models.PID
   Karana.Models.PIDKModel
   Karana.Models.PIDParams
   Karana.Models.PIDParamsVars
   Karana.Models.PinJointLimits
   Karana.Models.PinJointLimitsKModel
   Karana.Models.PinJointLimitsParams
   Karana.Models.PointMassGravity
   Karana.Models.ProjectConstraintError
   Karana.Models.ProjectConstraintErrorKModel
   Karana.Models.ProjectConstraintErrorParams
   Karana.Models.SpringDamper
   Karana.Models.SpringDamperKModel
   Karana.Models.SpringDamperParams
   Karana.Models.SpringDamperParamsVars
   Karana.Models.SpringDamperScratch
   Karana.Models.SpringDamperScratchVars
   Karana.Models.SubhingeForceLimits
   Karana.Models.SubhingeForceLimitsKModel
   Karana.Models.SubhingeForceLimitsParams
   Karana.Models.SubhingeSpringDamper
   Karana.Models.SubhingeSpringDamperKModel
   Karana.Models.SubhingeSpringDamperParams
   Karana.Models.SyncRealTime
   Karana.Models.SyncRealTimeKModel
   Karana.Models.TimeDisplay
   Karana.Models.TimeDisplayKModel
   Karana.Models.TimeDisplayParams
   Karana.Models.TimeDisplayParamsVars
   Karana.Models.UniformGravity
   Karana.Models.UnitQuaternionConstantProfileGenerator
   Karana.Models.UnitQuaternionProfileGeneratorVars
   Karana.Models.UpdateProxyScene
   Karana.Models.UpdateProxySceneKModel
   Karana.Models.VecConstantProfileGenerator
   Karana.Models.VecCubicSplineProfileGenerator
   Karana.Models.VecLinearProfileGenerator
   Karana.Models.PenaltyContact
   Karana.Models.PenaltyContactKModel


Package Contents
----------------

.. py:class:: KModelParams(/, **data: Any)

   Bases: :py:obj:`Karana.KUtils.DataStruct.DataStruct`


   BaseClass for the model parameters of Python models.

   For a new model parameter class, simply derive from this class
   and add class variables just like you would do for any other
   DataStruct. Users should override the isReady if applicable
   to ensure that all model parameters have been defined.


   .. py:method:: isReady() -> bool

      Return true if all the parameters are ready. False otherwise.



   .. py:method:: dumpString(prefix: str, options: Karana.Core.DumpOptionsBase | None = None) -> str

      Dump the parameters as a string.

      :param prefix: The prefix for the string.
      :type prefix: str
      :param options: Options for the string.
      :type options: _DumpOptionsBase | None

      :returns: The parameters as a string.
      :rtype: str



.. py:class:: NoParams(/, **data: Any)

   Bases: :py:obj:`KModelParams`


   Class indicating there are no model params.


.. py:class:: NoScratch

   Bases: :py:obj:`KModelScratch`


   Class indicating there is no model scratch.


.. py:class:: NoDiscreteStates

   Bases: :py:obj:`KModelDiscreteStates`


   Class indicating there are no model discrete states.


.. py:class:: NoContinuousStates

   Bases: :py:obj:`KModelContinuousStates`


   Class indicating there are no model continuous states.


.. py:data:: P

.. py:data:: Sc

.. py:data:: S

.. py:data:: C

.. py:class:: KModel(name: str, mm: Karana.Dynamics.ModelManager)

   Bases: :py:obj:`Generic`\ [\ :py:obj:`P`\ , :py:obj:`Sc`\ , :py:obj:`S`\ , :py:obj:`C`\ ], :py:obj:`PyKModelBase`


   Base class for all Python models.

   This is the base class for all Python models. To create a new model,
   simply create a class that derives from this one.

   If the model has parameters, then create a parameter class that derives from
   `KModelParams`. In addition, add

   ```
   params: MyDerivedParamClass
   ```

   as a class variable to ensure type-hinting works as intended.

   Users can override the pre/postDeriv, pre/postHop, and pre/PostModelStep
   to run model functions at various points throughout the dynamics. For details
   on these methods and models, see the model documentation.


   .. py:attribute:: params
      :type:  P


   .. py:attribute:: scratch
      :type:  Sc


   .. py:attribute:: discrete_states
      :type:  S


   .. py:attribute:: continuous_states
      :type:  C


   .. py:method:: isReady() -> bool

      Return True if the model's parameters are ready. False otherwise.



   .. py:method:: typeString() -> str

      Return the type string (class name) of the KModel.

      :returns: The class name of the KModel.
      :rtype: str



   .. py:method:: dumpString(prefix: str = '', options: Karana.Core.DumpOptionsBase | None = None) -> str

      Return information about the KModel as a string.

      :param prefix: A string to use as prefix for each output line.
      :type prefix: str
      :param options: Class with options to tailor the output
      :type options: _DumpOptionsBase | None

      :returns: Information about the KModel as a string.
      :rtype: str



.. py:class:: BaseKModel

   Bases: :py:obj:`Karana.Core.LockingBase`


   This BaseKModel serves as the base for all models. It implements
   common logic, methods, etc. for both C++ and Python models.
   Determining which methods have been overloaded is handled by the
   KModel classes. In C++ this is uses the curiously-recurring template
   pattern (CRTP) and in Python we use object attributes. See the
   :ref:`kmodels_sec` section for more discussion about the KModel class.


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: multibodyObjs() -> MultibodyObjs

      Return the multibody objects data structure

      :returns: The multibody data structure



   .. py:method:: stdDebugMsg(msg: str) -> None

      Print a standard debug message.

      This creates json with debug information and passes it to the debug
      logger.

      :param msg: The message to log.



.. py:class:: CppKModelContinuousStates

   Bases: :py:obj:`Karana.Core.Base`


   A base class for continuous model states. Derive from this and add any
   continuous states for your model.

   Override the isReady method to check whether the continuous states are
   set. Override the setX and getX to set and get the model continuous
   states. Whenever the number of continuous states changes (the length
   of the vector from getX changes), you MUST re-register the model.
   Neglecting to do so leads to undefined behavior. See the
   :ref:`kmodel_continuous_states_sec` section for more discussion about
   the KModel class.


   .. py:method:: getX() -> Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]

      Get the continuous model states.

      :returns: The continuous model states.



   .. py:method:: getdX() -> Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]

      Get the derivative of the continuous model states.

      :returns: The continuous model states' derivatives.



   .. py:method:: setX(x: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]) -> None

      Set the continuous model states.

      :param x: The new continuous model states.



.. py:class:: CppKModelDiscreteStates

   Bases: :py:obj:`Karana.Core.Base`


   A base class for discrete model states. Derive from this and add any
   parameters for your model. Override the isReady method to check
   whether the discrete states are set. See the
   :ref:`kmodel_discrete_states_sec` section for more discussion about
   the KModel class.


.. py:class:: CppKModelScratch

   Bases: :py:obj:`Karana.Core.Base`


.. py:class:: KModelContinuousStates(name: str)

   Bases: :py:obj:`CppKModelContinuousStates`


   A base class for continuous model states. Derive from this and add any
   continuous states for your model.

   Override the isReady method to check whether the continuous states are
   set. Override the setX and getX to set and get the model continuous
   states. Whenever the number of continuous states changes (the length
   of the vector from getX changes), you MUST re-register the model.
   Neglecting to do so leads to undefined behavior. See the
   :ref:`kmodel_continuous_states_sec` section for more discussion about
   the KModel class.


   .. py:method:: create(name: str) -> KModelContinuousStates
      :staticmethod:


      Constructor
      :param name: the continuous model states



.. py:class:: KModelDiscreteStates(name: str)

   Bases: :py:obj:`CppKModelDiscreteStates`


   A base class for discrete model states. Derive from this and add any
   parameters for your model. Override the isReady method to check
   whether the discrete states are set. See the
   :ref:`kmodel_discrete_states_sec` section for more discussion about
   the KModel class.


   .. py:method:: create(name: str) -> KModelDiscreteStates
      :staticmethod:


      Constructor
      :param name: the discrete model states



.. py:class:: KModelScratch(name: str)

   Bases: :py:obj:`CppKModelScratch`


   A scratchpad to store model information. This is primarily used for
   debugging purposes. See the :ref:`kmodel_scratch_sec` section for more
   discussion about the KModel class.


   .. py:method:: create(name: str) -> KModelScratch
      :staticmethod:


      Constructor
      :param name: the model scratch name



.. py:class:: MultibodyObjs

   .. py:property:: nodes
      :type: list[Karana.Dynamics.Node]


      list of physical nodes used by the model


   .. py:property:: physical_bodies
      :type: list[Karana.Dynamics.PhysicalBody]


      list of physical bodies  used by the model


   .. py:property:: physical_subhinges
      :type: list[Karana.Dynamics.PhysicalSubhinge]


      list of physical subhinges used by the model


   .. py:property:: subtrees
      :type: list[Karana.Dynamics.SubTree]


      list of non-multibody subtrees used by the model


.. py:class:: OutputUpdateType(*args, **kwds)

   Bases: :py:obj:`enum.Enum`


   Enum for to track where a KModel output was updated


   .. py:attribute:: POST_DERIV
      :type:  ClassVar[OutputUpdateType]


   .. py:attribute:: POST_HOP
      :type:  ClassVar[OutputUpdateType]


   .. py:attribute:: PRE_DERIV
      :type:  ClassVar[OutputUpdateType]


   .. py:attribute:: PRE_HOP
      :type:  ClassVar[OutputUpdateType]


.. py:class:: PyKModelBase(name: str, mm: Karana.Dynamics.ModelManager)

   Bases: :py:obj:`BaseKModel`


    KModel<T,P,Sc,S,C> uses the curiously recurring template pattern
    (CRTP) to determine what
   methods the derived class has, and make the appropriate calls. All C++
   models should derive from this. Python models will have a different
   class to derive from. See the :ref:`kmodels_sec` section for more
   discussion about the KModel class.


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager) -> PyKModelBase
      :staticmethod:



   .. py:method:: dumpString(prefix: str, options: Karana.Core.DumpOptionsBase = None) -> str

      Return a string with the current model information.

      :param prefix: The prefix to use in front of each line in the dump string.
      :type prefix: str
      :param options: The options used to create the dump string.
      :type options: BaseDumpOptions

      :returns: A string representing the current model information.
      :rtype: str



   .. py:method:: getPeriod() -> numpy.timedelta64

      If a nextModelStepTime method exists, then this returns a warning. A
      model period and nextModelStepTime cannot both be defined for a model.
      :returns: The model's period.



   .. py:method:: nextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      The model_period defines the period at which the model runs. There are a few cases to consider:
        1. The period is 0 and no nextModelStepTime method is defined. In this case, the pre/postModelStep methods
           will run every time a simulation hop happens.
        2. The period is non-zero. In this case, the pre/postModelStep methods will run at the specified period.
        3. The period is 0 and a nextModelStepTime method is defined. In this case, the nextModelStepTime defines
           when these methods will run.

      :param t: The current time.
      :type t: KTime

      :returns: The next time this model should run.
      :rtype: KTime



   .. py:method:: postDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The postDeriv method runs after the multibody derivative.



   .. py:method:: postHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The postHop runs after each simulation hop.



   .. py:method:: postModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The postModelStep runs after the model's step. See nextModelStepTime for information on when this happens.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The preDeriv method runs before the multibody derivative.



   .. py:method:: preHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The preHop runs before each simulation hop.



   .. py:method:: preModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      The preModelStep runs before the model's step. See nextModelStepTime for information on when this happens.



   .. py:method:: setPeriod(arg0: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      The model_period defines the period at which the model runs. There are
      a few cases to consider:
             1. The period is 0 and no nextModelStepTime method is defined.
                In this case, the
      begin/postModelStep methods will run every time a simulation hop
      happens.
             2. The period is non-zero. In this case, the
                begin/postModelStep methods will run
      at the specified period.
             3. The period is 0 and a nextModelStepTime method is defined.
                In this case, the
      nextModelStepTime defines when these methods will run. A model period
      and nextModelStepTime cannot both be defined for a model. If one tries
      to set a model period for a model which has a nextModelStepTime, then
      an error will be thrown.
      :param t:
                - The new model period.



.. py:class:: ArrayVecProfileGeneratorVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   Vars for the ProfileGenerator class.

   Template Args:
       T: The numeric type used in the ProfileGenerator.


   .. py:method:: getQ(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarVec

      Get a Var that gives the Q value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getU(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarVec

      Get a Var that gives the U value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getUdot(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarVec

      Get a Var that gives the Udot value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



.. py:class:: ComputedTorque(name: str, mm: Karana.Dynamics.ModelManager, st: Karana.Dynamics.SubTree, set_accels_fn: collections.abc.Callable[[SupportsFloat | SupportsIndex | numpy.timedelta64, Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]], None])

   Bases: :py:obj:`ComputedTorqueKModel`


   Limits the generalized force that can be applied to a subhinge.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, st: Karana.Dynamics.SubTree, set_accels_fn: collections.abc.Callable[[SupportsFloat | SupportsIndex | numpy.timedelta64, Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]], None]) -> ComputedTorque
      :staticmethod:


      Constructor.

      The user-supplied set_accels_fn should set the accelerations on the
      provided SubGraph. Then, the model uses Algorithms.evalComputedTorque
      to calculate the corresponding torques and apply them to the SubTree.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param st: The SubTree to apply the torques to.
      :param set_accels_fn: The function that sets the accelerations for the
                            computed torque to compute torques for.

      :returns: A ks_ptr to the newly created instance of the ComputedTorque
                model.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the torques.

      :param t: Current time. This is passed to the user-supplied
                set_accels_fn.
      :param x: Current state. This is passed to the user-supplied
                set_accels_fn.



.. py:class:: ComputedTorqueKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: DataLogger(name: str, mm: Karana.Dynamics.ModelManager, h5_writer: Karana.KUtils._KUtils_pybind11_Py.H5Writer)

   Bases: :py:obj:`DataLoggerKModel`


   The DataLogger model updates the visualization at each postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, h5_writer: Karana.KUtils._KUtils_pybind11_Py.H5Writer) -> DataLogger
      :staticmethod:


      Constructor.

      :param name: The name of the DataLogger model.
      :param mm: The ModelManager to register this model with.
      :param h5_writer: The H5Writer to use for logging.

      :returns: A ks_ptr to the newly created instance of the DataLogger model.



   .. py:method:: getH5Writer() -> Karana.KUtils._KUtils_pybind11_Py.H5Writer

      Get the H5Writer used by the model.

      This can be used to enable/disable various tables of the H5Writer.

      :returns: The H5Write that this model uses for logging.



   .. py:method:: postModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Perform data logging.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



.. py:class:: DataLoggerKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  DataLoggerParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: DataLoggerParams

   Parameters for the DataLogger model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: log_first_step
      :type: bool


      If true, then log the first step.


.. py:class:: DataPlotter(name: str, mm: Karana.Dynamics.ModelManager, plot_data: Karana.KUtils._KUtils_pybind11_Py.PlotData)

   Bases: :py:obj:`DataPlotterKModel`


   The DataPlotter model updates the visualization at each postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, plot_data: Karana.KUtils._KUtils_pybind11_Py.PlotData) -> DataPlotter
      :staticmethod:


      Constructor.

      :param name: The name of the DataPlotter model.
      :param mm: The ModelManager to register this model with.
      :param plot_data: The PlotData to use for updating plots.

      :returns: A ks_ptr to the newly created instance of the DataPlotter model.



   .. py:method:: getPlotData() -> Karana.KUtils._KUtils_pybind11_Py.PlotData

      Get the H5Writer used by the model.

      This can be used to enable/disable various tables of the H5Writer.

      :returns: The H5Write that this model uses for logging.



   .. py:method:: postModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Perform data logging.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



.. py:class:: DataPlotterKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  DataPlotterParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: DataPlotterParams

   Parameters for the DataPlotter model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: log_first_step
      :type: bool


      If true, then log the first step.


.. py:class:: FloatConstantProfileGenerator(name: str, q: SupportsFloat | SupportsIndex)

   Bases: :py:obj:`_FloatProfileGenerator`


   A simple constant profile generator.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, q: SupportsFloat | SupportsIndex) -> FloatConstantProfileGenerator
      :staticmethod:


      ConstantProfileGenerator constructor.

      :param name: The name of the ConstantProfileGenerator.
      :param q: The coordinate of the ConstantProfileGenerator.

      :returns: A pointer to the newly created instance of
                ConstantProfileGenerator.



   .. py:property:: q
      :type: float


      The coordinate for constant interpolation


.. py:class:: FloatCubicSplineProfileGenerator(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: SupportsFloat | SupportsIndex, u_i: SupportsFloat | SupportsIndex, t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: SupportsFloat | SupportsIndex, u_f: SupportsFloat | SupportsIndex)

   Bases: :py:obj:`_FloatProfileGenerator`


   A simple cubic spline profile generator.

   This does cubic interpolation between (t_i,q_i,u_i) and (t_f,q_f,u_f).
   Times provided outside the given range, less than t_i or greater than
   t_f, will yield q_i and q_f, respectively.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: SupportsFloat | SupportsIndex, u_i: SupportsFloat | SupportsIndex, t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: SupportsFloat | SupportsIndex, u_f: SupportsFloat | SupportsIndex) -> FloatCubicSplineProfileGenerator
      :staticmethod:


      CubicSplineProfileGenerator constructor.

      :param name: The name of the CubicSplineProfileGenerator.
      :param t_i: Time associated with q_i
      :param q_i: The starting coordinate
      :param u_i: The starting velocity
      :param t_f: Time associated with q_f
      :param q_f: The ending coordinate
      :param u_f: The ending velocity

      :returns: A pointer to the newly created instance of
                CubicSplineProfileGenerator.



   .. py:method:: setValues(t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: SupportsFloat | SupportsIndex, u_i: SupportsFloat | SupportsIndex, t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: SupportsFloat | SupportsIndex, u_f: SupportsFloat | SupportsIndex) -> None

      Set the starting/ending coordinates and calculate constants

      :param t_i: Time associated with q_i.
      :param q_i: The starting coordinate.
      :param u_i: The starting velocity.
      :param t_f: Time associated with q_f.
      :param q_f: The ending coordinate.
      :param u_f: The ending velocity.



.. py:class:: FloatLinearProfileGenerator(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: SupportsFloat | SupportsIndex, t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: SupportsFloat | SupportsIndex)

   Bases: :py:obj:`_FloatProfileGenerator`


   A simple linear profile generator.

   This does linear interpolation between (t_i,q_i) and (t_f,q_f). Times
   provided outside the given range, less than t_i or greater than t_f,
   will yield q_i and q_f, respectively.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: SupportsFloat | SupportsIndex, t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: SupportsFloat | SupportsIndex) -> FloatLinearProfileGenerator
      :staticmethod:


      LinearProfileGenerator constructor.

      :param name: The name of the LinearProfileGenerator.
      :param t_i: Time associated with q_i
      :param q_i: The starting coordinate for linear interpolation
      :param t_f: Time associated with q_f
      :param q_f: The ending coordinate for linear interpolation

      :returns: A pointer to the newly created instance of LinearProfileGenerator.



   .. py:property:: q_f
      :type: float


      The ending coordinate for linear interpolation


   .. py:property:: q_i
      :type: float


      The starting coordinate for linear interpolation


   .. py:property:: t_f
      :type: numpy.timedelta64


      Time associated with q_f


   .. py:property:: t_i
      :type: numpy.timedelta64


      Time associated with q_i


.. py:class:: FloatProfileGeneratorVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   Vars for the ProfileGenerator class.

   Template Args:
       T: The numeric type used in the ProfileGenerator.


   .. py:method:: getQ(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarDouble

      Get a Var that gives the Q value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getU(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarDouble

      Get a Var that gives the U value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getUdot(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarDouble

      Get a Var that gives the Udot value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



.. py:class:: GilRelease(name: str, mm: Karana.Dynamics.ModelManager)

   Bases: :py:obj:`GilReleaseKModel`


   Temporarily releases the GIL so that other threads can do Python work.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager) -> GilRelease
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.

      :returns: A ks_ptr to the newly created instance of the GilRelease model.



   .. py:method:: postHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Temporarily release the GIL so other threads can do work.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.GilReleaseDS

      Create a GilReleaseDS from this GilRelease model.

      :returns: * *GilReleaseDS*
                * *A GilReleaseDS instance with values set to match this model.*



.. py:class:: GilReleaseKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: GraphicalSceneMovie(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.ProxyScene)

   Bases: :py:obj:`GraphicalSceneMovieKModel`


   The GraphicalSceneMovie model updates the visualization at each
   postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.ProxyScene) -> GraphicalSceneMovie
      :staticmethod:


      Constructor.

      :param name: The name of the GraphicalSceneMovie model.
      :param mm: The ModelManager to register this model with.
      :param scene: The ProxyScene whose graphics() scene's frames will be
                    rendered to create a movie.

      :returns: A ks_ptr to the newly created instance of the GraphicalSceneMovie
                model.



   .. py:method:: getFfmpegCommand() -> str

      Get the ffmpeg command you should run to turn the images into a movie.

      :returns: The ffmpeg command you should run to turn the images into a movie
                as a string.



   .. py:method:: postModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Update the GraphicalScene.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



.. py:class:: GraphicalSceneMovieKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  GraphicalSceneMovieParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: GraphicalSceneMovieParams

   Parameters for the GraphicalSceneMovie model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: dir
      :type: str


      Directory where the renders will be saved.


   .. py:property:: filename_prefix
      :type: str


      Filename prefix for each individual file


   .. py:property:: render_first_frame
      :type: bool


      If true, then render the frame at the time this model is activated.


.. py:class:: Gravity(name: str, mm: Karana.Dynamics.ModelManager, gravity_interface: GravityInterface, st: Karana.Dynamics.SubTree)

   Bases: :py:obj:`GravityKModel`


   Apply uniform gravitational acceleration to each body in the provided
   multibody.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, gravity_interface: GravityInterface, st: Karana.Dynamics.SubTree) -> Gravity
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param gravity_interface: The GravityInterface used to compute gravity.
      :param st: The SubTree to apply uniform gravity to.

      :returns: A ks_ptr to the newly created instance of the Gravity model.



   .. py:method:: getGravityInterface() -> GravityInterface

      Get the gravity interface used by this KModel.

      :returns: The gravity interface used by this KModel.



   .. py:method:: getVars() -> GravityVars


   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the aerodynamic force.

      :param t: Current time.
      :param x: Current state. Not used.



.. py:class:: GravityInterface

   Bases: :py:obj:`Karana.Core.Base`


   Common GravityInterface used for computing gravity with various
   methods.


   .. py:method:: getGravity() -> GravityOutput

      Get the GravityOutput data.

      :returns: The GravityOutput data.



   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:method:: setGravity(g: Annotated[numpy.typing.ArrayLike, numpy.float64, [3, 1]], t: SupportsFloat | SupportsIndex | numpy.timedelta64, output_update_type: Karana.Models.OutputUpdateType) -> None

      Set the GravityOutput data.

      :param g: The acceleration due to gravity.
      :param t: The time this acceleration was calculated at.
      :param output_update_type: The type of update that updated the gravity.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.GravityInterfaceDS

      Create a GravityInterface from this GravityInterface model.

      :returns: * *GravityInterface*
                * *A GravityInterface instance with values set to match this model.*



.. py:class:: GravityKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.GravityDS

      Create a GravityDS from this Gravity model.

      :returns: * *GravityDS*
                * *A GravityDS instance with values set to match this model.*



.. py:class:: GravityOutput

   The output of a GravityInterface.


   .. py:attribute:: update_type
      :type:  Karana.Models.OutputUpdateType


   .. py:property:: g
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]



   .. py:property:: t
      :type: numpy.timedelta64



.. py:class:: GravityVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   The Vars for the Gravity class.


.. py:class:: PID(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.SubhingeBase, traj: _ArrayVecProfileGenerator)

   Bases: :py:obj:`PIDKModel`


   Simple PID controller model.


   .. py:attribute:: traj
      :type:  _ArrayVecProfileGenerator


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.SubhingeBase, traj: _ArrayVecProfileGenerator) -> PID
      :staticmethod:


      Constructor. The PID model adds force to a subhinge. The model uses
             the incoming function as the desired trajectory. The output of
             this function should be the desired Q values of the subhinge.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param sh: The Subhinge to apply the forces calculated by the PID
                 controller to.
      :param traj: A ProfileGenerator that defines the reference trajectory.

      :returns: A ks_ptr to the newly created instance of the PID model.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the output of the PID model to the subhinge.
      :param t: Current time.
      :param x: Current state. Not used.



   .. py:method:: preModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate the contribution of integral control.
      :param t: Current time.
      :param x: Current state. Not used.



.. py:class:: PIDKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  PIDParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: PIDParams

   Parameters for the PID model.


   .. py:method:: getVars() -> PIDParamsVars


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: kd
      :type: float


      Derivative gain


   .. py:property:: ki
      :type: float


      Integral gain


   .. py:property:: kp
      :type: float


      Proportional gain


.. py:class:: PIDParamsVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   The Vars for the PIDParams class.


   .. py:property:: kd
      :type: Karana.Core.VarDouble


      Derivative gain


   .. py:property:: ki
      :type: Karana.Core.VarDouble


      Integral gain


   .. py:property:: kp
      :type: Karana.Core.VarDouble


      Proportional gain


.. py:class:: PinJointLimits(name: str, mm: Karana.Dynamics.ModelManager, pin: Karana.Dynamics.PinSubhinge)

   Bases: :py:obj:`PinJointLimitsKModel`


   Model that adds joint limits to a pin hinge.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, pin: Karana.Dynamics.PinSubhinge) -> PinJointLimits
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param pin: The pin subhinge to apply joint limits to.

      :returns: A ks_ptr to the newly created instance of the PinJointLimits
                model.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the restoring force to mimic joint limits.
      :param t:
                - Current time. Not used.
      :param x:
                - Current state. Not used.



.. py:class:: PinJointLimitsKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  PinJointLimitsParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: PinJointLimitsParams

   Parameters for the PinJointLimits model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: d
      :type: float


      Damping constant for the restoring force


   .. py:property:: k
      :type: float


      Spring constant for the restoring force


   .. py:property:: lower_limit
      :type: float


      Pin joint lower limit


   .. py:property:: upper_limit
      :type: float


      Pin joint upper limit


.. py:class:: PointMassGravity(name: str, st: Karana.Dynamics.SubTree, central_body: Karana.Frame.Frame)

   Bases: :py:obj:`GravityInterface`


   A GravityInterface implementation for point-mass gravity.


   .. py:method:: create(name: str, st: Karana.Dynamics.SubTree, central_body: Karana.Frame.Frame) -> PointMassGravity
      :staticmethod:


      Constructor.

      :param name: The name of the PointMassGravity interface.
      :param st: The SubTree to get the center of mass from.
      :param central_body: The point mass central body applying the
                           gravitational force

      :returns: A pointer to the newly created instance of PointMassGravity.



   .. py:method:: __deepcopy__(arg0: Any) -> PointMassGravity


   .. py:method:: getObjIds() -> Annotated[list[int], FixedSize(2)]

      Get the IDs of the SubTree and central body used
             by this PointMassGravity.

      :returns: The IDs of the SubTree and central body used by this
                PointMassGravity.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.PointMassGravityDS

      Create a PointMassGravityDS from this PointMassGravity model.

      :returns: * *PointMassGravityDS*
                * *A PointMassGravityDS instance with values set to match this model.*



   .. py:property:: mu
      :type: float


      m^3/(kg s^2) )

      :type: Gravitational constant (units


.. py:class:: ProjectConstraintError(name: str, mm: Karana.Dynamics.ModelManager, sg: Karana.Dynamics.SubGraph, cks: Karana.Dynamics.ConstraintKinematicsSolver)

   Bases: :py:obj:`ProjectConstraintErrorKModel`


   The ProjectConstraintError model updates the visualization at each
   postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, sg: Karana.Dynamics.SubGraph, cks: Karana.Dynamics.ConstraintKinematicsSolver) -> ProjectConstraintError
      :staticmethod:


      Constructor.

      :param name: The name of the ProjectConstraintError model.
      :param mm: The ModelManager to register this model with.
      :param sg: The SubGraph whose coordinates will be projected.
      :param cks: The ConstraintKinematicsSolver used to do the projection.

      :returns: A ks_ptr to the newly created instance of the
                ProjectConstraintError model.



   .. py:method:: postModelStep(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Project the coordinates to satisfy the constraints if the current
      error is larger
             than the tolerance.

      :param t: Current time. Unused.
      :param x: Current state. Unused.



.. py:class:: ProjectConstraintErrorKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  ProjectConstraintErrorParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: ProjectConstraintErrorParams

   Parameters for the ProjectConstraintError model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: tol
      :type: float


      Directory where the renders will be saved.


.. py:class:: SpringDamper(name: str, mm: Karana.Dynamics.ModelManager, nd1: Karana.Dynamics.Node, nd2: Karana.Dynamics.Node)

   Bases: :py:obj:`SpringDamperKModel`


   Adds a spring-damper between two nodes.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, nd1: Karana.Dynamics.Node, nd2: Karana.Dynamics.Node) -> SpringDamper
      :staticmethod:


      Constructor. The SpringDamper model applies an equal and opposing
      force to two nodes based on their current distance apart.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param nd1: The first node in the spring damper model.
      :param nd2: The second node in the spring damper model.

      :returns: A ks_ptr to the newly created instance of the SpringDamper model.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the spring/damper force.
      :param t: Current time. Not used.
      :param x: Current state. Not used.



   .. py:method:: sourceNode() -> Karana.Dynamics.Node

      Get the first node of the spring-damper

      :returns: The node



   .. py:method:: targetNode() -> Karana.Dynamics.Node

      Get the second node of the spring-damper

      :returns: The node



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.SpringDamperDS

      Create a SpringDamperDS from this SpringDamper model.

      :returns: * *SpringDamperDS*
                * *A SpringDamperDS instance with values set to match this model.*



.. py:class:: SpringDamperKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  SpringDamperParams


   .. py:attribute:: scratch
      :type:  SpringDamperScratch


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: SpringDamperParams

   Parameters for the SpringDamper model.


   .. py:method:: getVars() -> SpringDamperParamsVars


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: d
      :type: float


      Damper constant


   .. py:property:: k
      :type: float


      Spring constant


   .. py:property:: unsprung_length
      :type: float


      Unsprung length


.. py:class:: SpringDamperParamsVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   The Vars for the SpringDamperParams class.


   .. py:property:: d
      :type: Karana.Core.VarDouble


      Damper constant


   .. py:property:: k
      :type: Karana.Core.VarDouble


      Spring constant


   .. py:property:: unsprung_length
      :type: Karana.Core.VarDouble


      Unsprung length


.. py:class:: SpringDamperScratch

   Scratch variables for the SpringDamper model.


   .. py:method:: getVars() -> SpringDamperScratchVars


   .. py:property:: damping_force
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]


      Linear force due to spring damping


   .. py:property:: offset
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]


      Translation from node1 to node2


   .. py:property:: position_error
      :type: float


      Signed length offset from the unsprung length


   .. py:property:: stiffness_force
      :type: float


      Signed scalar force due to spring stiffness


   .. py:property:: total_force
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]


      Total linear spring force


   .. py:property:: velocity_error
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]


      Relative linear velocity across the spring


.. py:class:: SpringDamperScratchVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   The Vars for the SpringDamperScratch class.


   .. py:property:: damping_force
      :type: Karana.Core.VarVec3


      Linear force due to spring damping


   .. py:property:: offset
      :type: Karana.Core.VarVec3


      Translation from node1 to node2


   .. py:property:: position_error
      :type: Karana.Core.VarDouble


      Signed length offset from the unsprung length


   .. py:property:: stiffness_force
      :type: Karana.Core.VarDouble


      Signed scalar force due to spring stiffness


   .. py:property:: total_force
      :type: Karana.Core.VarVec3


      Total linear spring force


   .. py:property:: velocity_error
      :type: Karana.Core.VarVec3


      Relative linear velocity across the spring


.. py:class:: SubhingeForceLimits(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.PhysicalSubhinge)

   Bases: :py:obj:`SubhingeForceLimitsKModel`


   Limits the generalized force that can be applied to a subhinge.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.PhysicalSubhinge) -> SubhingeForceLimits
      :staticmethod:


      Constructor. The SubhingeForceLimits models actuator saturation limits
      for a subhinge. This clamps the generalized force of the subhinge
      using a lower bound and upper bound defined by lower_limits and
      upper_limits in the param.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param sh: The subhinge to add the force limits to.

      :returns: A ks_ptr to the newly created instance of the SubhingeForceLimits
                model.



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the spring/damper force.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



.. py:class:: SubhingeForceLimitsKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  SubhingeForceLimitsParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: SubhingeForceLimitsParams

   Parameters for the SubhingeForceLimits model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: lower_limits
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      Lower bound for the force limit


   .. py:property:: upper_limits
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      Upper bound for the force limit


.. py:class:: SubhingeSpringDamper(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.PhysicalSubhinge)

   Bases: :py:obj:`SubhingeSpringDamperKModel`


   Adds a spring damper to the provided subhinge.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, sh: Karana.Dynamics.PhysicalSubhinge) -> SubhingeSpringDamper
      :staticmethod:


      Constructor. The SubhingeSpringDamper model a spring damper force to a
      subhinge
             based on a given setpoint.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param sh: The subhinge to add the spring damper to.

      :returns: A ks_ptr to the newly created instance of the SubhingeSpringDamper
                model.



   .. py:method:: getSubhinge() -> Karana.Dynamics.PhysicalSubhinge

      Get the Subhinge used by this model.
      :returns: the physical subhinge being used by the model



   .. py:method:: preDeriv(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Calculate and apply the spring/damper force.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.SubhingeSpringDamperDS

      Create a SubhingeSpringDamperDS from this SubhingeSpringDamper model.

      :returns: * *SubhingeSpringDamperDS*
                * *A SubhingeSpringDamperDS instance with values set to match this model.*



.. py:class:: SubhingeSpringDamperKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  SubhingeSpringDamperParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: SubhingeSpringDamperParams

   Parameters for the SubhingeSpringDamper model.


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: d
      :type: float


      Damper constant


   .. py:property:: k
      :type: float


      Spring constant


   .. py:property:: setpoint
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      Setpoint for the subhinge


.. py:class:: SyncRealTime(name: str, mm: Karana.Dynamics.ModelManager, rt_speed: SupportsFloat | SupportsIndex = 1.0)

   Bases: :py:obj:`SyncRealTimeKModel`


   Limits sim speed to a multiple of real time.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, rt_speed: SupportsFloat | SupportsIndex = 1.0) -> SyncRealTime
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param rt_speed: The multiple of real time to limit to.

      :returns: A ks_ptr to the newly created instance of the SyncRealTime model.



   .. py:method:: getRealTimeSpeed() -> float

      Get the multiple of real-time speed this SyncRealTime model is using.

      :returns: The multiple of real-time speed this SyncRealTime model is using.



   .. py:method:: postHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Sleep as needed to sync to real time.

      :param t: Current time.
      :param x: Current state. Not used.



   .. py:method:: preHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Record the start-hop time.

      :param t: Current time.
      :param x: Current state. Not used.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.SyncRealTimeDS

      Create a SyncRealTimeDS from this SyncRealTime model.

      :returns: * *SyncRealTimeDS*
                * *A SyncRealTimeDS instance with values set to match this model.*



.. py:class:: SyncRealTimeKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: TimeDisplay(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.GraphicalScene)

   Bases: :py:obj:`TimeDisplayKModel`


   The TimeDisplay model updates the visualization at each postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.GraphicalScene) -> TimeDisplay
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param scene: The GraphicalScene to display the time in.

      :returns: A ks_ptr to the newly created instance of the TimeDisplay model.



   .. py:method:: postHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Update the time display

      :param t: Current time. Not used.
      :param x: Current state. Not used.



.. py:class:: TimeDisplayKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:attribute:: params
      :type:  TimeDisplayParams


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: TimeDisplayParams

   Parameters for the TimeDisplay KModel.


   .. py:method:: getVars() -> TimeDisplayParamsVars


   .. py:method:: isReady() -> bool

      Used to ensure the params are ready.

      :returns: `true` if the params are ready, `false` otherwise.



   .. py:property:: color
      :type: Karana.Scene.Color


      Color of the time text


.. py:class:: TimeDisplayParamsVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   The Vars for the TimeDisplayParams class.


   .. py:property:: color
      :type: Karana.Core.VarVec


      Color of the time text


.. py:class:: UniformGravity(name: str)

   Bases: :py:obj:`GravityInterface`


   A GravityInterface implementation for uniform gravity.


   .. py:method:: create(name: str) -> UniformGravity
      :staticmethod:


      Constructor.

      :param name: The name of the UniformGravity interface.

      :returns: A pointer to the newly created instance of UniformGravity.



   .. py:method:: __deepcopy__(arg0: Any) -> UniformGravity


   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.UniformGravityDS

      Create a UniformGravityDS from this UniformGravity model.

      :returns: * *UniformGravityDS*
                * *A UniformGravityDS instance with values set to match this model.*



.. py:class:: UnitQuaternionConstantProfileGenerator(name: str, q: Karana.Math.UnitQuaternion)

   Bases: :py:obj:`_UnitQuaternionProfileGenerator`


   A simple constant profile generator.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, q: Karana.Math.UnitQuaternion) -> UnitQuaternionConstantProfileGenerator
      :staticmethod:


      ConstantProfileGenerator constructor.

      :param name: The name of the ConstantProfileGenerator.
      :param q: The coordinate of the ConstantProfileGenerator.

      :returns: A pointer to the newly created instance of
                ConstantProfileGenerator.



   .. py:property:: q
      :type: Karana.Math.UnitQuaternion


      The coordinate for constant interpolation


.. py:class:: UnitQuaternionProfileGeneratorVars

   Bases: :py:obj:`Karana.Core.BaseVars`


   Vars for the ProfileGenerator class.

   Template Args:
       T: The numeric type used in the ProfileGenerator.


   .. py:method:: getQ(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarUnitQuaternion

      Get a Var that gives the Q value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getU(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarUnitQuaternion

      Get a Var that gives the U value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



   .. py:method:: getUdot(mm: Karana.Dynamics.ModelManager) -> Karana.Core.VarUnitQuaternion

      Get a Var that gives the Udot value of this ProfileGenerator at the
      provided ModelManager's current time.

      :param mm: The ModelManager to use to get time from.

      :returns: A Var that gives the Q value of this ProfileGenerator at the
                provided ModelManager's current time.



.. py:class:: UpdateProxyScene(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.ProxyScene)

   Bases: :py:obj:`UpdateProxySceneKModel`


   The UpdateProxyScene model updates the visualization at each postHop.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, scene: Karana.Scene.ProxyScene) -> UpdateProxyScene
      :staticmethod:


      Constructor.

      :param name: The name of the model.
      :param mm: The ModelManager to register this model with.
      :param scene: The ProxyScene to call update on.

      :returns: A ks_ptr to the newly created instance of the UpdateProxyScene
                model.



   .. py:method:: getProxyScene() -> Karana.Scene.ProxyScene

      Get the ProxyScene that this model is updating.

      :returns: The ProxyScene that this model is updating.



   .. py:method:: postHop(t: SupportsFloat | SupportsIndex | numpy.timedelta64, x: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Update the ProxyScene.

      :param t: Current time. Not used.
      :param x: Current state. Not used.



   .. py:method:: toDS() -> Karana.Models.GeneralKModels_types.UpdateProxySceneDS

      Create a UpdateProxySceneDS from this UpdateProxyScene model.

      :returns: * *UpdateProxySceneDS*
                * *A UpdateProxySceneDS instance with values set to match this model.*



.. py:class:: UpdateProxySceneKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



.. py:class:: VecConstantProfileGenerator(name: str, q: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]])

   Bases: :py:obj:`_ArrayVecProfileGenerator`


   A simple constant profile generator.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, q: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> VecConstantProfileGenerator
      :staticmethod:


      ConstantProfileGenerator constructor.

      :param name: The name of the ConstantProfileGenerator.
      :param q: The coordinate of the ConstantProfileGenerator.

      :returns: A pointer to the newly created instance of
                ConstantProfileGenerator.



   .. py:property:: q
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      The coordinate for constant interpolation


.. py:class:: VecCubicSplineProfileGenerator(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]])

   Bases: :py:obj:`_ArrayVecProfileGenerator`


   A simple cubic spline profile generator.

   This does cubic interpolation between (t_i,q_i,u_i) and (t_f,q_f,u_f).
   Times provided outside the given range, less than t_i or greater than
   t_f, will yield q_i and q_f, respectively.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> VecCubicSplineProfileGenerator
      :staticmethod:


      CubicSplineProfileGenerator constructor.

      :param name: The name of the CubicSplineProfileGenerator.
      :param t_i: Time associated with q_i
      :param q_i: The starting coordinate
      :param u_i: The starting velocity
      :param t_f: Time associated with q_f
      :param q_f: The ending coordinate
      :param u_f: The ending velocity

      :returns: A pointer to the newly created instance of
                CubicSplineProfileGenerator.



   .. py:method:: setValues(t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], u_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Set the starting/ending coordinates and calculate constants

      :param t_i: Time associated with q_i.
      :param q_i: The starting coordinate.
      :param u_i: The starting velocity.
      :param t_f: Time associated with q_f.
      :param q_f: The ending coordinate.
      :param u_f: The ending velocity.



.. py:class:: VecLinearProfileGenerator(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]])

   Bases: :py:obj:`_ArrayVecProfileGenerator`


   A simple linear profile generator.

   This does linear interpolation between (t_i,q_i) and (t_f,q_f). Times
   provided outside the given range, less than t_i or greater than t_f,
   will yield q_i and q_f, respectively.

   Template Args:
       T: The type of object to generate a profile for.


   .. py:method:: create(name: str, t_i: SupportsFloat | SupportsIndex | numpy.timedelta64, q_i: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]], t_f: SupportsFloat | SupportsIndex | numpy.timedelta64, q_f: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> VecLinearProfileGenerator
      :staticmethod:


      LinearProfileGenerator constructor.

      :param name: The name of the LinearProfileGenerator.
      :param t_i: Time associated with q_i
      :param q_i: The starting coordinate for linear interpolation
      :param t_f: Time associated with q_f
      :param q_f: The ending coordinate for linear interpolation

      :returns: A pointer to the newly created instance of LinearProfileGenerator.



   .. py:property:: q_f
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      The ending coordinate for linear interpolation


   .. py:property:: q_i
      :type: Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]


      The starting coordinate for linear interpolation


   .. py:property:: t_f
      :type: numpy.timedelta64


      Time associated with q_f


   .. py:property:: t_i
      :type: numpy.timedelta64


      Time associated with q_i


.. py:class:: PenaltyContact(name: str, mm: Karana.Dynamics.ModelManager, st: Karana.Dynamics.SubTree, colliders: collections.abc.Sequence[Karana.Collision.FrameCollider], default_contact_force_model: Karana.Collision.ContactForceBase)

   Bases: :py:obj:`PenaltyContactKModel`


   Model applying penalty contact forces to collisions from the provided
   FrameColliders.

   This model takes the provided FrameCollider(s) and passes their
   colliding pairs to the provided ContactForceBase to calculate and
   apply contact forces.

   See :ref:`collision_dynamics_sec` for more discussion on contact and
   collision dynamics.


   .. py:method:: create(name: str, mm: Karana.Dynamics.ModelManager, st: Karana.Dynamics.SubTree, colliders: collections.abc.Sequence[Karana.Collision.FrameCollider], default_contact_force_model: Karana.Collision.ContactForceBase) -> PenaltyContact
      :staticmethod:


      Create a PenaltyContact model.

      :param name:
                   - The name of the model.
      :param mm: The ModelManager to register this model with.
      :param st:
                 - The SubTree that this model is operating on.
      :param colliders:
                        - Helpers to generate body contacts.
      :param contact_force_model:
                                  - The model used for computing contact
                                  forces.

      :returns: The created PenaltyContact model.



   .. py:method:: getCacheContacts() -> bool

      Getter for the cache contact

      :returns: Whether we should cache all contacts or only the last.



   .. py:method:: getCachedNodePairs() -> list[tuple[Karana.Dynamics.Node, Karana.Dynamics.Node]]

      Get all pairs of nodes from the most recent contact.
      :returns: All node pairs (may be empty)



   .. py:method:: getContactForceModel() -> Karana.Collision.ContactForceBase

      Return the registered contact force model.

      :returns: The contact force model.



   .. py:method:: getFrameColliders() -> list[Karana.Collision.FrameCollider]

      Return the frame colliders.

      :returns: The frame colliders.



   .. py:method:: preDeriv(name: SupportsFloat | SupportsIndex | numpy.timedelta64, collider: Annotated[numpy.typing.ArrayLike, numpy.float64, [m, 1]]) -> None

      Apply penalty contact forces.

      :param t:
                - Current time. Not used.
      :param x:
                - Current state. Not used.



   .. py:method:: setCacheContacts(should_cache: bool) -> None

      Enable/disable caching of all contact pairs at every step for
      debugging.

      :param should_cache: Whether we should cache all contacts (defaults to
                           false).



   .. py:method:: toDS() -> Karana.Collision.Collision_types.PenaltyContactDS

      Create a PenaltyContactDS from this PenaltyContact model.

      :returns: * *PenaltyContactDS*
                * *A PenaltyContactDS instance with values set to match this model.*



.. py:class:: PenaltyContactKModel

   Bases: :py:obj:`Karana.Models.BaseKModel`


   .. py:attribute:: debug_model
      :type:  bool


   .. py:attribute:: model_manager
      :type:  Karana.Dynamics.ModelManager


   .. py:method:: getNextModelStepTime(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> numpy.timedelta64 | None

      Get the next step time assuming the provided time `t` is a time the model has a step at.

      :param t: A time the model has a step at.
      :type t: Ktime

      :returns: The next model step time.
      :rtype: Ktime



   .. py:method:: getPeriod() -> numpy.timedelta64

      Get the period of the model.

      If a `nextModelStepTime` method exists, this returns a warning. A model period and
      `nextModelStepTime` cannot both be defined for a model.

      :returns: The model's period.
      :rtype: Ktime



   .. py:method:: isReady() -> bool

      Checks whether the model is ready.

      :returns: Returns false if the params pointer is empty or if the parameters are not finalize. Returns true otherwise.
      :rtype: bool



   .. py:method:: setPeriod(t: SupportsFloat | SupportsIndex | numpy.timedelta64) -> None

      Set the model period.

      The model period defines the period at which the model runs. There are a few cases to consider:

      1. The period is 0 and no `nextModelStepTime` method is defined. In this case, the
         `preModelStep`/`postModelStep` methods will run every time a simulation hop happens.
      2. The period is non-zero. In this case, those methods will run at the specified period.
      3. The period is 0 and a `nextModelStepTime` method is defined. Then, that method defines when the
         steps will run.

      A model period and `nextModelStepTime` cannot both be defined for a model. An error will be
      thrown if a model with `nextModelStepTime` has its period set.

      :param t: The new model period.
      :type t: Ktime



