Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker method cannot work #3

Open
TONGLoki opened this issue Mar 19, 2023 · 1 comment
Open

Docker method cannot work #3

TONGLoki opened this issue Mar 19, 2023 · 1 comment

Comments

@TONGLoki
Copy link

Hi, Vignesh!
I have the problem of the 'Test the installation by running the example DDPG or HER+DDPG algorithms to train the dVRK PSM to reach a point.'

And I cannot run this code. Always have two problems when it was installed, so I have changed a little bit code in 'devel-training-gpu.Dockerfile'.
'docker build --rm -f "dockerfiles/devel-training-gpu.Dockerfile" -t ambf_rl:devel-training-gpu "."'

After I changed the code, it can be installed but I cannot run ' main.py'.
Here is the code:
root@b577e06569fb:~/ambf_rl/scripts/dVRK# python main.py
Previous .logs dir exists, deleting it...
Creating new .logs dir...
Running 6 processes: ('roscore', 'launch_ambf', 'psmIK_service', 'training', 'tensorboard_launch', 'print_output')
Running process: roscore
Running process: launch_ambf
Running process: psmIK_service
Running process: training
Running process: tensorboard_launch
Running process: print_output

And there is no error and no answer. And i have checked the '.logs' file in the same container. Nothing ran when ran the main.py.

root@b577e06569fb:/ambf_rl/scripts/dVRK# cd .logs
root@b577e06569fb:
/ambf_rl/scripts/dVRK/.logs# ls
launch_ambf.txt roscore.txt training_err.txt
psmIK_service.txt tensorboard_launch.txt training_out.txt
root@b577e06569fb:/ambf_rl/scripts/dVRK/.logs# tail launch_ambf.txt
./launch_ambf.bash: line 6: pushd: /home/admin/ambf/bin/lin-x86_64/: No such file or directory
./launch_ambf.bash: line 7: ./ambf_simulator: No such file or directory
./launch_ambf.bash: line 8: popd: directory stack empty
root@b577e06569fb:
/ambf_rl/scripts/dVRK/.logs#

And then i tried for the method 'Install dependencies'. I got the same problem. Nothing ran in the .logs file. According to the error of not finding the path, I changed the paths one by one, it still can't run.

I am using Ubuntu 18.04 and ros melodic-----all failed. I don't get 'An instance of AMBF will spawn and training should begin.'
By the way, I also tried to use Ubuntu 20.04 and ros noetic. Same problems.
And the 'venv' also cannot ran the main.py.

@NayiniSriHarsh
Copy link

Hi TONGLoki,
Even I faced similar issues, but finally I was able to resolve issues with "Install dependencies" method.

The issues I faced are:

  1. While installing the required packages for ambf i.e. cat install/pip-requirements.txt | xargs -n 1 -L 1 pip install -U I got ERROR: Could not find a version that satisfies the requirement tomli>=2.0.1 (from yapf) (from versions: 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3)
    #0 477.2 ERROR: No matching distribution found for tomli>=2.0.1 (from yapf)
  2. While installing the required packages for ambf_rl, installation got stuck at building wheel (opencv)
  3. While running commands in main.py file on individual terminal I encountered AttributeError: module 'contextlib' has no attribute 'nullcontext'
  4. After resolving error 3 I got ImportError: dynamic module does not define module export function (PyInit_PyKDL)
  5. An instance of AMBF was not spawn and training not starting.

For resolving error 1 and error 4:

Error 4 is related to ambf installation the error can be resolved by using from utilities_withoutpykdl import * which is present in fetal-rl branch. and change the version of yapf in install/pip-requirements.txt to yapf==0.32.0. You can clone the ambf using

git clone --branch fetal-rl https://github.com/WPI-AIM/ambf
and change the yapf version in install/pip-requirements.txt i.e. change yapf to yapf==0.32.0

For resolving error 2:

press ctrl+c and run
pip3 install opencv-python==4.5.3.56
and redo the installation

For resolving the error 3:

uninstall gym and reinstall gym==0.15.7 i.e.

pip3 uninstall gym
pip3 install gym==0.15.7

For resolving the Issue 5:

To see if there are any more errors, open the main.py file and go to each bash file and run the commands in different terminals and you can resolve them i.e.

Terminal 1:

source /opt/ros/melodic/setup.bash
roscore

Terminal 2:

source /opt/ros/melodic/setup.bash
source ~/ambf/build/devel/setup.bash
cd ~/ambf/bin/lin-x86_64
./ambf_simulator -l 5,22 -p 2000 -t 1 -s 2 # -g false

Terminal 3:

cd ~/
source /opt/ros/melodic/setup.bash
source ~/ambf/build/devel/setup.bash
cd ~/ambf_rl/scripts/dVRK/
python3 PSM_cartesian_ddpg_algorithm.py

Terminal 4:

cd ~/
source /opt/ros/melodic/setup.bash
source ~/ambf/build/devel/setup.bash
rosrun dvrk_functions psmIK_service.py

Terminal 5:

alias tensorboard='python3 -m tensorboard.main'
tensorboard --logdir ~/ambf_rl/scripts/dVRK/ddpg_dvrk_tensorboard --port 12346

You can open a browser and type http://localhost:12346 and see the training models and results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants