Hand-crafted reward and cost function & Sigwall lidar #109
Unanswered
Mgineer117
asked this question in
Q&A
Replies: 1 comment
-
I apologize for the delayed response. Here are the answers to your questions:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi developers!
I first appreciate all your efforts to construct this amazing environment for RL testing. I here brought two questions that is relevant to my current research: 1) hand-crafted reward and cost function and 2) Sigwall's lidar detection. The particular domain I am testing on is 'SafetyPointGoal1-v0" with sigwall(num=4) added.
1) hand-crafted reward and cost function
The reason I am trying to have such functions is because I want to see how different actions yield to different reward and cost. I already have referred to the environment duplication and rebuild the mujoco engine by overwriting current state, the first try of duplication takes significant computational cost during the duplication that makes it intractable and the second try just did not work. So, if any of y'all can provide those functions or insights for me to construct these functions, I would appreciate it.
2) Sigwall's lidar detection
To incorporate the cost calculation as the agent passes the sigwall into the cost function, I needed to make the sigwalls to be lidar-detectable. While I found that the environment successfully loaded its states into environment struct by calling env.obs_state_dict which shows "'sigwalls_lidar': Box(0.0, 1.0, (16,), float64)", I get the following error:
===========================================================================================
Exception has occurred: AssertionError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Bad pos [None]
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/site-packages/safety_gymnasium/bases/base_task.py", line 542, in _ego_xy
assert pos.shape == (2,), f'Bad pos {pos}'
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/site-packages/safety_gymnasium/bases/base_task.py", line 482, in _obs_lidar_pseudo
z = complex(*self._ego_xy(pos)) # X, Y as real, imaginary components
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/site-packages/safety_gymnasium/bases/base_task.py", line 418, in _obs_lidar
return self._obs_lidar_pseudo(positions)
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/site-packages/safety_gymnasium/bases/base_task.py", line 397, in obs
obs[obstacle.name + '_lidar'] = self._obs_lidar(obstacle.pos, obstacle.group)
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/site-packages/safety_gymnasium/builder.py", line 212, in reset
return (self.task.obs(), info)
File "/home/minjae/.local/lib/python3.10/site-packages/gymnasium/utils/passive_env_checker.py", line 215, in env_reset_passive_checker
result = env.reset(**kwargs)
File "/home/minjae/.local/lib/python3.10/site-packages/gymnasium/wrappers/env_checker.py", line 55, in reset
return env_reset_passive_checker(self.env, **kwargs)
File "/home/minjae/.local/lib/python3.10/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
return self.env.reset(**kwargs)
File "/home/minjae/.local/lib/python3.10/site-packages/gymnasium/wrappers/time_limit.py", line 75, in reset
return self.env.reset(**kwargs)
File "/home/minjae/Documents/Research/SAM4Meta/Adversary/simulator.py", line 21, in
state, info = env.reset(seed=i)
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/minjae/miniconda3/envs/sam/lib/python3.10/runpy.py", line 196, in _run_module_as_main (Current frame)
return _run_code(code, main_globals, None,
AssertionError: Bad pos [None]
===========================================================================================
I would appreciate any response on this matter. Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions