Skip to content

Commit

Permalink
Add --world option for demo command line arg
Browse files Browse the repository at this point in the history
World command line spec overrides that used in config yaml file. This makes it easier to run the demos without having to modify the demo_control_cfg yaml file.
  • Loading branch information
brainiac-ws committed Jan 29, 2021
1 parent ffadd7d commit c2b61ed
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ You can see the valid command line args for a demo with:

The parameters general to all demos are listed here:

--world (str): (Optional) World to use for demo (Bullet or Real). If not defined, spec from config yaml file is used.
--ctrl_type (str): Controller type for the demo.
--demo_type (str): Type of demo to perform.
--test_fn (str): RobotInterface function environment will use to perform actions. Specific to controller type.
Expand Down
3 changes: 3 additions & 0 deletions demos/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def __init__(self,
# Overwrite config file controlType
self.config = YamlConfig(self.config_file)
self.config['world']['controlType'] = self.ctrl_type
# Use command line argument over the config spec.
if kwargs['world'] is not None:
self.config['world']['type'] = kwargs['world']

self.demo_type = demo_type
self.test_fn = test_fn
Expand Down
3 changes: 2 additions & 1 deletion demos/run_gc_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

parser = argparse.ArgumentParser(
description="Test controllers and measure errors.")

parser.add_argument('--world', default=None,
help='World type for the demo, uses config file if not specified', choices=['Bullet', 'Real'])
parser.add_argument('--num_steps', default=500, type=int,
help="max steps for demo.")
parser.add_argument('--plot_pos', action="store_true",
Expand Down
2 changes: 2 additions & 0 deletions demos/run_jointimp_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

parser = argparse.ArgumentParser(
description="Test controllers and measure errors.")
parser.add_argument('--world', default=None, help='World type for the demo, uses config file if not specified', choices=['Bullet', 'Real'])

parser.add_argument('--delta_val',
default=0.01, type=float,
help="Max step size (m or rad) to take for demo.")
Expand Down
1 change: 1 addition & 0 deletions demos/run_osc_line_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

parser = argparse.ArgumentParser(
description="Run OpSpace Line Demo in XYZ directions")
parser.add_argument('--world', default=None, help='World type for the demo, uses config file if not specified', choices=['Bullet', 'Real'])
parser.add_argument('--ctrl_type',
default="EEImpedance",
help='Type of controller to test',
Expand Down
2 changes: 2 additions & 0 deletions demos/run_osc_rot_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

parser = argparse.ArgumentParser(
description="Run OpSpace Line Demo in XYZ directions")
parser.add_argument('--world', default=None, help='World type for the demo, uses config file if not specified', choices=['Bullet', 'Real'])

parser.add_argument('--ctrl_type',
default="EEImpedance",
help='Type of controller to test',
Expand Down
3 changes: 3 additions & 0 deletions demos/run_osc_square_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

parser = argparse.ArgumentParser(
description="Run OpSpace Square Demo ")
parser.add_argument('--world', default=None,
help='World type for the demo, uses config file if not specified', choices=['Bullet', 'Real'])

parser.add_argument('--ctrl_type',
default="EEImpedance",
help='Type of controller to test',
Expand Down

0 comments on commit c2b61ed

Please sign in to comment.