Optimization¶
Typed objective and constraint configs, contributions, and solver configuration.
ObjectiveConfig
¶
Bases: BaseModel
Base class for objective configs keyed by an extensible enum member.
Methods:
| Name | Description |
|---|---|
with_weight |
Return a copy with a different objective weight. |
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
|
|
kind |
ObjectiveKind
|
|
weight |
float
|
|
LaplacianObjectiveConfig
¶
Bases: ObjectiveConfig
Interaction-mesh Laplacian deformation objective.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
LinkTrackingObjectiveConfig
¶
Bases: ObjectiveConfig
Track robot links to a typed target plan.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
weight_scale |
float
|
|
Attributes¶
SmoothnessObjectiveConfig
¶
Bases: ObjectiveConfig
Penalize changes from the previous frame.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
Attributes¶
NominalTrackingObjectiveConfig
¶
Bases: ObjectiveConfig
Track a nominal posture for typed robot joints or explicit qpos coordinates.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
weight |
float
|
|
joints |
tuple[RobotJoint, ...]
|
|
qpos_indices |
tuple[int, ...]
|
|
fallback |
NominalFallback
|
|
Attributes¶
ConstraintConfig
¶
Bases: BaseModel
Base class for constraint configs keyed by an extensible enum member.
Methods:
| Name | Description |
|---|---|
with_enabled |
Return a copy with a different enabled state. |
disabled |
Return a disabled copy. |
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
|
|
kind |
ConstraintKind
|
|
enabled |
bool
|
|
JointLimitsConstraintConfig
¶
Bases: ConstraintConfig
Box limits on actuated joints.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
Attributes¶
TrustRegionConstraintConfig
¶
Bases: ConstraintConfig
Cap the Euclidean norm of each SQP update.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
radius |
float | None
|
|
Attributes¶
FootStickingConstraintConfig
¶
Bases: ConstraintConfig
Constrain active support links near their previous tangent-plane position.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
tolerance |
float
|
|
Attributes¶
FootLockConstraintConfig
¶
Bases: ConstraintConfig
Pin exact typed support links or subjects during configured windows.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
windows |
tuple[FootLockWindow, ...]
|
|
z_floor |
float
|
|
tolerance |
float
|
|
NonPenetrationConstraintConfig
¶
Bases: ConstraintConfig
Separate selected typed robot links from support and explicit geometry.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
links |
tuple[RobotLink, ...]
|
|
subjects |
tuple[ContactSubject, ...]
|
|
sources |
tuple[NonPenetrationSource, ...]
|
|
geometry_pairs |
tuple[GeometryPair, ...]
|
|
tolerance |
float
|
|
floor_z |
float
|
|
scene_clearance |
float
|
|
activation_distance |
float | None
|
|
Attributes¶
sources
class-attribute
instance-attribute
¶
sources: tuple[NonPenetrationSource, ...] = (SUPPORT, SCENE_POINTS, GEOMETRY)
SelfCollisionConstraintConfig
¶
Bases: ConstraintConfig
Maintain minimum separation between explicit typed robot geometry pairs.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
|
|
pairs |
tuple[GeometryPair, ...]
|
|
minimum_distance |
float
|
|
margin |
float | None
|
|
windows |
tuple[tuple[int, int], ...] | None
|
|
Attributes¶
OptimizationProfile
¶
Bases: BaseModel
Reusable typed objective/constraint composition.
Methods:
| Name | Description |
|---|---|
defaults |
Return default robot-only optimization terms. |
objective |
Return the last objective matching |
constraint |
Return the last constraint matching |
with_objective |
|
without_objective |
|
with_constraint |
|
without_constraint |
|
validate_registry_references |
|
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
|
|
name |
str
|
|
objectives |
tuple[ObjectiveConfig, ...]
|
|
constraints |
tuple[ConstraintConfig, ...]
|
|
provenance |
dict[str, object]
|
|
objective_kinds |
tuple[ObjectiveKind, ...]
|
Objective kinds in profile order. |
constraint_kinds |
tuple[ConstraintKind, ...]
|
Constraint kinds in profile order. |
Attributes¶
model_config
class-attribute
instance-attribute
¶
model_config = ConfigDict(arbitrary_types_allowed=True)
provenance
class-attribute
instance-attribute
¶
provenance: dict[str, object] = Field(default_factory=dict)
objective_kinds
property
¶
objective_kinds: tuple[ObjectiveKind, ...]
Objective kinds in profile order.
constraint_kinds
property
¶
constraint_kinds: tuple[ConstraintKind, ...]
Constraint kinds in profile order.
Functions¶
defaults
classmethod
¶
defaults(*, name: str = 'default') -> OptimizationProfile
Return default robot-only optimization terms.
objective
¶
objective(kind: ObjectiveKind) -> ObjectiveConfig | None
Return the last objective matching kind.
constraint
¶
constraint(kind: ConstraintKind) -> ConstraintConfig | None
Return the last constraint matching kind.
validate_registry_references
¶
validate_registry_references(solver: SolverSpec | None = None) -> None
SolverSpec
¶
Bases: BaseModel
Solver selection and common options.
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
|
|
backend |
SolverKind
|
|
max_iterations |
int
|
|
first_frame_iterations |
int | None
|
|
trust_radius |
float
|
|
tolerance |
float
|
|
convergence |
ConvergenceMode
|
|
cost_atol |
float
|
|
cost_rtol |
float
|
|
verbose |
bool
|
|
ObjectiveContribution
dataclass
¶
ObjectiveContribution(matrix: FloatArray, target: FloatArray)
ConstraintContribution
dataclass
¶
ConstraintContribution(
lower: FloatArray | None = None,
upper: FloatArray | None = None,
trust_radius: float | None = None,
linear_constraints: tuple[LinearConstraint, ...] = (),
)
Bounds and linear constraints from one constraint term.
Attributes:
| Name | Type | Description |
|---|---|---|
lower |
FloatArray | None
|
|
upper |
FloatArray | None
|
|
trust_radius |
float | None
|
|
linear_constraints |
tuple[LinearConstraint, ...]
|
|
TermContext
dataclass
¶
TermContext(
problem: AnyRetargetingProblem,
compiled: CompiledRetargetingProblem,
backend: KinematicsBackend,
q_current: FloatArray,
q_previous: FloatArray,
frame_idx: int,
contact_frame: CompiledContactFrame | None,
target_frame: CompiledTargetFrame | None,
robot_point_names: tuple[str, ...],
robot_points: FloatArray,
robot_jacobians: FloatArray,
environment_points: FloatArray,
adjacency: tuple[tuple[int, ...], ...],
target_laplacian: FloatArray,
laplacian_weighting: LaplacianWeighting,
laplacian_epsilon: float,
reference_pose: Pose | None,
joint_lower: FloatArray,
joint_upper: FloatArray,
current_joints: FloatArray,
variable_indices: NDArray[int64] | None = None,
current_variables: FloatArray | None = None,
variable_lower: FloatArray | None = None,
variable_upper: FloatArray | None = None,
nominal_qpos_frame: NominalQposFrame | None = None,
)
Per-frame data available to objective and constraint terms.
Terms operate on the actuated-joint increment for the current SQP subproblem. All point arrays and Jacobians are already represented in the local frame relevant to the current task, such as the object frame for dynamic object interaction.
Attributes:
| Name | Type | Description |
|---|---|---|
problem |
RetargetingProblem
|
Parent run specification. |
backend |
KinematicsBackend
|
Kinematics provider for positions and Jacobians. |
q_current |
FloatArray
|
Full |
q_previous |
FloatArray
|
|
frame_idx |
int
|
Zero-based index into the motion sequence. |
contact_frame |
ContactFrame | None
|
Typed contact view for the current frame, when configured. |
target_frame |
TargetFrame | None
|
Typed link-target view for the current frame, when configured. |
robot_point_names |
tuple[str, ...]
|
Link or joint names used for mesh matching. |
robot_points |
FloatArray
|
Robot match points in the task-local frame, shape |
robot_jacobians |
FloatArray
|
Position Jacobians w.r.t. active variables, shape |
environment_points |
FloatArray
|
Scene or object sample points, shape |
adjacency |
tuple[tuple[int, ...], ...]
|
Mesh neighbor indices per vertex. |
target_laplacian |
FloatArray
|
Desired Laplacian coordinates for the interaction mesh. |
laplacian_weighting |
LaplacianWeighting
|
Neighbor weighting used by the current mesh builder. |
laplacian_epsilon |
float
|
Epsilon used by distance-weighted Laplacians. |
reference_pose |
Pose | None
|
Object pose for dynamic scenes; |
joint_lower |
FloatArray
|
Actuated joint lower limits for the current robot. |
joint_upper |
FloatArray
|
Actuated joint upper limits for the current robot. |
current_joints |
FloatArray
|
Actuated joint values extracted from |
variable_indices |
NDArray[int64] | None
|
Qpos indices for active optimization variables. |
current_variables |
FloatArray | None
|
Active qpos values extracted from |
variable_lower |
FloatArray | None
|
Absolute lower bounds for active qpos variables. |
variable_upper |
FloatArray | None
|
Absolute upper bounds for active qpos variables. |
nominal_qpos_frame |
NominalQposFrame | None
|
Optional nominal qpos target view. |
Attributes¶
variable_indices
class-attribute
instance-attribute
¶
variable_indices: NDArray[int64] | None = None
nominal_qpos_frame
class-attribute
instance-attribute
¶
nominal_qpos_frame: NominalQposFrame | None = None
active_qpos_indices
property
¶
active_qpos_indices: NDArray[int64]
Qpos indices represented by the current subproblem variable.
current_variable_values
property
¶
current_variable_values: FloatArray
Current values of active qpos variables.
variable_lower_bounds
property
¶
variable_lower_bounds: FloatArray
Absolute lower bounds for active qpos variables.
variable_upper_bounds
property
¶
variable_upper_bounds: FloatArray
Absolute upper bounds for active qpos variables.