Skip to content

Commit

Permalink
First imprecise walking
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Dafarra committed Oct 17, 2023
1 parent 54f535d commit 23882e1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/hippopt/turnkey_planners/humanoid_walking_flat_ground/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import logging

import casadi as cs
import idyntree.bindings as idyntree
Expand Down Expand Up @@ -258,6 +259,8 @@ def compute_initial_state(

output_pf = pf_input.solve()

output_pf.values.state.centroidal_momentum = np.zeros((6, 1))

return output_pf.values.state


Expand Down Expand Up @@ -299,12 +302,12 @@ def compute_final_state(
number_of_joints=len(desired_joints),
)

pf_ref.state.com = np.array([0.0, 0.0, 0.7])
pf_ref.state.com = np.array([0.15, 0.0, 0.7])
desired_left_foot_pose = liecasadi.SE3.from_translation_and_rotation(
np.array([0.0, 0.1, 0.0]), liecasadi.SO3.Identity()
)
desired_right_foot_pose = liecasadi.SE3.from_translation_and_rotation(
np.array([0.0, -0.1, 0.0]), liecasadi.SO3.Identity()
np.array([0.3, -0.1, 0.0]), liecasadi.SO3.Identity()
)
pf_ref.state.contact_points.left = (
hp_rp.FootContactState.from_parent_frame_transform(
Expand Down Expand Up @@ -343,13 +346,16 @@ def get_references(
)

output_reference.contacts_centroid_cost_weights = [100, 100, 10]
output_reference.contacts_centroid = [0.0, 0.0, 0.0]
output_reference.contacts_centroid = [0.3, 0.0, 0.0]
output_reference.joint_regularization = desired_state.kinematics.joints.positions
output_reference.com_linear_velocity = [0.1, 0.0, 0.0]

return output_reference


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)

planner_settings = get_planner_settings()
planner = walking_planner.Planner(settings=planner_settings)

Expand Down Expand Up @@ -386,13 +392,13 @@ def get_references(

output = planner.solve()

humanoid_states = [s.to_humanoid_state() for s in output.values.system]
humanoid_states = [
s.to_humanoid_state(output.values.mass) for s in output.values.system
]

print("Press [Enter] to visualize the solution.")
input()

visualizer.visualize(
state=humanoid_states, timestep_s=output.values.dt, time_multiplier=10.0
state=humanoid_states, timestep_s=output.values.dt, time_multiplier=2.0
)

# TODO: Move to mass normalization

0 comments on commit 23882e1

Please sign in to comment.