Joint

Description

Default class for joints, i.e. points in space at a specific timestamp. The methods in this class are mainly handled by the methods in the class Pose, but some of them can be directly accessed.

Initialisation

class classes.joint.Joint(joint_label=None, x=None, y=None, z=None)

Creates a Joint instance, with a joint label and x, y, and z coordinates.

New in version 2.0.

Parameters:
  • joint_label (str, optional) – The label of the joint (e.g. "Head").

  • x (float, optional) – The position of the joint on the x axis (in meters).

  • y (float, optional) – The position of the joint on the y axis (in meters).

  • z (float, optional) – The position of the joint on the z axis (in meters).

joint_label

The label of the joint (e.g. "Head").

Type:

str

x

The position of the joint on the x axis (in meters).

Type:

float

y

The position of the joint on the y axis (in meters).

Type:

float

z

The position of the joint on the z axis (in meters).

Type:

float

position

The coordinates of the joint, equivalent to [x, y, z].

Type:

list(float)

_has_velocity_over_threshold

Defines if the velocity of this joint, compared to the previous joint, has been found to be over threshold defined in the parameters Sequence.correct_jitter().

Type:

bool

_is_corrected

Defines if the coordinates of this joint have been modified by Sequence.correct_jitter(), Sequence.re_reference() or Sequence.correct_zeros().

Type:

bool

_is_randomized

Defines if the coordinates of this joint have been randomly generated by (typically, by Sequence.randomize()).

Type:

bool

Magic methods

Joint.__repr__()

Returns a string containing the joint label, the x, y ans z coordinates, and adds information if one or more of the private attributes _has_velocity_over_threshold, _is_corrected or _is_randomized are True.

Returns:

A formatted string of the information contained in all the attributes of the object.

Return type:

str

Examples

>>> sequence = Sequence("C:/Users/Adrian/Sequences/seq1/")
>>> joint = sequence.get_pose(4).get_joint("Head")
>>> print(joint)
Head: (4.8, 15.16, 23.42) CORRECTED
Joint.__eq__(other)

Returns True if the attributes x, y, z and joint_label are identical between the two Joint objects.

New in version 2.0.

Parameters:

other (Joint) – Another Joint object.

Public methods

Setter functions

Joint.set_joint_label(joint_label)

Sets the joint_label attribute of the joint.

New in version 2.0.

Parameters:

joint_label (str) – The label of the joint (e.g. "Head").

Joint.set_x(x)

Sets the x coordinate of the joint.

New in version 2.0.

Parameters:

x (float) – The position of the joint on the x axis.

Joint.set_y(y)

Sets the y coordinate of the joint.

New in version 2.0.

Parameters:

y (float) – The position of the joint on the y axis.

Joint.set_z(z)

Sets the z coordinate of the joint.

New in version 2.0.

Parameters:

z (float) – The position of the joint on the z axis.

Joint.set_position(x, y, z)

Sets the x, y and z coordinates of the joint.

New in version 2.0.

Parameters:
  • x (float) – The position of the joint on the x axis.

  • y (float) – The position of the joint on the y axis.

  • z (float) – The position of the joint on the z axis.

Joint.set_to_zero()

Sets the joints coordinates to (0, 0, 0).

New in version 2.0.

Getter functions

Joint.get_joint_label()

Returns the joint_label attribute.

New in version 2.0.

Returns:

The label of the joint (e.g. "Head").

Return type:

str

Joint.get_x()

Returns the x coordinate of the joint.

New in version 2.0.

Returns:

The x coordinate of the joint (in meters).

Return type:

float

Joint.get_y()

Returns the y coordinate of the joint.

New in version 2.0.

Returns:

The y coordinate of the joint (in meters).

Return type:

float

Joint.get_z()

Returns the z coordinate of the joint.

New in version 2.0.

Returns:

The z coordinate of the joint (in meters).

Return type:

float

Joint.get_position()

Returns a list containing the x, y and z coordinates of the joint.

New in version 2.0.

Returns:

The x coordinate of the joint (in meters).

Return type:

float

Joint.get_has_velocity_over_threshold()

Returns the value of the attribute _has_velocity_over_threshold, which will be True if the velocity of this joint, compared to the previous joint, has been found to be over threshold defined in the parameters of Sequence.correct_jitter().

New in version 2.0.

Returns:

Value of the attribute _has_velocity_over_threshold.

Return type:

bool

Joint.get_is_corrected()

Returns the value of the attribute _is_corrected, which will be True if the coordinates of this joint have been modified by Sequence.correct_jitter(), Sequence.re_reference() or Sequence.correct_zeros().

New in version 2.0.

Returns:

Value of the attribute _is_corrected.

Return type:

bool

Joint.get_is_randomized()

Returns the value of the attribute _is_randomized, which will be True if the coordinates of this joint have been randomly generated by Sequence.randomize().

New in version 2.0.

Returns:

Value of the attribute _is_randomized.

Return type:

bool

Joint.get_copy()

Returns a deep copy of itself.

New in version 2.0.

Returns:

A deep copy of the Joint instance.

Return type:

Joint

Rotation function

Joint.convert_rotation(yaw=0, pitch=0, roll=0)

Returns converted coordinates given three rotations: yaw, pitch and roll.

New in version 2.0.

Warning

This function is experimental as of version 2.0.

Parameters:
  • yaw (float, optional) – The angle of yaw, or rotation on the x axis, in degrees (default: 0).

  • pitch (float, optional) – The angle of pitch, or rotation on the y axis, in degrees (default: 0).

  • roll (float, optional) – The angle of roll, or rotation on the z axis, in degrees (default: 0).

Returns:

  • float – The converted x coordinate.

  • float – The converted y coordinate.

  • float – The converted z coordinate.

Private methods

Joint._correct_joint(x, y, z)

Assigns new x, y and z coordinates to the joint and marks it as corrected.

New in version 2.0.

Parameters:
  • x (float) – The position of the joint on the x axis.

  • y (float) – The position of the joint on the y axis.

  • z (float) – The position of the joint on the z axis.

Joint._randomize_coordinates_keep_movement(joint_pose_0, joint_random, verbosity=1)

Modifies the coordinates of the joint while keeping the relative position compared to the position of the joint at the beginning of the sequence. This function is used by .Sequence.randomize().

New in version 2.0.

Parameters:
  • joint_pose_0 (Joint) – The joint from the first pose of the sequence, with the same joint_label.

  • joint_random (Joint) – A joint with random coordinates, generated by Sequence.randomize()

  • verbosity (int, optional) –

    Sets how much feedback the code will provide in the console output:

    • 0: Silent mode. The code won’t provide any feedback, apart from error messages.

    • 1: Normal mode (default). The code will provide essential feedback such as progression markers and current steps.

    • 2: Chatty mode. The code will provide all possible information on the events happening. Note that this may clutter the output and slow down the execution.

Joint._set_has_velocity_over_threshold(has_velocity_over_threshold)

Sets the value of the attribute _has_velocity_over_threshold. This function is used by Sequence.correct_jitter().

New in version 2.0.

Parameters:

has_velocity_over_threshold (bool) – If True, the velocity of this joint, compared to the previous joint, has been found to be over threshold defined in the parameters of Sequence.correct_jitter().

Joint._set_is_corrected(is_corrected)

Sets the value of the attribute _is_corrected.

New in version 2.0.

Parameters:

is_corrected (bool) –

If True, the coordinates of this joint have been modified by Sequence.correct_jitter(),

Sequence.re_reference() or Sequence.correct_zeros().