How to use the b0-based remote API on multiple PCs

Typically: "How do I... ", "How can I... " questions
Post Reply
masatomori
Posts: 5
Joined: 13 Dec 2019, 10:46

How to use the b0-based remote API on multiple PCs

Post by masatomori »

Dear Coppelia,

I would like to access CoppeliaSim using the b0-based remote API with two PCs as client and server respectively.
I use Matlab as my client.

However, I was not able to succeed in these communications.
Do I need to set an IP address like 192.168.0.10 somewhere on the client side?
I thought it might be to set the IP address, like the legacy remote API,
but I didn't see any documentation about this.

If I run client (Matlab) and server (CoppeliaSim) on the same PC, I succeeded.

How can I solve this problem?


I will appreciate your help with this situation.
masato

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: How to use the b0-based remote API on multiple PCs

Post by coppelia »

Hello Masato,

a B0 node will look at the environment variable B0_RESOLVER, e.g.:

Code: Select all

export B0_RESOLVER=tcp://localhost:22000
launch B0 node
on the other hand, the resolver itself will look at B0_RESOLVER_PORT, e.g.:

Code: Select all

export B0_RESOLVER_PORT=22000
launch B0 resolver
Cheers

masatomori
Posts: 5
Joined: 13 Dec 2019, 10:46

Re: How to use the b0-based remote API on multiple PCs

Post by masatomori »

Hello coppelia

Thanks for your reply.
But I don't know where to do these settings.
I tried the following.

<My Environment>
Server : Ubuntu 18.04 (CoppeliaSim)
Client : Windows10 (Matlab)


Server side (ubuntu) terminal :

Code: Select all

$ export B0_HOST_ID=localhost

$ ./b0_resolver -Ldebug
2020-01-31 19:46:39 [resolver] debug: Initialization...
2020-01-31 19:46:39 [resolver] debug: ServiceClient(resolv): Skipping resolution because remote address (tcp://localhost:22000) was given
2020-01-31 19:46:39 [resolver] info: New node has joined: 'resolver'
2020-01-31 19:46:39 [resolver] debug: Initializing sockets...
2020-01-31 19:46:39 [resolver] debug: ServiceServer(resolv): Bound to tcp://*:54653
2020-01-31 19:46:39 [resolver] info: Graph: node 'resolver' offers service 'resolv'
2020-01-31 19:46:39 [resolver] debug: Initialization complete.
2020-01-31 19:46:39 [resolver] debug: ServiceServer(resolv): Bound to additional address tcp://*:22000
2020-01-31 19:46:39 [resolver] info: Graph: node 'resolver' publishes on topic 'graph'
2020-01-31 19:46:39 [resolver] info: Ready.
2020-01-31 19:46:39 [resolver] info: Node spinning...
(”export B0_RESOLVER=tcp://...” did not change the remote address display)

in new terminal :

Code: Select all

$ ./coppeliaSim
...

(launch coppeliaSim)
and open scene "B0-basedRemoteApiDemo.ttt"


Client Side (Windows)

I run "simpleTest.m".
But Matlab tries to access CoppeliaSim on Local (Windows), and that on Ubuntu's side is ignored.

Do I need to configure something more on client (Matlab) or server (Ubuntu) side?


masato

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: How to use the b0-based remote API on multiple PCs

Post by coppelia »

Hello Masato,

you can basically have the resolver run on the server (e.g. Ubuntu) or client (e.g. Windows) side, it won't really matter that much. But I'd keep it anyways on the machine where you run CoppeliaSim. So suppose we keep the resolver on the server side:

So, on the server side, unless you want to change the port number, you do not need to specify anything. Simply launch the resolver, then launch CoppeliaSim.

On the Window side, we need to tell the environment the IP of your server machine, so that the client can find the resolver. So you'd do that with:

Code: Select all

> SET B0_RESOLVER=theIpOfTheServer:22000
But then, unless you set that environment variable system-wide for the user, you need to start your client from the same terminal, i.e. Matlab environment in your case.

Cheers

Post Reply