Skip to content

Commit

Permalink
feat: add headless option and play buttion function
Browse files Browse the repository at this point in the history
  • Loading branch information
mqjinwon committed Oct 14, 2024
1 parent 3a3c262 commit 00c3ab8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions exts/StrideSim/StrideSim/base_sample/base_sample_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#

import asyncio
import subprocess
import weakref
from abc import abstractmethod

Expand Down Expand Up @@ -280,11 +281,9 @@ def _on_train(self):
training_window = self._headless_dropdown.model.get_item_value_model().get_value_as_string()

command = f"python {RL_DIR}/train.py --task {task_name}"
if training_window == "off":
if training_window == "1":
command += " --headless"

import subprocess

try:
subprocess.Popen(command, shell=True)
print(f"Started training process: {command}")
Expand All @@ -293,5 +292,16 @@ def _on_train(self):
return

def _on_play(self):
print("Playing")
task_name = self._rl_task_name_field.model.get_value_as_string()
training_window = self._headless_dropdown.model.get_item_value_model().get_value_as_string()

command = f"python {RL_DIR}/play.py --task {task_name}"

command += " --num_envs 10"

try:
subprocess.Popen(command, shell=True)
print(f"Started training process: {command}")
except Exception as e:
print(f"Error starting training process: {e}")
return
Binary file added exts/StrideSim/StrideSim/network/policy.onnx
Binary file not shown.
Empty file.
Binary file modified guideline/ui_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions rl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
parser.add_argument("--task", type=str, default=None, help="Name of the task.")
parser.add_argument("--seed", type=int, default=None, help="Seed used for the environment")
parser.add_argument("--max_iterations", type=int, default=None, help="RL Policy training iterations.")

# append RSL-RL cli arguments
cli_args.add_rsl_rl_args(parser)
# append AppLauncher cli args
Expand Down

0 comments on commit 00c3ab8

Please sign in to comment.