From d0b2271d310a7c0dd849e9a570fcca6dc3eee654 Mon Sep 17 00:00:00 2001 From: Shuai Date: Tue, 21 Nov 2023 21:27:27 +0800 Subject: [PATCH] fix body initial position --- gymnasium/envs/box2d/bipedal_walker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gymnasium/envs/box2d/bipedal_walker.py b/gymnasium/envs/box2d/bipedal_walker.py index eaa274cd4..f1cd20d78 100644 --- a/gymnasium/envs/box2d/bipedal_walker.py +++ b/gymnasium/envs/box2d/bipedal_walker.py @@ -444,7 +444,7 @@ def reset( self._generate_clouds() init_x = TERRAIN_STEP * TERRAIN_STARTPAD / 2 - init_y = TERRAIN_HEIGHT + 2 * LEG_H + init_y = TERRAIN_HEIGHT + 2 * LEG_H - LEG_DOWN self.hull = self.world.CreateDynamicBody( position=(init_x, init_y), fixtures=HULL_FD ) @@ -458,7 +458,7 @@ def reset( self.joints: List[Box2D.b2RevoluteJoint] = [] for i in [-1, +1]: leg = self.world.CreateDynamicBody( - position=(init_x, init_y - LEG_H / 2 - LEG_DOWN), + position=(init_x, init_y - LEG_H / 2 + LEG_DOWN), angle=(i * 0.05), fixtures=LEG_FD, ) @@ -480,7 +480,7 @@ def reset( self.joints.append(self.world.CreateJoint(rjd)) lower = self.world.CreateDynamicBody( - position=(init_x, init_y - LEG_H * 3 / 2 - LEG_DOWN), + position=(init_x, init_y - LEG_H * 3 / 2 + LEG_DOWN), angle=(i * 0.05), fixtures=LOWER_FD, )