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

Connecting to server #3

Open
psychemedia opened this issue Sep 8, 2017 · 3 comments
Open

Connecting to server #3

psychemedia opened this issue Sep 8, 2017 · 3 comments

Comments

@psychemedia
Copy link

Trying to connect to the server using with VRep.connect(domain, 19997) as api:, the connection works if I use domain="127.0.0.1" but fails if I use an alias such as domain="localhost" or domain="mydomain":

---------------------------------------------------------------------------
ReturnCommandError                        Traceback (most recent call last)
<ipython-input-7-90f793041880> in <module>()
     31 
     32 
---> 33 with VRep.connect("localhost", 19997) as api:
     34     r = lineFollower(api)
     35     r.fwd_right()

/usr/local/lib/python3.5/dist-packages/pyrep/api.py in connect(ip, port)
     26             return VRepApi(res)
     27         else:
---> 28             raise ReturnCommandError(res)
     29 
     30     def close_connection(self):

ReturnCommandError: Undefined return code: -1
@Troxid
Copy link
Owner

Troxid commented Sep 8, 2017

Hello @psychemedia. This binding is based on the official remote v-rep api. Method VRep.connect just call simxStart.
The exception in you case was occur because simxStart return -1 code ( ReturnCommandError: Undefined return code: -1)
The documentation say, that function can return -1 code if

the connection to the server was not possible (i.e. a timeout was reached)

I tried to connect to the simulator, which work on my laptop in my local network and all works fine.
Check reachability of your domain (port forwarding, dns and etc).
If you are sure, that all is fine on your side, you can report about this error directly to the coppeliarobotics forum.

@psychemedia
Copy link
Author

Hmm... okay.. I was trying to connect to the server from a Jupyter notebook running inside the same VM as the simulator (VM build file here: https://github.com/psychemedia/ou-robotics-vrep/tree/master/robotVM ), albeit with the notebook accessed via a browser on host (but I think the addressing should all be relative to the insides of the VM).

@Troxid
Copy link
Owner

Troxid commented Sep 9, 2017

It's very strange behavior. I will check it later.

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