Skip to content

Commit

Permalink
Added regularization of com position in pose finder
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Oct 4, 2023
1 parent 9bf8903 commit 86a50d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/hippopt/turnkey_planners/humanoid_pose_finder/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Settings:

base_quaternion_cost_multiplier: float = dataclasses.field(default=None)

com_regularization_cost_multiplier: float = dataclasses.field(default=None)

joint_regularization_cost_weights: np.ndarray = dataclasses.field(default=None)
joint_regularization_cost_multiplier: float = dataclasses.field(default=None)

Expand Down Expand Up @@ -61,6 +63,7 @@ def is_valid(self) -> bool:
and self.static_friction is not None
and self.maximum_joint_positions is not None
and self.minimum_joint_positions is not None
and self.com_regularization_cost_multiplier is not None
and self.base_quaternion_cost_multiplier is not None
and self.joint_regularization_cost_weights is not None
and self.joint_regularization_cost_multiplier is not None
Expand Down Expand Up @@ -320,6 +323,14 @@ def add_kinematics_regularization(self, function_inputs: dict):
scaling=self.settings.base_quaternion_cost_multiplier,
)

# Desired center of mass position
com_position_error = variables.state.com - variables.references.com
problem.add_cost(
expression=cs.sumsqr(com_position_error),
name="com_position_error",
scaling=self.settings.com_regularization_cost_multiplier,
)

# Desired joint positions
joint_positions_error = (
variables.state.kinematics.joints.positions
Expand Down

0 comments on commit 86a50d0

Please sign in to comment.