Skip to content

Commit

Permalink
apply config controlType override to parent Demo class
Browse files Browse the repository at this point in the history
  • Loading branch information
brainiac-ws committed Jan 29, 2021
1 parent 4ae267c commit e87569a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 6 additions & 1 deletion demos/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
logger = logging.getLogger(__name__)

import json

from perls2.utils.yaml_config import YamlConfig
class Demo(object):
"""Abstract class definition for demonstration.
Demonstrations step an environment according to a series of actions
Expand Down Expand Up @@ -38,6 +38,11 @@ def __init__(self,
**kwargs):
self.ctrl_type = ctrl_type
self.config_file = config_file

# Overwrite config file controlType
self.config = YamlConfig(self.config_file)
self.config['world']['controlType'] = self.ctrl_type

self.demo_type = demo_type
self.test_fn = test_fn

Expand Down
7 changes: 1 addition & 6 deletions demos/joint_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from demo_envs import JointDemoEnv
from demo_path import RampSingleJoint
from perls2.utils.yaml_config import YamlConfig
from demo import Demo
import numpy as np
import logging
Expand Down Expand Up @@ -54,11 +53,7 @@ def __init__(self,
demo_type=demo_type,
test_fn=test_fn, **kwargs)

# Overwrite config file controlType
config = YamlConfig(config_file)
config['world']['controlType'] = self.ctrl_type

self.env = JointDemoEnv(config=config,
self.env = JointDemoEnv(config=self.config,
use_visualizer=True,
name=None,
test_fn=self.test_fn,
Expand Down
2 changes: 1 addition & 1 deletion demos/osc_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self,
config_file=config_file,
**kwargs)

self.env = OpSpaceDemoEnv(config=config_file,
self.env = OpSpaceDemoEnv(config=self.config,
use_visualizer=True,
name=None,
test_fn=self.test_fn,
Expand Down

0 comments on commit e87569a

Please sign in to comment.