Skip to content

Sort Poses

SUMMARY

sort_poses sorts a list of poses by one or more positional axes (x, y, z), each ascending or descending.

UNITS

Sorting compares the raw x/y/z values of each pose, which are in meters. The rotation component is ignored.

The Skill

python
sorted_poses = tfutils.sort_poses(poses, by=["x", "y"], ascending=[True, False])

Parameter Configuration

ParameterTypeDefaultDescription
poseslist[list[float]]requiredPoses to sort, each [x, y, z, ...] in any rotation format.
bystr | list[str]"x"Sort key(s), each one of "x", "y", "z". A list sorts by multiple keys, first element has the highest priority.
ascendingbool | list[bool]TrueSort direction. A single bool applies to every key in by, or a list gives one direction per key.

Returns

TypeDescription
list[list[float]]A new list of poses, sorted.

Raises

ExceptionCondition
ValueErrorascending is a list whose length does not match by's.
ValueErrorA key in by is not one of "x", "y", "z".