forked from isaac-sim/IsaacLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
各パラメータにおいて生成されたポリシーについて客観的な評価を行うためエージェントの転倒回数、その時間とエージェントのリセット機能のオミットを行った。
エージェントの転倒回数とその時間の計測
play.pyに以下のようなコードを追加した。以下のコードによって転倒したエージェントの番号、転倒した総数、全てのエージェントが点灯するまでにかかった時間がターミナルに表示されるようになっている
obs, _ = env.get_observations()
timestep = 0
removed_agents = set()
removed_agents_count = 0
total_agents = env.num_envs
start_time = time.time()
last_checkpoint_time = start_time
# simulate environment
while simulation_app.is_running():
# run everything in inference mode
with torch.inference_mode():
# agent stepping
actions = policy(obs)
# env stepping
obs, reward, done, info = env.step(actions)
current_time = time.time()
if current_time - last_checkpoint_time >= 10:
elapsed_time = current_time - start_time
print(f"[INFO] Elapsed time: {elapsed_time:.2f} seconds.")
last_checkpoint_time = current_time
for idx, is_done in enumerate(done):
if is_done and idx not in removed_agents:
removed_agents.add(idx)
removed_agents_count += 1
print(f"[INFO] Agent {idx} has fallen. Total fallen: {removed_agents_count}")
if removed_agents_count == total_agents:
elapsed_time = current_time - start_time
print(f"[INFO] All agents have fallen at {elapsed_time:.2f} seconds.")
break
for idx in removed_agents:
actions[idx] = 0
obs, reward, done, info = env.step(actions)
リセット機能のオミット
source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/locomotion/velocity/config/g1/rough_env_cfg.pyと
source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/locomotion/velocity/velocity_env_cfg.pyの2つのファイルからreset_baseをコメントアウトしてリセット機能をオミットした。こうすることでエージェントは転倒などが起こってもリセットがかからないため前述のカウント機能によって何度も同じエージェントが転倒するのを計測し続けるようなことがなくなる。リセット機能はこの両方をコメントアウトしないと切ることはできない
Metadata
Metadata
Assignees
Labels
No labels