Reworked training

new reward/penalty system
learning phases with curriculum learning
new training parameters
cleanup of old code
better logging while training
multiple environments instead of robots (they could bumb into each other)
This commit is contained in:
2026-08-03 22:27:26 +02:00
parent 5317ef1299
commit acb3d671be
8 changed files with 585 additions and 163 deletions
+16 -17
View File
@@ -34,30 +34,29 @@ class SimManager:
p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW, 0, physicsClientId=self.physics_client)
def load_scene(
self, urdf_path: str, num_robots: int, robot_spacing: float, base_pos_fn
self, urdf_path: str, robot_spacing: float, base_pos_fn
) -> Tuple[int, List[int], List[List[int]]]:
"""Loads plane and hexapod bodies into the simulation scene."""
"""Loads the plane and a single hexapod body into the simulation scene."""
plane_id = p.loadURDF("plane.urdf", physicsClientId=self.physics_client)
robots = []
robot_joint_indices = []
self.robot_joints.clear()
for r_id in range(num_robots):
base_pos = base_pos_fn(r_id, num_robots, robot_spacing)
robot = p.loadURDF(
urdf_path,
basePosition=base_pos,
useFixedBase=False,
physicsClientId=self.physics_client
)
robots.append(robot)
base_pos = base_pos_fn(0, robot_spacing)
robot = p.loadURDF(
urdf_path,
basePosition=base_pos,
useFixedBase=False,
physicsClientId=self.physics_client
)
robots.append(robot)
joint_indices = [
i for i in range(p.getNumJoints(robot, physicsClientId=self.physics_client))
if p.getJointInfo(robot, i, physicsClientId=self.physics_client)[2] == p.JOINT_REVOLUTE
]
robot_joint_indices.append(joint_indices)
self.robot_joints[robot] = joint_indices
joint_indices = [
i for i in range(p.getNumJoints(robot, physicsClientId=self.physics_client))
if p.getJointInfo(robot, i, physicsClientId=self.physics_client)[2] == p.JOINT_REVOLUTE
]
robot_joint_indices.append(joint_indices)
self.robot_joints[robot] = joint_indices
return plane_id, robots, robot_joint_indices