Fix PrismaticJoint (trunk) control: IdealPDActuator with high stiffness
Replace ImplicitActuator (which doesn't work for prismatic joints) with IdealPDActuator. This bypasses PhysX drive and explicitly computes PD forces using set_dof_actuation_forces(). Changes: - stiffness=100k, damping=5k to resist arm reaction forces (~150N) with <2mm deflection - Read trunk_cmd from ArticulationCfg initial position (single source of truth) - Integrate trunk diagnostics into robot state output - Remove hardcoded trunk_target parameter
This commit is contained in:
@@ -21,9 +21,10 @@ class DiagnosticsReporter:
|
||||
jnames = robot.joint_names
|
||||
self._left_arm_idx = [i for i, n in enumerate(jnames) if n.startswith("l_joint")]
|
||||
self._right_arm_idx = [i for i, n in enumerate(jnames) if n.startswith("r_joint")]
|
||||
self._trunk_idx = jnames.index("PrismaticJoint") if "PrismaticJoint" in jnames else None
|
||||
|
||||
def report(self, env, obs, frame: int, last_act: np.ndarray | None = None,
|
||||
xr_client=None, read_gripper_contact=None):
|
||||
xr_client=None, read_gripper_contact=None, trunk_target: float | None = None):
|
||||
"""Print diagnostics if frame is on interval boundary."""
|
||||
if frame % self.interval != 0:
|
||||
return
|
||||
@@ -77,6 +78,12 @@ class DiagnosticsReporter:
|
||||
print(f"| Cmd right_arm(abs): {last_act[12:19]}")
|
||||
print(f"| Cmd right_gripper: {last_act[19:]} (+1=open -1=close)")
|
||||
print(f"| Joystick (x=turn,y=fwd): {joy_str}")
|
||||
if self._trunk_idx is not None:
|
||||
trunk_pos = robot.data.joint_pos[0, self._trunk_idx].item()
|
||||
trunk_vel = robot.data.joint_vel[0, self._trunk_idx].item()
|
||||
trunk_force = robot.data.applied_torque[0, self._trunk_idx].item() if hasattr(robot.data, 'applied_torque') else float('nan')
|
||||
trunk_tgt_str = f"{trunk_target:.4f}" if trunk_target is not None else "N/A"
|
||||
print(f"| Trunk pos={trunk_pos:.4f} vel={trunk_vel:.6f} target={trunk_tgt_str} force={trunk_force:.2f}")
|
||||
print(f"----------------------------------------------------------------")
|
||||
else:
|
||||
eef_pos = policy_obs["eef_pos"][0].cpu().numpy()
|
||||
|
||||
Reference in New Issue
Block a user