Karana.KUtils.MultibodyTUI.swing
================================

.. py:module:: Karana.KUtils.MultibodyTUI.swing

.. autoapi-nested-parse::

   Classes and functions used to swing a joint or constraint.



Attributes
----------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.swing.SwingModeOptions


Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.swing.SwingConfig
   Karana.KUtils.MultibodyTUI.swing.SwingConfigMenuTUI
   Karana.KUtils.MultibodyTUI.swing.SwingModeTUI
   Karana.KUtils.MultibodyTUI.swing.AmplitudeDialog
   Karana.KUtils.MultibodyTUI.swing.StepSizeDialog
   Karana.KUtils.MultibodyTUI.swing.DeltaTDialog
   Karana.KUtils.MultibodyTUI.swing.KinMotion
   Karana.KUtils.MultibodyTUI.swing.SwingManager


Module Contents
---------------

.. py:data:: SwingModeOptions

.. py:class:: SwingConfig

   Configuration for controlling a swing.


   .. py:attribute:: mode
      :type:  SwingModeOptions
      :value: 'udot_pulse'



   .. py:attribute:: amplitude
      :type:  float
      :value: 0.4



   .. py:attribute:: step_size
      :type:  float
      :value: 0.1



   .. py:attribute:: delta_t
      :type:  float
      :value: 6.0



   .. py:attribute:: render
      :type:  bool
      :value: False



.. py:class:: SwingConfigMenuTUI(init_config: SwingConfig | None = None)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.MenuTUI`


   The top-level menu for configuring swing settings.


   .. py:property:: config
      :type: SwingConfig | None


      Return the config for the swing.

      :returns: The swing config.
      :rtype: SwingConfig | None


   .. py:method:: footer() -> list[str]

      Return the footer message to use.

      :returns: The footer message to use.
      :rtype: list[str]



.. py:class:: SwingModeTUI(mode: SwingModeOptions)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.ChoiceTUI`


   TUI for controlling the swing mode.


.. py:class:: AmplitudeDialog(amplitude)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.EntryDialog`


   Dialog for the swing amplitude.


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

      Check if the user entry is a valid amplitude.

      :returns: True if this is a valid amplitude, False otherwise.
      :rtype: bool



   .. py:method:: footer() -> list[str]

      Return the footer message.

      :returns: The footer message.
      :rtype: list[str]



.. py:class:: StepSizeDialog(step_size)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.EntryDialog`


   Dialog for the swing step size.


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

      Check if the user entry is a valid step size.

      :returns: True if the user entry is a valid step size, False otherwise.
      :rtype: bool



   .. py:method:: footer() -> list[str]

      Return the footer message.

      :returns: The footer message.
      :rtype: list[str]



.. py:class:: DeltaTDialog(delta_t)

   Bases: :py:obj:`Karana.KUtils.MultibodyTUI.dialog.EntryDialog`


   Dialog for the swing delta_t.


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

      Check if the users delta_t is valid.

      :returns: True if the user's delta_t is valid, False otherwise.
      :rtype: bool



   .. py:method:: footer() -> list[str]

      Return the footer message.

      :returns: The footer message.
      :rtype: list[str]



.. py:class:: KinMotion(multibody: Karana.Dynamics.Multibody)

   Class for performing a kinematic motion on the multibody.


   .. py:method:: __del__()

      Delete this instance of KinMotion.



   .. py:attribute:: multibody


   .. py:attribute:: delta_t
      :value: 6.0



   .. py:attribute:: pulse_t
      :value: 0.75



   .. py:attribute:: driven_subhinge
      :value: None



   .. py:attribute:: subhinge_index
      :value: 0



   .. py:attribute:: move_start_t
      :value: None



   .. py:attribute:: A
      :value: None



   .. py:attribute:: render
      :value: False



   .. py:attribute:: gsm
      :value: None



   .. py:attribute:: state_propagator


   .. py:attribute:: dash_app


   .. py:method:: getDashApp()

      Get the DashApp.

      :rtype: The DashApp.



   .. py:method:: move(subhinge: Karana.Dynamics.PhysicalSubhinge, amplitude: float, delta_t: float, render: bool, subhinge_index: int, step_size: float)

      Move a subhinge through a motion.

      :param subhinge: The subhinge to move.
      :type subhinge: PhysicalSubhinge
      :param amplitude: The amplitude of the motion.
      :type amplitude: float
      :param delta_t: The time it takes the motion to complete.
      :type delta_t: float
      :param render: Whether to render the motion or not.
      :type render: bool
      :param subhinge_index: The index of the subhinge.
      :type subhinge_index: int
      :param step_size: The step size to use for the motion.
      :type step_size: float



.. py:class:: SwingManager(multibody: Karana.Dynamics.Multibody, notify: Karana.KUtils.MultibodyTUI.notify.Notifier)

   Manager for swing motions.


   .. py:method:: swingHinge(hinge: Karana.Dynamics.PhysicalHinge, mode: SwingModeOptions, amplitude: float, step_size: float, delta_t: float, render: bool, coord_offset: int)

      Swing a hinge.

      :param hinge: The hinge to swing.
      :type hinge: PhysicalHinge
      :param mode: The mode used for the swing.
      :type mode: SwingModeOptions
      :param amplitude: The amplitude of the swing.
      :type amplitude: float
      :param step_size: The step size for the swing.
      :type step_size: float
      :param delta_t: The time taken to complete the swing.
      :type delta_t: float
      :param render: Whether to render the swing or not.
      :type render: bool
      :param coord_offset: The coordinate offset of the value changing during the swing.
      :type coord_offset: int



   .. py:method:: swingConvel(lc: Karana.Dynamics.LoopConstraintConVel, amplitude: float, delta_t: float, render: bool, step_size: float)

      Swing a convel loop constraint.



