Skip to content

Commit 8eb4911

Browse files
authored
Merge pull request #61 from MuammerBay/feat/reach-ik
Adds reach task with IK controller
2 parents 7278063 + d39d888 commit 8eb4911

File tree

3 files changed

+118
-2
lines changed

3 files changed

+118
-2
lines changed

source/SO_100/SO_100/tasks/reach/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,25 @@
6767
},
6868
disable_env_checker=True,
6969
)
70+
71+
# Relative IK controller
72+
73+
gym.register(
74+
id="SO-ARM100-Reach-ROSCON-IK-v0",
75+
entry_point="isaaclab.envs:ManagerBasedRLEnv",
76+
kwargs={
77+
"env_cfg_entry_point": f"{__name__}.ik_rel_env_cfg:SoArm100ReachRosCon_IK_EnvCfg",
78+
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:ReachRosConIKPPORunnerCfg",
79+
},
80+
disable_env_checker=True,
81+
)
82+
83+
gym.register(
84+
id="SO-ARM100-Reach-ROSCON-IK-Play-v0",
85+
entry_point="isaaclab.envs:ManagerBasedRLEnv",
86+
kwargs={
87+
"env_cfg_entry_point": f"{__name__}.ik_rel_env_cfg:SoArm100ReachRosCon_IK_EnvCfg_PLAY",
88+
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:ReachRosConIKPPORunnerCfg",
89+
},
90+
disable_env_checker=True,
91+
)

source/SO_100/SO_100/tasks/reach/agents/rsl_rl_ppo_cfg.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ReachPPORunnerCfg(RslRlOnPolicyRunnerCfg):
2121
num_steps_per_env = 24
2222
max_iterations = 1000
2323
save_interval = 50
24-
experiment_name = "so_arm100_reach"
24+
experiment_name = "reach"
2525
run_name = ""
2626
resume = False
2727
empirical_normalization = False
@@ -52,7 +52,38 @@ class ReachRosConPPORunnerCfg(RslRlOnPolicyRunnerCfg):
5252
num_steps_per_env = 24
5353
max_iterations = 1000
5454
save_interval = 50
55-
experiment_name = "so_arm100_reach"
55+
experiment_name = "reach_roscon"
56+
run_name = ""
57+
resume = False
58+
empirical_normalization = False
59+
policy = RslRlPpoActorCriticCfg(
60+
init_noise_std=1.0,
61+
actor_hidden_dims=[64, 64],
62+
critic_hidden_dims=[64, 64],
63+
activation="elu",
64+
)
65+
algorithm = RslRlPpoAlgorithmCfg(
66+
value_loss_coef=1.0,
67+
use_clipped_value_loss=True,
68+
clip_param=0.2,
69+
entropy_coef=0.001,
70+
num_learning_epochs=8,
71+
num_mini_batches=4,
72+
learning_rate=1.0e-3,
73+
schedule="adaptive",
74+
gamma=0.99,
75+
lam=0.95,
76+
desired_kl=0.01,
77+
max_grad_norm=1.0,
78+
)
79+
80+
81+
@configclass
82+
class ReachRosConIKPPORunnerCfg(RslRlOnPolicyRunnerCfg):
83+
num_steps_per_env = 24
84+
max_iterations = 1000
85+
save_interval = 50
86+
experiment_name = "reach_roscon_ik"
5687
run_name = ""
5788
resume = False
5889
empirical_normalization = False
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (c) 2024-2025, Muammer Bay (LycheeAI), Louis Le Lay
2+
# All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
7+
# All rights reserved.
8+
#
9+
# SPDX-License-Identifier: BSD-3-Clause
10+
11+
from isaaclab.controllers.differential_ik_cfg import DifferentialIKControllerCfg
12+
from isaaclab.envs.mdp.actions.actions_cfg import DifferentialInverseKinematicsActionCfg
13+
from isaaclab.utils import configclass
14+
15+
##
16+
# Pre-defined configs
17+
##
18+
from SO_100.robots import SO_ARM100_CFG, SO_ARM100_ROSCON_CFG # noqa: F401
19+
20+
from .joint_pos_env_cfg import SoArm100ReachRosConEnvCfg
21+
22+
# ----------------------------------------------------------------
23+
# --------------- ROSCON ES 2025 asset ---------------------------
24+
# ----------------------------------------------------------------
25+
26+
27+
@configclass
28+
class SoArm100ReachRosCon_IK_EnvCfg(SoArm100ReachRosConEnvCfg):
29+
def __post_init__(self):
30+
# post init of parent
31+
super().__post_init__()
32+
33+
# Set Franka as robot
34+
# We switch here to a stiffer PD controller for IK tracking to be better.
35+
self.scene.robot = SO_ARM100_ROSCON_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
36+
37+
# Set actions for the specific robot type (franka)
38+
self.actions.arm_action = DifferentialInverseKinematicsActionCfg(
39+
asset_name="robot",
40+
joint_names=[
41+
"shoulder_pan_joint",
42+
"shoulder_lift_joint",
43+
"elbow_joint",
44+
"wrist_pitch_joint",
45+
"wrist_roll_joint",
46+
],
47+
body_name="wrist_2_link",
48+
controller=DifferentialIKControllerCfg(command_type="pose", use_relative_mode=True, ik_method="dls"),
49+
scale=0.5,
50+
body_offset=DifferentialInverseKinematicsActionCfg.OffsetCfg(pos=[-0.005, -0.1, 0.0]),
51+
)
52+
53+
54+
@configclass
55+
class SoArm100ReachRosCon_IK_EnvCfg_PLAY(SoArm100ReachRosCon_IK_EnvCfg):
56+
def __post_init__(self):
57+
# post init of parent
58+
super().__post_init__()
59+
# make a smaller scene for play
60+
self.scene.num_envs = 50
61+
self.scene.env_spacing = 2.5
62+
# disable randomization for play
63+
self.observations.policy.enable_corruption = False

0 commit comments

Comments
 (0)