Course materials · Reinforcement Learning for Electrical Engineering

Isaac Lab and robot simulation

English translation

Learning objectives

Go beyond running a new simulator example: Identify the observations, actions, and physics that your research task requires you to change.

Execution conditions

Applications

Mobile robot paths and safety

An application design case choosing either grid paths or continuous velocity control.

Observation and state: Position, target-relative position, and nearby obstacle observations.

Action: choose a grid direction or bounded linear and angular velocities.

Reward and constraints: Separate arrival, collision, and movement costs. Distinguish collisions from timeouts.

Comparison baseline: shortest path and rule-based avoidance.

Metrics to check: Success rate, collision rate, travel distance, and time. Evaluate on unseen maps.

Drive-system tracking performance and input cost

A synthetic 1st-order motor model that tracks a constant reference angular velocity in each experiment. Separate training at target 1 from evaluation at 0.5, 1, and 1.5.

Observation and state: angular velocity ω/5\omega/5, target r/2r/2.

Action: Continuous a∈[−1,1]a\in[-1,1], actual input u=2au=2a.

Reward and constraints: −((r−ω)2+0.05u2)-((r-\omega)^2+0.05u^2). Termination at |ω|>5|\omega|>5; time limit at 100 steps.

Comparison baseline: P control with the same input limits.

Metrics to check: Tracking RMSE, mean u², and number of safety terminations. Evaluate separately for each target.

From Gymnasium to a robot simulator

Starting conditions

Start from CartPole-v1 observations, actions, resets, and time limits.

Procedure

  1. Run the provided rule policy and record observations and actions for one episode.
  2. In the official Isaac Lab Quickstart, identify and map the roles of the task, physics backend, renderer, and RL library.

Results to retain

"""Small public-environment benchmark; evaluation traces are ordinary numeric arrays."""
import json
from importlib.metadata import version
from pathlib import Path
import numpy as np
import gymnasium as gym

def collect(env_id='CartPole-v1', policy=None, seeds=range(100,103)):
    env=gym.make(env_id); transitions=[]; summary=[]
    for seed in seeds:
        obs,info=env.reset(seed=seed);env.action_space.seed(seed);total=0.;length=0
        while True:
            action=env.action_space.sample() if policy is None else policy(obs)
            nxt,reward,terminated,truncated,info=env.step(action)
            transitions.append((obs.copy(),np.asarray(action).copy(),reward,nxt.copy(),terminated,truncated,seed))
            obs=nxt;total+=reward;length+=1
            if terminated or truncated:break
        summary.append([seed,total,length,int(terminated),int(truncated)])
    env.close()
    columns=list(zip(*transitions))
    data={k:np.asarray(v) for k,v in zip(['observations','actions','rewards','next_observations','terminated','truncated','episode_seed'],columns)}
    return np.asarray(summary),data

def cartpole_rule(obs):return int(obs[2]+.25*obs[3]>0)
def zero_torque(obs):return np.zeros(1,dtype=np.float32)

def save_trace(path, env_id, data, policy_name, seeds):
    # Contains numeric arrays and JSON text only; never requires pickle.
    metadata=dict(env_id=env_id,policy=policy_name,seeds=list(seeds),gymnasium=version('gymnasium'))
    np.savez_compressed(path,**data,metadata_json=np.array(json.dumps(metadata)))
    with np.load(path,allow_pickle=False) as saved:
        assert len(saved['observations'])==len(saved['rewards'])
        print(json.loads(str(saved['metadata_json'])))

def public_model(algorithm='DQN',env_id='CartPole-v1',seed=7,steps=2048,**changes):
    from stable_baselines3 import DQN,PPO,SAC
    options=dict(policy_kwargs=dict(net_arch=[32,32]),seed=seed,verbose=0,device='cpu')
    if algorithm=='DQN':options.update(buffer_size=5000,learning_starts=100,target_update_interval=100,batch_size=32)
    if algorithm=='PPO':options.update(n_steps=128,batch_size=64,n_epochs=3)
    if algorithm=='SAC':options.update(buffer_size=5000,learning_starts=100,batch_size=64)
    options.update(changes)
    env=gym.make(env_id)
    model={'DQN':DQN,'PPO':PPO,'SAC':SAC}[algorithm]('MlpPolicy',env,**options)
    model.learn(total_timesteps=steps)
    env.close()
    return model

print('Gymnasium',version('gymnasium'))
env=gym.make('CartPole-v1')
print('Observation:',env.observation_space,'Action:',env.action_space,'Limit:',env.spec.max_episode_steps)
env.close()
# For visual inspection, create a separate env with render_mode='rgb_array'.
# Rendering requires gymnasium[classic-control]; do not render every training step.

rows,trace=collect(policy=cartpole_rule,seeds=[100]);print(rows)

Record results and self-check

Role:

Gymnasium example:

Isaac Lab configuration:

What I will change:

Points to check

Environment onboarding: execution or transition analysis

Starting conditions

GPU environment: On a prepared Linux/Windows NVIDIA system, follow the official Quickstart in this order: task list → zero/random agent → training → play. CPU environment: During the same session, complete CartPole transition and policy comparisons and task configuration mapping.

Procedure

  1. If a GPU environment is ready, run the Cartpole task following the current official documentation, and record the task ID, backend, seed, and execution command.
  2. If no GPU environment is available, compare Random and Rule trajectories with the provided CPU code and identify termination causes.
  3. In your selected path, find the setting to modify to change one observation, action, or termination rule.

Results to retain

import matplotlib.pyplot as plt
for name,policy in [('random',None),('rule',cartpole_rule)]:
    rows,trace=collect(policy=policy,seeds=[100]);plt.plot(trace['observations'][:,2],label=name)
plt.xlabel('Control step');plt.ylabel('Pole angle [rad]');plt.legend()

Record results and self-check

Path:

Task and environment:

Execution conditions:

Observed results:

Settings to modify:

Points to check

Minimum components of a research task

Starting conditions

Choose manipulation, mobile robotics, or process control.

Procedure

  1. Tabulate the scene, state observations, action scale, reward, reset, and termination.
  2. Link to the files and components containing these settings in the official Isaac Lab robot tutorial.
  3. Decide what to hold fixed and which single item to change in the first experiment.

Results to retain

Record results and self-check

Components:

My task definition:

Reference configuration location:

Initial validation:

Points to check

Official examples and data