Skip to content

Commit d1282da

Browse files
committed
Add a waist task similar to the working example
1 parent ff66932 commit d1282da

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

examples/example_5_tsid_com_shift.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
"""
2-
TSID torque-control example: fixed-feet COM tracking in PyBullet.
3-
4-
This is the first inverse-dynamics replacement for the IK loop in
5-
example_4_physics_simulation.py. Both feet stay rigidly constrained on the
6-
ground, and the COM reference is fixed for easier torque-control debugging.
7-
No foot swing, COM transfer, or contact switching is performed yet.
8-
"""
9-
101
import argparse
112
import math
123
from dataclasses import dataclass
@@ -243,7 +234,7 @@ def _add_foot_contacts(self):
243234
self.invdyn.addRigidContact(self.contact_right, w_force_reg, 1.0, 1)
244235

245236
def _add_com_task(self):
246-
kp_com = 40.0
237+
kp_com = 20.0
247238
kd_com = 2.0 * math.sqrt(kp_com)
248239
w_com = 1.0
249240

@@ -252,6 +243,16 @@ def _add_com_task(self):
252243
self.com_task.setKd(kd_com * np.ones(3))
253244
self.invdyn.addMotionTask(self.com_task, w_com, 1, 0.0)
254245

246+
def _add_waist_task(self):
247+
kp_waist = 500.0
248+
kd_waist = 2.0 * math.sqrt(kp_com)
249+
w_waist = 1.0
250+
251+
self.waist_task = tsid.TaskSE3Equality("task-waist", self.robot, "root_joint")
252+
self.waist_task.setKp(kp_waist * np.ones(6))
253+
self.waist_task.setKd(kd_waist * np.ones(3))
254+
self.invdyn.addMotionTask(self.waist_task, w_waist, 1, 0.0)
255+
255256
def _add_posture_task(self, q0: np.ndarray):
256257
kp_posture = 2.0
257258
kd_posture = 2.0 * math.sqrt(kp_posture)

0 commit comments

Comments
 (0)