jr-robotics/robo-gym-robot-servers

Unable to create Real Robot Environment

Opened this issue · 1 comments

So im at the step "Real Robot Environment" in your github repository. I already started the robot server and am connected to my real world ur5, as you can see in this screenshot:
screen

Now the problem is, when i try to run

import gym, robo_gym
#ip adress of the ur5 = 192.168.9.100 and robot server is 50051 as you can see in the screenshot
env = gym.make('EnvironmentNameRob-v0', rs_address='192.168.0.100:50051')

env.reset()

First i get the following error:

Traceback (most recent call last):
  File "/home/moga/Desktop/start.py", line 3, in <module>
    env = gym.make('EnvironmentNameRob-v0', rs_address='192.168.0.100:50051')
  File "/home/moga/.local/lib/python3.8/site-packages/gym/envs/registration.py", line 569, in make
    _check_version_exists(ns, name, version)
  File "/home/moga/.local/lib/python3.8/site-packages/gym/envs/registration.py", line 219, in _check_version_exists
    _check_name_exists(ns, name)
  File "/home/moga/.local/lib/python3.8/site-packages/gym/envs/registration.py", line 197, in _check_name_exists
    raise error.NameNotFound(
gym.error.NameNotFound: Environment EnvironmentNameRob doesn't exist. Did you mean: `EmptyEnvironmentURRob`?

So i change EnviromentNameRob to EmptyEnvironmentURRob, leaving my code looking like this:


import gym, robo_gym

env = gym.make('EmptyEnvironmentURRob-v0', rs_address='192.168.0.100:50051')

env.reset()
""""
But when i run it now i get the following Error: 

"""
/bin/python3 /home/moga/Desktop/start.py
/home/moga/.local/lib/python3.8/site-packages/gym/spaces/box.py:127: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
/home/moga/.local/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:174: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator.
  logger.warn(
/home/moga/.local/lib/python3.8/site-packages/gym/utils/passive_env_checker.py:187: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information.
  logger.warn(
Traceback (most recent call last):
  File "/home/moga/Desktop/start.py", line 5, in <module>
    env.reset()
  File "/home/moga/.local/lib/python3.8/site-packages/gym/wrappers/order_enforcing.py", line 42, in reset
    return self.env.reset(**kwargs)
  File "/home/moga/.local/lib/python3.8/site-packages/gym/wrappers/env_checker.py", line 45, in reset
    return env_reset_passive_checker(self.env, **kwargs)
  File "/home/moga/.local/lib/python3.8/site-packages/gym/utils/passive_env_checker.py", line 192, in env_reset_passive_checker
    result = env.reset(**kwargs)
  File "/home/moga/Desktop/robo-gym/robo_gym/envs/ur/ur_base_env.py", line 104, in reset
    if not self.client.set_state_msg(state_msg):
  File "/home/moga/.local/lib/python3.8/site-packages/robo_gym_server_modules/robot_server/client.py", line 17, in set_state_msg
    msg = self.robot_server_stub.SetState(state_msg, timeout = 60)
  File "/home/moga/.local/lib/python3.8/site-packages/grpc/_channel.py", line 1030, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/home/moga/.local/lib/python3.8/site-packages/grpc/_channel.py", line 910, in _end_unary_response_blocking
    raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:192.168.0.100:50051: Failed to connect to remote host: Connection refused"
        debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:192.168.0.100:50051: Failed to connect to remote host: Connection refused {created_time:"2023-03-31T16:20:50.938544639+02:00", grpc_status:14}"
>

What am i doing wrong here? thank you in advance for every help im a bit lost

Hey @KarimHP,
if you are still struggling with this:
Can you double-check that your IP addresses are correct?
192.168.9.100: UR
192.168.0.100: robot server
(maybe on the same machine, maybe somewhere else): agent/environment test script

Is a ping from your agent machine to 192.168.0.100 successful?
If yes, can you try if the robot server at 192.168.0.100:50051 is reachable with a gRPC test tool, such as Warthog (make sure to switch to insecure connection)?