reward ajustments
robot starts balancing without changing phase and farms alive bonus fix ->external force and bigger height penalty
This commit is contained in:
+27
-1
@@ -163,4 +163,30 @@ class SimManager:
|
||||
self.step()
|
||||
heights = self.measure_robot_heights(robot_ids)
|
||||
mean_height = float(np.mean(heights)) if heights else fallback_height
|
||||
return mean_height if mean_height > 0.0 else fallback_height
|
||||
return mean_height if mean_height > 0.0 else fallback_height
|
||||
|
||||
def apply_external_force(
|
||||
self,
|
||||
body_id: int,
|
||||
force: list[float] | np.ndarray,
|
||||
link_index: int = -1,
|
||||
position: list[float] | np.ndarray = (0.0, 0.0, 0.0),
|
||||
frame: int = p.WORLD_FRAME,
|
||||
):
|
||||
"""
|
||||
Applies a 3D force vector (in Newtons) to a robot link.
|
||||
|
||||
:param body_id: PyBullet body ID.
|
||||
:param force: [fx, fy, fz] force vector in Newtons.
|
||||
:param link_index: Target link index (-1 refers to the base/torso).
|
||||
:param position: Offset [x, y, z] relative to link center where force is applied.
|
||||
:param frame: p.WORLD_FRAME (global axes) or p.LINK_FRAME (robot's body axes).
|
||||
"""
|
||||
p.applyExternalForce(
|
||||
objectUniqueId=body_id,
|
||||
linkIndex=link_index,
|
||||
forceObj=list(force),
|
||||
posObj=list(position),
|
||||
flags=frame,
|
||||
physicsClientId=self.physics_client,
|
||||
)
|
||||
Reference in New Issue
Block a user