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
426 stars 75 forks source link

Robot Server won't start #55

Open hayday100 opened 2 years ago

hayday100 commented 2 years ago

After installation and start-server-manager successfully, I ran:

python docs/examples/stable-baselines/td3_script.py

Then it takes forever to try to start the Robot Server: 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 ... RuntimeError: Failed 10 tentatives to start new Robot Server

I am using python 3.7 and tensorflow 1.15 in Ubuntu 18.04 and 20.04. Both Ubuntu versions has the same problem.

The server_manager is giving the following messages:

2022-02-20 11:28:30,668 - serverManager - ERROR - Failed to add Robot Server
Traceback (most recent call last):
File "...robo-gym/venv/lib/python3.7/site-packages/robo_gym_server_modules/server_manager/server.py", line 119, in StartNewServer
    assert isinstance(rl_server, int)
AssertionError
2022-02-20 11:28:30,671 - serverManager - INFO - Starting Robot Server...
E0220 11:28:30.672911148   12613 fork_posix.cc:70]           Fork support is only compatible with the epoll1 and poll polling strategies
hayday100 commented 2 years ago

I got it to spawn Rviz and robot model. Now it spawns Rviz too many times. And for spawning the MiR robot, the wheels' joints failed to load URDF. I am not sure if this is because I don't have the physical MiR robot. The launch command gives:

roslaunch mir100_robot_server sim_robot_server.launch gui:=true server_port:=60291

Controller Spawner: Waiting for service controller_manager/load_controller
[robot_server-15] process has died ...
...
[ERROR] [1645463422.050517960, 0.001000000]: GetModelState: model [mir] does not exist
...
[ERROR] [1645463423.447984068, 0.001000000]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/left_wheel_joint
[ERROR] [1645463423.448756918, 0.001000000]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/right_wheel_joint
...

I have a Turtlebot3. I don't know if it can replace the MiR robot on robo-gym platform ...

brean commented 2 years ago

Hi @hayday100

I just stumbled over this repo and installation was pretty easy and straight forward for me. It seems your installation was a success!

I am working with the MiR-100 simulation for quite some time now, you can ignore the error messages, they are known issues of the MiR-100-simulation.

You do not need a real robot!

These are my installation steps:

  1. follow the installation instructions for noetic here: https://github.com/jr-robotics/robo-gym-robot-servers#installation. Note that the last step in the installation writes something in your bashrc-file, so after the last step close your terminal and open a new one to have a bash-instance that loaded this.
  2. install robotgym using pip as described here: https://github.com/jr-robotics/robo-gym#installation
  3. copy the code from this random-robot example as robot_random.py https://github.com/jr-robotics/robo-gym#random-agent-mir100-simulation-environment
  4. just run robot_random.py and wait a moment, rviz will open, the robot will spawn and after around 10 seconds the mir-robot will start moving, like this: https://cloud.dfki.de/owncloud/index.php/s/o98XTeKjZCwJa6c
Rasoul-Zahedifar commented 1 year 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