mit-acl / deep_panther

BSD 3-Clause "New" or "Revised" License
52 stars 10 forks source link

Installation and Running #11

Open abdul-mannan-khan opened 2 months ago

abdul-mannan-khan commented 2 months ago

First of all, I would like to highlight that there were many problem with CMakeLists.txt file. It took me around 3 days to fix them. Here is the corrected CMakeLists.txt for future reference for someone else to use. I deployed it on Linux 20.04 with ROS Neotic. CMakeLists.txt

I would like to mention that I used develop branch as it used gymnasium. However, upon running

python3 policy_compression_train.py

I got following error.

Resetting environment
Traceback (most recent call last):
  File policy_compression_train.py:421
    my_func(0);
  File policy_compression_train.py:255 in my_func
    train_venv = util.make_vec_env(env_name=ENV_NAME, n_envs=num_envs, seed=args.seed, parallel=False, env_make_kwargs={"dim": args.dim, "num_obs": args.num_obstacles}) # Note that parallel applies to the environment step, not to the expert step
  File ~/catkin_ws/src/deep_panther/panther_compression/imitation/src/imitation/util/util.py:118 in make_vec_env
    return DummyVecEnv(env_fns)
  File ~/installations/venvs_python/my_venv/lib/python3.8/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py:30 in __init__
    self.envs = [_patch_env(fn()) for fn in env_fns]
  File ~/installations/venvs_python/my_venv/lib/python3.8/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py:30 in <listcomp>
    self.envs = [_patch_env(fn()) for fn in env_fns]
  File ~/catkin_ws/src/deep_panther/panther_compression/imitation/src/imitation/util/util.py:83 in make_env
    env = spec.make(**env_make_kwargs)
  File ~/installations/venvs_python/my_venv/lib/python3.8/site-packages/gymnasium/envs/registration.py:130 in make
    return make(self, **kwargs)
  File ~/installations/venvs_python/my_venv/lib/python3.8/site-packages/gymnasium/envs/registration.py:802 in make
    env = env_creator(**env_spec_kwargs)
  File ~/catkin_ws/src/deep_panther/panther_compression/compression/envs/MyEnvironment.py:93 in __init__
    self.reset()
  File ~/catkin_ws/src/deep_panther/panther_compression/compression/envs/MyEnvironment.py:347 in reset
    self.w_obstacles=self.obsm.getFutureWPosDynamicObstacles(self.time)
  File ~/catkin_ws/src/deep_panther/panther_compression/compression/utils/ObstaclesManager.py:84 in getFutureWPosDynamicObstacles
    w_ctrl_pts_ob_list=ObstaclesManager.fitter.fit(samples)
RuntimeError: Error in Function::call for 'f' [MXFunction] at .../casadi/core/function.cpp:1432:
Error in Function::call for 'f' [MXFunction] at .../casadi/core/function.cpp:361:
.../casadi/core/function_internal.hpp:1649: Input 0 (samples) has mismatching shape. Got 3-by-20. Allowed dimensions, in general, are:
 - The input dimension N-by-M (here 2-by-20)
 - A scalar, i.e. 1-by-1
 - M-by-N if N=1 or M=1 (i.e. a transposed vector)
 - N-by-M1 if K*M1=M for some K (argument repeated horizontally)
 - N-by-P*M, indicating evaluation with multiple arguments (P must be a multiple of 1 for consistency with previous inputs)

Can you confirm that your develop branch code works for RL please? Thank you so much for your time and efforts.