[Question] Pre-training phase action execution with Franka using manager-based RL framework #3685
Replies: 3 comments
-
Thank you for posting this. To execute a predefined sequence of actions with the Franka arm before each RL episode in the manager-based RL framework, it's recommended to programmatically step through the environment using a scripted motion policy (such as inverse kinematics, joint position targets, or operational space controllers) prior to activating the RL agent for training. This approach is standard for tasks that require reaching a physical initial state (e.g. grasping or placing the end effector with dynamic contact), rather than simple joint resets.12 How to Implement Pre-Training MotionsBefore starting RL training in each episode, follow these steps:
Example Code OutlineHere's a concise outline with code snippets using Isaac Lab's Gym-compatible API. This follows best practices and uses only documented classes: # Launch Isaac Sim
from isaaclab.app import AppLauncher
app_launcher = AppLauncher(headless=True)
simulation_app = app_launcher.app
import gymnasium as gym
from isaaclab_tasks.utils import load_cfg_from_registry
cfg = load_cfg_from_registry("Isaac-Reach-Franka-v0", "env_cfg_entry_point")
env = gym.make("Isaac-Reach-Franka-v0", cfg=cfg)
def scripted_init_motion(env, target_pose):
done = False
while not done:
# Compute action towards target (e.g., via inverse kinematics)
action = compute_action_to_pose(target_pose)
obs, _, _, _ = env.step(action)
done = check_if_target_reached(obs)
return obs
while True:
obs = env.reset()
# Pre-training phase: run scripted motion to desired start state
obs = scripted_init_motion(env, desired_pose)
# Now begin episode proper with RL agent policy
while not terminated:
action = agent.compute_action(obs)
obs, reward, terminated, info = env.step(action) Use Best Practices and Documentation
Footnotes |
Beta Was this translation helpful? Give feedback.
-
Thank you for your kind guidance. Where should I put this ''Example Code Outline" you provided? Becuase manager-based RL use a train.py file to train the registered environment. Could you point it out? Thank you. |
Beta Was this translation helpful? Give feedback.
-
Following up, I will move this post to our Discussions. Let us know if you have made any inroads and you need further help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Pre-training phase action execution:
Before each training episode starts, how can I execute a predefined sequence of actions or motions (e.g., having the arm grasp an object or move the end effector to a specific position) as a “pre-training phase”? During this phase, observations should not be passed to the RL agent's network, and the network should not output actions. This is especially important for tasks that require the robot to move to a certain position as the initial condition of an episode, not simply resetting the robot joint position to that position, but actually moving it there before training begins.
Beta Was this translation helpful? Give feedback.
All reactions