diff --git a/images/constraints/ghost3Ds_1.png b/images/constraints/ghost3Ds_1.png new file mode 100644 index 0000000..60dc85f Binary files /dev/null and b/images/constraints/ghost3Ds_1.png differ diff --git a/images/constraints/ghost3Ds_2.png b/images/constraints/ghost3Ds_2.png new file mode 100644 index 0000000..52b0ebf Binary files /dev/null and b/images/constraints/ghost3Ds_2.png differ diff --git a/images/constraints/ghosts_1.png b/images/constraints/ghosts_1.png new file mode 100644 index 0000000..29bb743 Binary files /dev/null and b/images/constraints/ghosts_1.png differ diff --git a/images/constraints/ghosts_2.png b/images/constraints/ghosts_2.png new file mode 100644 index 0000000..262ab93 Binary files /dev/null and b/images/constraints/ghosts_2.png differ diff --git a/images/constraints/hazard3Ds_1.png b/images/constraints/hazard3Ds_1.png new file mode 100644 index 0000000..daddcc4 Binary files /dev/null and b/images/constraints/hazard3Ds_1.png differ diff --git a/images/constraints/hazard3Ds_2.png b/images/constraints/hazard3Ds_2.png new file mode 100644 index 0000000..6553718 Binary files /dev/null and b/images/constraints/hazard3Ds_2.png differ diff --git a/images/robots/ant.png b/images/robots/ant.png new file mode 100644 index 0000000..17a1051 Binary files /dev/null and b/images/robots/ant.png differ diff --git a/images/robots/arm3.png b/images/robots/arm3.png new file mode 100644 index 0000000..54d9059 Binary files /dev/null and b/images/robots/arm3.png differ diff --git a/images/robots/arm6.png b/images/robots/arm6.png new file mode 100644 index 0000000..0424ab1 Binary files /dev/null and b/images/robots/arm6.png differ diff --git a/images/robots/car.png b/images/robots/car.png new file mode 100644 index 0000000..8440d3a Binary files /dev/null and b/images/robots/car.png differ diff --git a/images/robots/doggo.png b/images/robots/doggo.png new file mode 100644 index 0000000..b6dba0f Binary files /dev/null and b/images/robots/doggo.png differ diff --git a/images/robots/drone.png b/images/robots/drone.png new file mode 100644 index 0000000..fcc9718 Binary files /dev/null and b/images/robots/drone.png differ diff --git a/images/robots/hopper.png b/images/robots/hopper.png new file mode 100644 index 0000000..1a32ffc Binary files /dev/null and b/images/robots/hopper.png differ diff --git a/images/robots/humanoid.png b/images/robots/humanoid.png new file mode 100644 index 0000000..b73abf0 Binary files /dev/null and b/images/robots/humanoid.png differ diff --git a/images/robots/point.png b/images/robots/point.png new file mode 100644 index 0000000..2f0d8b9 Binary files /dev/null and b/images/robots/point.png differ diff --git a/images/robots/swimmer.png b/images/robots/swimmer.png new file mode 100644 index 0000000..b6ed524 Binary files /dev/null and b/images/robots/swimmer.png differ diff --git a/images/robots/walker.png b/images/robots/walker.png new file mode 100644 index 0000000..fae7ac2 Binary files /dev/null and b/images/robots/walker.png differ diff --git a/images/tasks/chase.png b/images/tasks/chase.png new file mode 100644 index 0000000..89a1bc0 Binary files /dev/null and b/images/tasks/chase.png differ diff --git a/images/tasks/defense.png b/images/tasks/defense.png new file mode 100644 index 0000000..8b4de7b Binary files /dev/null and b/images/tasks/defense.png differ diff --git a/images/tasks/goal.png b/images/tasks/goal.png new file mode 100644 index 0000000..5211a40 Binary files /dev/null and b/images/tasks/goal.png differ diff --git a/images/tasks/push.png b/images/tasks/push.png new file mode 100644 index 0000000..8acdcff Binary files /dev/null and b/images/tasks/push.png differ diff --git a/safe_rl_envs/safe_rl_envs/envs/world.py b/safe_rl_envs/safe_rl_envs/envs/world.py index b893154..9019010 100755 --- a/safe_rl_envs/safe_rl_envs/envs/world.py +++ b/safe_rl_envs/safe_rl_envs/envs/world.py @@ -105,15 +105,23 @@ def build(self): equality['weld'] = [] # Add asset section if missing + + # + asset = xmltodict.parse(f''' - - + + + + ''') xml_path = os.path.dirname(os.path.join(BASE_DIR, self.robot_base)) @@ -166,7 +174,7 @@ def build(self): # Make sure floor renders the same for every world for g in worldbody['geom']: if g['@name'] == 'floor': - g.update({'@size': convert(self.floor_size), '@rgba': '1 1 1 1', '@material': 'MatPlane'}) + g.update({'@size': convert(self.floor_size), '@rgba': '1 1 1 1', '@material': 'MatPlane2'}) # Add cameras to the XML dictionary cameras = xmltodict.parse(''' diff --git a/safe_rl_envs/safe_rl_envs/myTest.py b/safe_rl_envs/safe_rl_envs/myTest.py index 785e639..4f9530c 100644 --- a/safe_rl_envs/safe_rl_envs/myTest.py +++ b/safe_rl_envs/safe_rl_envs/myTest.py @@ -62,34 +62,34 @@ def run_random(env_name): # } config = { # robot setting - 'robot_base': 'xmls/drone.xml', + 'robot_base': 'xmls/ant.xml', # task setting - 'task': 'goal', - 'goal_3D': True, - 'goal_z_range': [0.5,1.5], + 'task': 'chase', 'goal_size': 0.5, # observation setting - 'observe_goal_comp': True, # Observe the goal with a lidar sensor - 'observe_hazard3Ds': True, # Observe the vector from agent to hazards - 'compass_shape': 3, + 'observe_robbers': False, # Observe the goal with a lidar sensor + 'observe_ghosts': True, # Observe the vector from agent to hazards 'sensors_obs': ['accelerometer', 'velocimeter', 'gyro', 'magnetometer', - 'touch_p1a', 'touch_p1b', 'touch_p2a', 'touch_p2b', - 'touch_p3a', 'touch_p3b', 'touch_p4a', 'touch_p4b'], + 'touch_ankle_1a', 'touch_ankle_2a', 'touch_ankle_3a', 'touch_ankle_4a', + 'touch_ankle_1b', 'touch_ankle_2b', 'touch_ankle_3b', 'touch_ankle_4b'], + # constraint setting - 'constrain_hazard3Ds': True, # Constrain robot from being in hazardous areas + 'constrain_ghosts': True, # Constrain robot from being in hazardous areas 'constrain_indicator': False, # If true, all costs are either 1 or 0 for a given step. If false, then we get dense cost. # lidar setting - 'lidar_num_bins': 10, - 'lidar_num_bins3D': 6, + 'lidar_num_bins': 16, # object setting - 'hazard3Ds_num': 8, - 'hazard3Ds_size': 0.3, - 'hazard3Ds_z_range': [0.5, 1.5], + 'ghosts_num': 8, + 'ghosts_size': 0.3, + 'ghosts_travel':2.5, + 'ghosts_safe_dist': 1.5, + 'robbers_num': 0, + 'robbers_size': 0.3, } env = Engine(config) obs = env.reset() @@ -204,9 +204,12 @@ def run_random(env_name): # import ipdb;ipdb.set_trace() o = env.reset() # import ipdb;ipdb.set_trace() - if cnt > 10000: + if cnt > 800: + import ipdb;ipdb.set_trace() break + env.render() + print("##", time.time() - t) if __name__ == '__main__': diff --git a/safe_rl_envs/safe_rl_envs/xmls/ant.xml b/safe_rl_envs/safe_rl_envs/xmls/ant.xml index 883ff45..6ce8013 100644 --- a/safe_rl_envs/safe_rl_envs/xmls/ant.xml +++ b/safe_rl_envs/safe_rl_envs/xmls/ant.xml @@ -3,7 +3,7 @@ - + diff --git a/safe_rl_envs/safe_rl_envs/xmls/arm_3.xml b/safe_rl_envs/safe_rl_envs/xmls/arm_3.xml index b43c9ec..f8cbbc1 100644 --- a/safe_rl_envs/safe_rl_envs/xmls/arm_3.xml +++ b/safe_rl_envs/safe_rl_envs/xmls/arm_3.xml @@ -3,7 +3,7 @@