Add Go1 training and stair fine-tuning
This commit is contained in:
@@ -2,6 +2,8 @@ from legged_gym import LEGGED_GYM_ROOT_DIR, LEGGED_GYM_ENVS_DIR
|
||||
|
||||
from legged_gym.envs.go2.go2_env import Go2Robot
|
||||
from legged_gym.envs.go2.go2_config import GO2Cfg, GO2CfgPPO, GO2CfgCTS, GO2CfgMoECTS, GO2CfgMoENGCTS, GO2CfgMCPCTS, GO2CfgACMoECTS, GO2CfgDualMoECTS
|
||||
from legged_gym.envs.go1.go1_env import Go1Robot
|
||||
from legged_gym.envs.go1.go1_config import GO1Cfg, GO1CfgMoECTS, GO1StairsCfg, GO1StairsCfgMoECTS
|
||||
from .base.legged_robot import LeggedRobot
|
||||
|
||||
from legged_gym.utils.task_registry import task_registry
|
||||
@@ -13,3 +15,5 @@ task_registry.register("go2_moe_ng_cts", Go2Robot, GO2Cfg(), GO2CfgMoENGCTS())
|
||||
task_registry.register("go2_mcp_cts", Go2Robot, GO2Cfg(), GO2CfgMCPCTS())
|
||||
task_registry.register("go2_ac_moe_cts", Go2Robot, GO2Cfg(), GO2CfgACMoECTS())
|
||||
task_registry.register("go2_dual_moe_cts", Go2Robot, GO2Cfg(), GO2CfgDualMoECTS())
|
||||
task_registry.register("go1_moe_cts", Go1Robot, GO1Cfg(), GO1CfgMoECTS())
|
||||
task_registry.register("go1_moe_cts_stairs", Go1Robot, GO1StairsCfg(), GO1StairsCfgMoECTS())
|
||||
|
||||
58
legged_gym/envs/go1/go1_config.py
Normal file
58
legged_gym/envs/go1/go1_config.py
Normal file
@@ -0,0 +1,58 @@
|
||||
from legged_gym.envs.go2.go2_config import GO2Cfg, GO2CfgMoECTS
|
||||
|
||||
|
||||
class GO1Cfg(GO2Cfg):
|
||||
class init_state(GO2Cfg.init_state):
|
||||
pos = [0.0, 0.0, 0.34]
|
||||
|
||||
class control(GO2Cfg.control):
|
||||
stiffness = {'joint': 28.0}
|
||||
damping = {'joint': 0.7}
|
||||
action_scale = 0.25
|
||||
decimation = 4
|
||||
|
||||
class asset(GO2Cfg.asset):
|
||||
file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/go1/urdf/go1.urdf'
|
||||
name = 'go1'
|
||||
self_collisions = 1
|
||||
|
||||
class rewards(GO2Cfg.rewards):
|
||||
base_height_target = 0.30
|
||||
|
||||
|
||||
class GO1CfgMoECTS(GO2CfgMoECTS):
|
||||
class runner(GO2CfgMoECTS.runner):
|
||||
experiment_name = 'go1_moe_cts'
|
||||
run_name = 'from_scratch_5000'
|
||||
max_iterations = 5000
|
||||
save_interval = 500
|
||||
resume = False
|
||||
load_run = -1
|
||||
checkpoint = -1
|
||||
resume_path = None
|
||||
|
||||
|
||||
class GO1StairsCfg(GO1Cfg):
|
||||
class terrain(GO1Cfg.terrain):
|
||||
# wave, slope, rough slope, stairs up, stairs down, obstacles,
|
||||
# stepping stones, gap, flat
|
||||
terrain_proportions = [0.03, 0.06, 0.03, 0.50, 0.20, 0.08, 0.0, 0.0, 0.10]
|
||||
|
||||
class commands(GO1Cfg.commands):
|
||||
# The 10k checkpoint has only seen +/-0.5 m/s because the original
|
||||
# curriculum does not widen until iteration 20000. Cover the 0.8 m/s
|
||||
# RoboGauge stair command immediately during this fine-tune.
|
||||
command_range_curriculum = []
|
||||
|
||||
class ranges(GO1Cfg.commands.ranges):
|
||||
lin_vel_x = [-1.0, 1.0]
|
||||
lin_vel_y = [-0.5, 0.5]
|
||||
ang_vel_yaw = [-1.0, 1.0]
|
||||
|
||||
|
||||
class GO1StairsCfgMoECTS(GO1CfgMoECTS):
|
||||
class runner(GO1CfgMoECTS.runner):
|
||||
experiment_name = 'go1_moe_cts'
|
||||
run_name = 'stairs_finetune_10000_to_15000'
|
||||
max_iterations = 5000
|
||||
save_interval = 500
|
||||
34
legged_gym/envs/go1/go1_env.py
Normal file
34
legged_gym/envs/go1/go1_env.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from legged_gym.envs.go2.go2_env import Go2Robot
|
||||
import torch
|
||||
|
||||
|
||||
class Go1Robot(Go2Robot):
|
||||
"""Go1 asset with an explicit policy-to-asset joint permutation.
|
||||
|
||||
Isaac Gym loads this asset as [FL, FR, RL, RR]. The permutation below
|
||||
presents observations to the policy as [FR, FL, RR, RL] and maps policy
|
||||
actions back to the Isaac Gym asset order. Existing Go1 checkpoints depend
|
||||
on this policy order.
|
||||
"""
|
||||
|
||||
# Policy order [FR, FL, RR, RL] -> asset order [FL, FR, RL, RR].
|
||||
_POLICY_TO_ASSET = [3, 4, 5, 0, 1, 2, 9, 10, 11, 6, 7, 8]
|
||||
|
||||
def step(self, actions):
|
||||
asset_actions = torch.zeros_like(actions)
|
||||
asset_actions[:, self._POLICY_TO_ASSET] = actions
|
||||
return super().step(asset_actions)
|
||||
|
||||
def compute_observations(self):
|
||||
super().compute_observations()
|
||||
|
||||
# Go2 policy observation: angular velocity, gravity, commands,
|
||||
# joint-position error, joint velocity, previous action.
|
||||
for start in (9, 21, 33):
|
||||
self.obs_buf[:, start:start + 12] = self.obs_buf[:, start:start + 12][:, self._POLICY_TO_ASSET]
|
||||
|
||||
# Keep the privileged teacher input consistent as well. Its first
|
||||
# three fields are base linear velocity, so joint fields start at 12.
|
||||
if self.privileged_obs_buf is not None:
|
||||
for start in (12, 24, 36, 52, 64):
|
||||
self.privileged_obs_buf[:, start:start + 12] = self.privileged_obs_buf[:, start:start + 12][:, self._POLICY_TO_ASSET]
|
||||
Reference in New Issue
Block a user