Arduino Yun and Autobahn: Serial Communication Problem

78 views
Skip to first unread message

Chris Barnett

unread,
Sep 11, 2014, 3:09:02 PM9/11/14
to autob...@googlegroups.com
Hi Tobias, Autobahn Team, et al.,

I'm currently working on a project involving the Arduino Yun.  I found your excellent tutorial on connecting the Yun with Autobahn.  


I had successful implemented your example using the previous version of Autobahn.  Everything worked great.... Graphs were nice and data was streaming in as expected.

Unfortunately, I recently upgraded to the latest version so the I could utilize WAMP v2...after the upgrade things functioned basically the same as before except now the data stream seems to be coming in batches.. i.e. instead of a nice constant stream of data flowing from Yun through the AutobahnPython Server and forwarded to the browser AutobahnJS client, I now get bursts of data, then a delay, then another burst of data... Also command messages sent back from the AutobahnJS client to the AutobahnPython server to start and stop the analog data stream don't get immediately forwarded to the device firmware via the serial port.  So what ends up happening is the graph looks wrong as there are long intervals between data points, and starting and stopping the stream ends up being delayed and does not feel real time.

Any ideas on how I could figure out why the behavior has changed post upgrade...?

Thanks in advance for taking a look and very much appreciate any assistance you can provide.

p.s. I'm on the #Autobahn IRC channel (CBarnett) if anyone wants to connect with me there...

Best Regards,
Chris Barnett


Tobias Oberstein

unread,
Sep 11, 2014, 3:34:25 PM9/11/14
to autob...@googlegroups.com
Am 11.09.2014 21:09, schrieb Chris Barnett:
> Hi Tobias, Autobahn Team, et al.,

Hi Chris,

I've recently updated the code for the example for the latest
AutobahnPython (0.9.0) - and tested it on real device - works for me
flawlessly. Did you use AutobahnPython 0.9.0 and

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/app/serial2ws

?

Cheers,
/Tobias
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/332c43d3-af15-49ba-be77-04004df25632%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/332c43d3-af15-49ba-be77-04004df25632%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Chris Barnett

unread,
Sep 11, 2014, 3:47:41 PM9/11/14
to autob...@googlegroups.com
Hi Tobias,

Thanks for getting back to me... much appreciated...

I just verified the AutobahnPython version, and as you suspected it was not (0.9.0).. instead it was (0.8.15)... which seemed to match what was in your tutorial (attached screenshot from your tutorial)... I followed the tutorial to update autobahn using easy_install... perhaps I missed something... How can I force easy_install to update to the .9 version...? any others I should check...?

Btw... I'm on the #autobahn IRC channel if that's easier... CBarnett

Best Regards,
Chris Barnett
Founder & CEO
Inspire2Innovate LLC
http://www.inspire2innovate.com
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/QiYKWPVTzM8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/5411F93C.7080402%40gmail.com.
AutobahnYunTutorial.PNG

Tobias Oberstein

unread,
Sep 11, 2014, 4:37:13 PM9/11/14
to autobahnws

try: easy_install --upgrade autobahn

Sent from Mobile (Google Nexus 5)

To unsubscribe from this group and stop receiving emails from it, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

Chris Barnett

unread,
Sep 11, 2014, 4:49:57 PM9/11/14
to autob...@googlegroups.com

Hi Tobias,

 

Thanks again for getting back to me…  I tried that but am running into issues with setuptools…   which may explain why things aren’t working as expected… I think I’m going to flash the Yun and restart from a fresh image…  I’ll let you know how that goes, and if it resolves my issues… 

 

Do you happen to know if there is a process to back up the Yun once I have everything working…?  So if things get messed up again, I can roll back to a clean working setup…

 

Best Regards,

Chris Barnett

Founder & CEO

Inspire2Innovate LLC

http://www.inspire2innovate.com

 

 

Tobias Oberstein

unread,
Sep 11, 2014, 5:26:17 PM9/11/14
to autob...@googlegroups.com
Hi Chris,

actually you are right: I tested the example with Autobahn 0.8.15 - but
0.9.0 should work as well.

Most time I spent fiddling with approaches extending the disk space ..
the stuff under "Expanding Disk Space" was working conveniently in the
end. The downside is that the SD is slow as crap when used as an overlay
FS (without async writes).

Regarding backup: I don't know. But most of the SW is installed on SD
card anyway. You should be able to reinsert that into a new Yun when
redoing the FS overlay steps ..

Cheers,
/Tobias


Am 11.09.2014 22:49, schrieb Chris Barnett:
> Hi Tobias,
>
> Thanks again for getting back to me… I tried that but am running into
> issues with setuptools… which may explain why things aren’t working as
> expected… I think I’m going to flash the Yun and restart from a fresh
> image… I’ll let you know how that goes, and if it resolves my issues…
>
> Do you happen to know if there is a process to back up the Yun once I
> have everything working…? So if things get messed up again, I can roll
> back to a clean working setup…
>
> Best Regards,
>
> Chris Barnett
>
> Founder & CEO
>
> Inspire2Innovate LLC
>
> http://www.inspire2innovate.com
>
> *From:*autob...@googlegroups.com [mailto:autob...@googlegroups.com]
> *On Behalf Of *Tobias Oberstein
> *Sent:* Thursday, September 11, 2014 1:37 PM
> *To:* autobahnws
> *Subject:* RE: Arduino Yun and Autobahn: Serial Communication Problem
>
> try: easy_install --upgrade autobahn
>
> Sent from Mobile (Google Nexus 5)
>
> Am 11.09.2014 20:47 schrieb "Chris Barnett" <barnet...@gmail.com
> <mailto:barnet...@gmail.com>>:
> <mailto:autobahnws%2Bunsu...@googlegroups.com>
> > <mailto:autobahnws+...@googlegroups.com
> <mailto:autobahnws%2Bunsu...@googlegroups.com>>.
> > To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>
> > <mailto:autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/autobahnws/332c43d3-af15-49ba-be77-0
> > 4004df25632%40googlegroups.com <http://40googlegroups.com>
> >
> <https://groups.google.com/d/msgid/autobahnws/332c43d3-af15-49ba-be77-04004df25632%40googlegroups.com?utm_medium=email&utm_source=footer>.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Autobahn" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/autobahnws/QiYKWPVTzM8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> autobahnws+...@googlegroups.com
> <mailto:autobahnws%2Bunsu...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/5411F93C.7080402%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws%2Bunsu...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/00ad01cfcdf9%243f2c91b0%24bd85b510%24%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Autobahn" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/autobahnws/QiYKWPVTzM8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/CABuE%2BY7v7L6hhWS-69scHZfDAJ46uimC1U7x820U4CurrPaagA%40mail.gmail.com
> <https://groups.google.com/d/msgid/autobahnws/CABuE%2BY7v7L6hhWS-69scHZfDAJ46uimC1U7x820U4CurrPaagA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/00d801cfce01%24f23e1dc0%24d6ba5940%24%40gmail.com
> <https://groups.google.com/d/msgid/autobahnws/00d801cfce01%24f23e1dc0%24d6ba5940%24%40gmail.com?utm_medium=email&utm_source=footer>.

Chris Barnett

unread,
Oct 29, 2014, 3:11:38 PM10/29/14
to autob...@googlegroups.com
Hi Tobias,

Ran into another question related to Autobahn and CrossbarIO....

Setup is AngularJS client + express/mongodb NodeJS app (i.e. MEAN) + crossbarIO using AutobahnJS...

Any idea how can to get the clients IP address inside a autobahn rpc session callback running inside Node...? I want to be able to identify the unique public IP address of the user making the rpc call...

If the client IP is available, any idea how it's obtained...? would it work in load balancing scenarios where the source IP address may be for upstream load balancers or proxies... would it look for something like an X-forwarded-for header to obtain the actual clients IP address...? Any insights you could provide would be appreciated...

p.s. sorted out my issues with the Arduino Yun and Autobahn.... with a clean install everything works like a charm...
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/54121377.6040603%40gmail.com.

Tobias Oberstein

unread,
Oct 30, 2014, 7:15:06 PM10/30/14
to autob...@googlegroups.com
Hi Chris,

> Ran into another question related to Autobahn and CrossbarIO....
>
> Setup is AngularJS client + express/mongodb NodeJS app (i.e. MEAN) + crossbarIO using AutobahnJS...
>
> Any idea how can to get the clients IP address inside a autobahn rpc session callback running inside Node...? I want to be able to identify the unique public IP address of the user making the rpc call...

A procedure can be registered asking the router to provide caller
details at invocation time. E.g. in a Python WAMP component:

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/rpc/options/backend.py#L49

Currently, Crossbar.io provides information like WAMP session ID or
authid/authroles of the caller.

But no transport level information, like e.g. IP address (when the
caller was using a TCP based WAMP transport to connect to the router),
or even the WAMP transport type (WAMP-over-WebSocket-over-TCP,
WAMP-over-RawSocket-over-UnixDomainSockets, ..).

I've added an issue for that:
https://github.com/crossbario/crossbar/issues/142

It's more or less trivial to implement, but code must be written.

>
> If the client IP is available, any idea how it's obtained...? would it work in load balancing scenarios where the source IP address may be for upstream load balancers or proxies... would it look for something like an X-forwarded-for header to obtain the actual clients IP address...? Any insights you could provide would be appreciated...

Yes, if the client connects to the router via
WAMP-over-WebSocket-over-TCP (the usual WAMP transport), the IP that
Crossbar.io sees when a reverse proxy is in front is the IP of the proxy.

Additionally, it is possible to remember HTTP headers (x-forwarded) from
the initial WebSocket opening handshake. I've added that to the issue.
Can be done in Crossbar.io without changes to AutobahnPython
(WebSocketServerProtocol.onConnect() handler gets all HTTP headers from
WS handshake).

However, please keep in mind: WAMP is about decoupling.

If you rely on stuff like a caller IP in your app code, you introduce
coupling. Further, what if the caller doesn't connect over TCP at all?
Like over Unix domain sockets?

What do you plan to do with the IP? What is your actual goal?

>
> p.s. sorted out my issues with the Arduino Yun and Autobahn.... with a clean install everything works like a charm...

That is good to hear! I have the impression that the tutorial is quite
tricky to follow still ... this Yun fiddling etc. It's not your usual
modern Linux where everything works like a charm. Don't know how to make
it simpler/shorter though ..

Cheers,
/Tobias

Chris Barnett

unread,
Nov 6, 2014, 3:04:59 PM11/6/14
to autob...@googlegroups.com
Hi Tobias,

Thanks for the feedback... much appreciated... and thanks for adding
the issues related to the IP info... all makes sense, and as for the client
IP I don't have a critical need for it (i.e. coupling), but do have a few
features in mind where it would be nice to have... also, it's always good
for logging, debugging, metrics, etc... if I get time on my end, and end up
adding the necessary changes you referenced, I'll shoot you a pull
request...

As for the Arduino tutorial, I actually thought it was easy to
follow and had things working in no time with a clean environment... just
one of those instances where I was playing around with too many toys and
screwed up the environment... I'd definitely give you props for a great
example.

One additional question re: AutobahnJS + Crossbar.... I'm trying to
get details about the current autobahn session running inside Node JS.
Specifically details about registered RPC methods and remote subscribers.
RPC registrations are working no problem... However, when a remote client
subscribes to a channel I don't see the subscriptions array (i.e. the copy
returned by the subscriptions property, or the _subscriptions internal
dictionary object) updated, however the clients do seem to be subscribed and
do receive update event callbacks from the channel. I've tried setting a
breakpoint in the session.js code where I think subscription events should
be added to the array, but it never seems to get called, whereas RPC
registrations definitely are... Is Crossbar intercepting the subscription
calls from remote clients in some way...? Does it have to do with the RPC
registrations happening server side directly in Node, vs remote clients
subscribing I assume routed through Crossbar...? and apologies if I'm miss
understanding how these components work together... still ramping up on this
stuff..

Best Regards,
Chris Barnett
Founder & CEO
Inspire2Innovate LLC
http://www.inspire2innovate.com


-----Original Message-----
From: autob...@googlegroups.com [mailto:autob...@googlegroups.com] On
Behalf Of Tobias Oberstein
Sent: Thursday, October 30, 2014 4:15 PM
To: autob...@googlegroups.com
Subject: Re: Arduino Yun and Autobahn: Serial Communication Problem

Hi Chris,

https://groups.google.com/d/msgid/autobahnws/5452C670.9040808%40gmail.com.
winmail.dat

Tobias Oberstein

unread,
Nov 6, 2014, 6:47:31 PM11/6/14
to autob...@googlegroups.com
Hi Chris,

> As for the Arduino tutorial, I actually thought it was easy to
> follow and had things working in no time with a clean environment... just

Alright, this is good to hear! For some reasons, this particular post
draws quite some eyeballs and I am still learning how to write up stuff
so it's nice to read and easy to grasp.

> One additional question re: AutobahnJS + Crossbar.... I'm trying to
> get details about the current autobahn session running inside Node JS.
> Specifically details about registered RPC methods and remote subscribers.
> RPC registrations are working no problem... However, when a remote client
> subscribes to a channel I don't see the subscriptions array (i.e. the copy
> returned by the subscriptions property, or the _subscriptions internal
> dictionary object) updated, however the clients do seem to be subscribed and
> do receive update event callbacks from the channel. I've tried setting a
> breakpoint in the session.js code where I think subscription events should
> be added to the array, but it never seems to get called, whereas RPC
> registrations definitely are... Is Crossbar intercepting the subscription
> calls from remote clients in some way...? Does it have to do with the RPC
> registrations happening server side directly in Node, vs remote clients
> subscribing I assume routed through Crossbar...? and apologies if I'm miss
> understanding how these components work together... still ramping up on this
> stuff..

With both RPC and PubSub, the only entity that knows what URI maps to
what is the router. It does all the bookkeeping and all the forwarding
of messages to the right clients.

What you see here

https://github.com/tavendo/AutobahnJS/blob/master/package/lib/session.js#L214

and here

https://github.com/tavendo/AutobahnJS/blob/master/package/lib/session.js#L217

is just the _local_ tracking of subscriptions and registrations that
have been issued by the _particular_ client which runs this code
(AutobahnJS).

It is not a global list of subscriptions or registrations (which only
the router has).

Hope above helps - but yes, there is some learning curve associated with
WAMP and all the other stuff and how everything fits together. The "docs
issue". If you have suggestions how to lower the bar: yes please! In
particular since once you "got it", you might forget about the initial
hurdles;)

Cheers,
/Tobias

Reply all
Reply to author
Forward
0 new messages