jr-robotics / robo-gym

An open source toolkit for Distributed Deep Reinforcement Learning on real and simulated robots.
https://sites.google.com/view/robo-gym
MIT License
390 stars 74 forks source link

Failed to start new server #56

Open gaurav-gaurav opened 2 years ago

gaurav-gaurav commented 2 years ago

I am trying to create a simulation environment using the instructions given in this repo.

###############__code_____############################ import gym import robo_gym from robo_gym.wrappers.exception_handling import ExceptionHandling

target_machine_ip = '127.0.0.1' # or other machine 'xxx.xxx.xxx.xxx'

initialize environment

env = gym.make('NoObstacleNavigationMir100Sim-v0', ip=target_machine_ip, gui=True)

##############_____#################################

on executing these commands I m getting the following error.

Starting new Robot Server | Tentative 1 of 10 Starting new Robot Server | Tentative 2 of 10 Starting new Robot Server | Tentative 3 of 10 Starting new Robot Server | Tentative 4 of 10 Starting new Robot Server | Tentative 5 of 10 Starting new Robot Server | Tentative 6 of 10 Starting new Robot Server | Tentative 7 of 10 Starting new Robot Server | Tentative 8 of 10 Starting new Robot Server | Tentative 9 of 10 Starting new Robot Server | Tentative 10 of 10 Traceback (most recent call last): File "", line 1, in File "/home/gaurav/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/home/gaurav/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/gaurav/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 73, in make env = cls(_kwargs) File "/home/gaurav/robo-gym/robo_gym/envs/ur/ur_ee_positioning.py", line 313, in init Simulation.init(self, self.cmd, ip, lower_bound_port, upper_bound_port, gui, kwargs) File "/home/gaurav/robo-gym/robo_gym/envs/simulation_wrapper.py", line 26, in init self._start_sim() File "/home/gaurav/robo-gym/robo_gym/envs/simulation_wrapper.py", line 32, in _start_sim self.robot_server_ip = self.sm_client.start_new_server(cmd = self.cmd, gui = self.gui) File "/home/gaurav/.local/lib/python3.6/site-packages/robo_gym_server_modules/server_manager/client.py", line 33, in start_new_server raise RuntimeError('Failed {} tentatives to start new Robot Server'.format(str(max_tentatives))) RuntimeError: Failed 10 tentatives to start new Robot Server

Rasoul-Zahedifar commented 10 months ago

Hello there,

I am writing this as I faced with this error and could solve it. Hopefully, it works for you. If you do NOT get any error during installation, but still have this issue, the problem is in sourcing in bashrc. Look at the line below which is from installing robo-gym-robot-servers:

printf "source /opt/ros/$ROS_DISTRO/setup.bash\nsource $ROBOGYM_WS/devel/setup.bash" >> ~/.bashrc

here, the path is $ROBOGYM_WS/devel/setup.bash, while it is highly likely that you installed it in another directory. Therefor, you should change the address accordingly. To check if it is changed correctly, run the command "tail .bashrc" and you should see the last line of the response being like "source correct path". Otherwise, it is highly likely that you did not install the packages correctly (in which case you should get error during installation). If this is the case and you get error in the command "catkin build", it might be due to the NOT existence of .catkin_tools along with src file. It is a hidden file and you can see hidden files with "ls -a". run the command "ls -a" in /home (or ~) directory and if you see .catkin_tools there, you may need to move it to $ROBOGYM_WS directory or bring src to /home directory. In the second case, make sure to change the source path I talked about above, accordingly.

Good Luck