RemoteAdapter connection

 

Checking to see if connectivity works between multiple instances.  I started by making the RemoteAdapter capable of scanning.  Here 2 instances are connected together - the default way now to avoid name clashes - is the remote instance names are appeneded to the gateway (RemoteAdapter) used for connectivity. I think I made this so in the future you could choose the name - for example myo prefix ...

myo.gui, myo.runtime, myo.etc...

I'd be interested in quickly getting this coded up in the webgui....

The RemoteAdapter allows connectivity over tcp & udp.. the webgui potentially offers connectivity over http..

So for Alessandruino, it looks like most is worky on the develop branch...

A RemoteAdapter in each instance is required.. and to start listening you must use the method remote.startListening()..

Noticed a bug in that if a service created after the connection is not registered in the remote system .. hmm maybe this was by design ...

Anyway you can see data from one streaming to the other with the clock sending out pulses and changing the display in the remote instance...

Potentially we could get an instance running on the internet and try some experiments with a larger distributed system - where the senario might be running ProgramAB in the shoutbox and having other ProgramABs connected and utilizing utterances of both other chatbots & humans...

 


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Alessandruino's picture

Tested with clock and it's

Tested with clock and it's worky yay !

On another side tried with arduino and it connected/disconnected very quickly... Maybe it's gui fault ?

How i can do it without using the gui if that it's the problem?

Ale

GroG's picture

Yep, it was what I

Yep, it was what I expected...  The Arduino Sketch was not serializable .. so it went BOOM instead of flowing over the wire ... fix checked in - worky now ;)

Alessandruino's picture

Worky now !!!! :) one bug i

Worky now !!!! :)

one bug i noticed : the drop menu with serial ports in arduino.serial is worky on the local instance (arduino.serial) but is no worky from the remote instance (remote.arduino.serial) 

Another thing how do i access the remote services in the local python ???

thanks again

Ale

GroG's picture

Hi Ale, sorry been very busy

Hi Ale, sorry been very busy - there's some re-organizing I have to do too, before fixing this .. but I'm working on it now :)

Alessandruino's picture

No worries :) thanks...

No worries :) thanks... Waiting for Santa grog :)

GroG's picture

There's lots of ways to fix

There's lots of ways to fix this.  Once change which happened recently is we dropped RXTXLib for JSSC Yay ! - but there needs to be some work done in order for it to behave like we want it ...

Also there is "Fixed in getting it to work in Python", "Fixed in getting it to work in GUIService" and "Fixed in getting it to work in WebGUI"

.. programmatically (Python) is the most important - but it would be nice to get one of the GUIs to work so anyone could use it that way...

So :
Please tell me how exactly you intend to use it ... e.g.

RasPi without desktop to conserve resources, will be running a headless MRL - it will be connected to an Arduino and that will be connected to my DIY Myo ..  need that to transmit data to Laptop ..

Is that right ?

GroG's picture

Progress....

Progress .. printing out the Arduino version 

Alessandruino's picture

Ya.. Headless on pi... Real

Ya.. Headless on pi... Real myo is on my Mac and send instructions to the remote arduino on raspi... I would like to know how to access the remote service from the local python... Remote.arduino.connect(port) is no worky.. Says that remote has no arduino but I see it on the gui

GroG's picture

Ok my friend ... this worky

Ok my friend ... this worky for me ..
Take the latest - there were some serializaiton issues which I fixed ..

The difference is you will be sending commands to a "real" raspi while I sent commands to a windows platform.

It "should" work the same - but I'll be getting a raspi + arduino set up soon..

Here you can see my pretend mac & pretend raspi

One problem you had previously in Python is "." is an operator ... e.g.    object.method  ..
but the name had a dot in it "remote01.arduino"

So you would have to :
myArduino = Runtime.getService("remote01.arduino")  ... 
or if I remember correctly the Python service changes invalid names to variables like this ...
remote01_arduino.connect("COM18")  <- but even though this is correct notation it would not work - because .connect works locally...   what you really want to do is send a message to connect...

This is easily done this way :

python.send("remote01.arduino","connect","/dev/ttyACM0")


#file : home/GroG/remote.py edit raw
# the mac
remote = Runtime.start("remote","RemoteAdapter")

# this sets the prefix name for any remotely connected services
# through this remote adapter - default if not set would be the
# {remote adatper name}.  e.g.  remote.x
remote.setDefaultPrefix("raspi")

# connect remotely
remote.connect("tcp://127.0.0.1:6767")

# give it a second or two to connect up
sleep(2)

# connect the remote raspi arduino to its local port 
python.send("raspiarduino", "connect","COM18")
sleep(1)

# turn off and on led 13 remotely
for x in range(0, 5):
  python.send("raspiarduino", "digitalWrite", 13, 1)
  sleep(1)
  python.send("raspiarduino", "digitalWrite", 13, 0)
  sleep(1)
  
 

 

laia's picture

I was trying to start the

I was trying to start the clock remotely by code and i tried this:

PC listenner:

clock = Runtime.start("clock","Clock")
remote2 = Runtime.start("remote2","RemoteAdapter")
remote2.startListening(6767)

 

PC remote:

remote = Runtime.start("remote","RemoteAdapter")

remote.setDefaultPrefix("myremote")

remote.connect("tcp://myIp:6767") 

sleep(4)

myremoteclock.startClock()

 

It shows no errors and the connection is ok but it makes no effect to the clock. Why doesn't it work?

Thanks!

GroG's picture

Ahoy laia and Welcome !The

Ahoy laia and Welcome !

The reason its not working is because you are calling the service directly.  If you used messages it would work.

Fortunately, ALL MRL methods are reachable through the messaging interface.

The GUI uses the messaging interface exclusively - that's why it works over remote connections

Try this:
python.send("myremoteclock", "startClock")

should work :)

laia's picture

It worked!thanks! so if I

It worked!thanks!

so if I understood well the messaging interface works like this:

python.send("nameservice","method",parameter1,parameter2) ?

 

GroG's picture

Yep .. Exactly

Yep .. Exactly