Karana.KUtils.MultibodyTUI.swing#

Classes and functions used to swing a joint or constraint.

Attributes#

Classes#

SwingConfig

Configuration for controlling a swing.

SwingConfigMenuTUI

The top-level menu for configuring swing settings.

SwingModeTUI

TUI for controlling the swing mode.

AmplitudeDialog

Dialog for the swing amplitude.

StepSizeDialog

Dialog for the swing step size.

DeltaTDialog

Dialog for the swing delta_t.

KinMotion

Class for performing a kinematic motion on the multibody.

SwingManager

Manager for swing motions.

Module Contents#

Karana.KUtils.MultibodyTUI.swing.SwingModeOptions#
class Karana.KUtils.MultibodyTUI.swing.SwingConfig[source]#

Configuration for controlling a swing.

mode: SwingModeOptions = 'udot_pulse'#
amplitude: float = 0.4#
step_size: float = 0.1#
delta_t: float = 6.0#
render: bool = False#
class Karana.KUtils.MultibodyTUI.swing.SwingConfigMenuTUI(init_config: SwingConfig | None = None)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.MenuTUI

The top-level menu for configuring swing settings.

property config: SwingConfig | None#

Return the config for the swing.

Returns:

The swing config.

Return type:

SwingConfig | None

footer() list[str][source]#

Return the footer message to use.

Returns:

The footer message to use.

Return type:

list[str]

class Karana.KUtils.MultibodyTUI.swing.SwingModeTUI(mode: SwingModeOptions)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.ChoiceTUI

TUI for controlling the swing mode.

class Karana.KUtils.MultibodyTUI.swing.AmplitudeDialog(amplitude)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.EntryDialog

Dialog for the swing amplitude.

isValid() bool[source]#

Check if the user entry is a valid amplitude.

Returns:

True if this is a valid amplitude, False otherwise.

Return type:

bool

footer() list[str][source]#

Return the footer message.

Returns:

The footer message.

Return type:

list[str]

class Karana.KUtils.MultibodyTUI.swing.StepSizeDialog(step_size)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.EntryDialog

Dialog for the swing step size.

isValid() bool[source]#

Check if the user entry is a valid step size.

Returns:

True if the user entry is a valid step size, False otherwise.

Return type:

bool

footer() list[str][source]#

Return the footer message.

Returns:

The footer message.

Return type:

list[str]

class Karana.KUtils.MultibodyTUI.swing.DeltaTDialog(delta_t)[source]#

Bases: Karana.KUtils.MultibodyTUI.dialog.EntryDialog

Dialog for the swing delta_t.

isValid() bool[source]#

Check if the users delta_t is valid.

Returns:

True if the user’s delta_t is valid, False otherwise.

Return type:

bool

footer() list[str][source]#

Return the footer message.

Returns:

The footer message.

Return type:

list[str]

class Karana.KUtils.MultibodyTUI.swing.KinMotion(multibody: Karana.Dynamics.Multibody)[source]#

Class for performing a kinematic motion on the multibody.

__del__()[source]#

Delete this instance of KinMotion.

multibody#
delta_t = 6.0#
pulse_t = 0.75#
driven_subhinge = None#
subhinge_index = 0#
move_start_t = None#
A = None#
render = False#
gsm = None#
state_propagator#
dash_app#
getDashApp()[source]#

Get the DashApp.

Return type:

The DashApp.

move(subhinge: Karana.Dynamics.PhysicalSubhinge, amplitude: float, delta_t: float, render: bool, subhinge_index: int, step_size: float)[source]#

Move a subhinge through a motion.

Parameters:
  • subhinge (PhysicalSubhinge) – The subhinge to move.

  • amplitude (float) – The amplitude of the motion.

  • delta_t (float) – The time it takes the motion to complete.

  • render (bool) – Whether to render the motion or not.

  • subhinge_index (int) – The index of the subhinge.

  • step_size (float) – The step size to use for the motion.

class Karana.KUtils.MultibodyTUI.swing.SwingManager(multibody: Karana.Dynamics.Multibody, notify: Karana.KUtils.MultibodyTUI.notify.Notifier)[source]#

Manager for swing motions.

swingHinge(hinge: Karana.Dynamics.PhysicalHinge, mode: SwingModeOptions, amplitude: float, step_size: float, delta_t: float, render: bool, coord_offset: int)[source]#

Swing a hinge.

Parameters:
  • hinge (PhysicalHinge) – The hinge to swing.

  • mode (SwingModeOptions) – The mode used for the swing.

  • amplitude (float) – The amplitude of the swing.

  • step_size (float) – The step size for the swing.

  • delta_t (float) – The time taken to complete the swing.

  • render (bool) – Whether to render the swing or not.

  • coord_offset (int) – The coordinate offset of the value changing during the swing.

swingConvel(lc: Karana.Dynamics.LoopConstraintConVel, amplitude: float, delta_t: float, render: bool, step_size: float)[source]#

Swing a convel loop constraint.