Kind & Element Names#
kind#
The kind field describes the semantic role of a tensor — what
physical quantity or command it represents. LEAPP provides two separate
enums for inputs and outputs to clearly distinguish between observed
state and commanded targets. kind may also be any plain string when
you need a custom semantic label.
InputKindEnum#
Used with input_tensors(). These represent
observed state or commanded references flowing into a node.
Enum value |
YAML string |
Description |
|---|---|---|
|
|
Observed joint positions (e.g. encoder readings) |
|
|
Observed joint velocities |
|
|
Observed joint effort |
|
|
Observed body pose |
|
|
Observed body position |
|
|
Observed body velocity |
|
|
Observed body acceleration |
|
|
Body linear acceleration (e.g. from IMU) |
|
|
Body linear velocity |
|
|
Body angular acceleration |
|
|
Body angular velocity (e.g. gyroscope) |
|
|
Body rotation / orientation |
|
|
Observed wrench values |
|
|
Generic 3D vector state |
|
|
Commanded joint position reference |
|
|
Commanded joint velocity reference |
|
|
Commanded body rotation reference |
|
|
Commanded body velocity reference |
|
|
Commanded body pose reference |
|
|
Commanded joint torques reference |
from leapp.utils.enums import InputKindEnum
TensorSemantics("joint_pos", tensor, kind=InputKindEnum.JOINT_POSITION)
TensorSemantics("imu_gyro", tensor,
kind=InputKindEnum.BODY_ANGULAR_VELOCITY)
TensorSemantics("target_pos", tensor,
kind=InputKindEnum.COMMAND_JOINT_POSITION)
# Custom string kinds are also allowed.
TensorSemantics("terrain_latent", tensor,
kind="state/environment/terrain_embedding")
OutputKindEnum#
Used with output_tensors(). These represent
target commands or control outputs produced by a node.
Enum value |
YAML string |
Description |
|---|---|---|
|
|
Proportional gain |
|
|
Derivative gain |
|
|
Target joint position |
|
|
Target joint velocity |
|
|
Target joint torques |
|
|
Target joint effort |
|
|
Target body position |
|
|
Target body linear acceleration |
|
|
Target body orientation |
|
|
Target body linear velocity |
|
|
Target body angular acceleration |
from leapp.utils.enums import OutputKindEnum
TensorSemantics("torques", action, kind=OutputKindEnum.JOINT_TORQUES)
TensorSemantics("kp_gains", kp, kind=OutputKindEnum.KP)
Note
LEAPP does not enforce using InputKindEnum only for inputs or
OutputKindEnum only for outputs, but it is strongly recommended to
follow this convention. The kind field accepts enum values and
plain strings.
element_names#
The element_names field provides human-readable names for the
elements along each dimension of a tensor. The canonical format is
list[list[str]], where the outer list corresponds to tensor
dimensions and each inner list names the elements in that dimension.
LEAPP also accepts several shorthand formats and normalizes them
automatically:
Input format |
Normalized to |
Use case |
|---|---|---|
|
|
Single named element |
|
|
Flat list — names for one dimension |
|
|
Already canonical — per-dimension names |
|
|
Partial — only name specific dimensions |
# Name elements along the last dimension.
TensorSemantics(
"joint_pos", tensor,
element_names=["hip", "knee", "ankle",
"shoulder", "elbow", "wrist"])
# Name elements per dimension (e.g. for a [batch, 3] tensor).
TensorSemantics(
"position", tensor,
element_names=[None, ["x", "y", "z"]])
# Name a single element.
TensorSemantics("gravity", tensor, element_names="z")
See Tensor Semantics Usage for general TensorSemantics usage patterns and
Temporal Semantics for temporal axis metadata.