Model.mechadjustjoint#

Model.mechadjustjoint(name, direction, value, tolerance, lock, angle_step, hold_angles=1)#

Actuates a joint to reach a new value.

The mechanism must have the enabled flag set to true for this to be possible.

Parameters:
  • name (hwString) – The name of the joint to adjust.

  • direction (unsigned int) –

    The direction along which the new value will be applied:

    0 - Translation along x-axis

    1 - Translation along y-axis

    2 - Translation along z-axis

    3 - Rotation about x-axis

    4 - Rotation about y-axis

    5 - Rotation about z-axis

  • value (double) – The desired value of the joint.

  • tolerance (double) – The tolerance allowed when adjusting.

  • lock (unsigned int) – If set to 1, all joints in the mechanism which are not part of the cycle of the given joint are locked.

  • angle_step (double) – The size of the iterative steps used to solve for the new value of the joint. Only used for rotation.

  • hold_angles (unsigned int) – If set to 1, this locks the rotation about axes other than the given direction. If 0, rotation occurs in a way such that the given axis doesn’t move. In this case the Euler angles about other axes can change. This is only for ball joints.

Example#

Move a joint named “TORSO_to_RIGHT_UPPER_LEG” to x=20.0, y=0.0, z=0.0 with tolerance 0.001 , lock other joints and angle step = 0.0 :#
import hm
import hm.entities as ent

model = hm.Model()

model.mechadjustjoint(
    name="TORSO_to_RIGHT_UPPER_LEG",
    direction=0,
    value=20.0,
    tolerance=0.001,
    lock=1,
    angle_step=0.0,
)