hybridgroup / artoo-sphero

Artoo adaptor for the Sphero robot.
http://artoo.io
Other
24 stars 11 forks source link

jruby - artoo connect serial not listening on port #6

Closed PragTob closed 11 years ago

PragTob commented 11 years ago

Hi there,

thanks for making artoo. I got a sphero and today I wanted to play with it a bit from ruby. I got jruby-1.7.6 and I tried following the guide but things didn't work as they should.

I'm running Linux Mint Debian Edition latest Update Pack.

Basically it seems to me that the artoo connect serial command does not actually result in something listening on that port. I'll give you my basic shell output:

tobi@speedy:~$ cd github/shoes-artoo/
tobi@speedy:~/github/shoes-artoo$ artoo connect scan
         run  hcitool scan from "."
Scanning ...
    68:86:E7:00:3D:BE   Sphero-OYP
tobi@speedy:~/github/shoes-artoo$ artoo connect bind 68:86:E7:00:3D:BE Sphero-OYP
         run  sudo rfcomm -i hci0 bind /dev/rfcomm0 68:86:E7:00:3D:BE 1 from "."
[sudo] password for tobi: 
         run  sudo ln -s /dev/rfcomm0 /dev/Sphero-OYP from "."
tobi@speedy:~/github/shoes-artoo$ artoo connect serial Sphero-OYP 8023
         run  sudo chmod a+rw /dev/Sphero-OYP from "."

Exception: java.lang.ThreadDeath thrown from the UncaughtExceptionHandler in thread "Thread-17"
         run  socat -d -d FILE:/dev/Sphero-OYP,nonblock,raw,b57600,echo=0 TCP-LISTEN:8023,fork from "."
tobi@speedy:~/github/shoes-artoo$ netstat -a | grep 8023
tobi@speedy:~/github/shoes-artoo$ ruby try.rb 
I, [2013-11-08T00:56:46.400000 #4674]  INFO -- : Registering connection 'sphero'...
I, [2013-11-08T00:56:46.407000 #4674]  INFO -- : Registering device 'sphero'...
hereeee
I, [2013-11-08T00:56:46.410000 #4674]  INFO -- : Preparing work...
I, [2013-11-08T00:56:46.438000 #4674]  INFO -- : Initializing connection sphero...
I, [2013-11-08T00:56:46.490000 #4674]  INFO -- : Initializing device sphero...
I, [2013-11-08T00:56:46.537000 #4674]  INFO -- : Starting work...
I, [2013-11-08T00:56:46.540000 #4674]  INFO -- : Connecting to 'sphero' on port '127.0.0.1:8023'...
E, [2013-11-08T00:56:46.616000 #4674] ERROR -- : Connection refused
E, [2013-11-08T00:56:46.617000 #4674] ERROR -- : Artoo::Adaptors::Sphero crashed!
Java::JavaNet::ConnectException: Connection refused
(snipppp)

When I rerun artoo connect serial Sphero-OYP 8023 it just does:

tobi@speedy:~/github/shoes-artoo$ artoo connect serial Sphero-OYP 8023
         run  sudo chmod a+rw /dev/Sphero-OYP from "."
         run  socat -d -d FILE:/dev/Sphero-OYP,nonblock,raw,b57600,echo=0 TCP-LISTEN:8023,fork from "."

But yeah. still no effect.

Ah yes, try.rb is the sample from the guide e.g. the connection code is:

require 'artoo'

connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:8023'
device :sphero, :driver => :sphero

So yes, 8023 is the right port :-)

Help? =D

Cheers, Tobi

PS: Oh btw. I got sphero 2.0

PragTob commented 11 years ago

Hi there,

any information/tips/update about this?

Tobi

deadprogram commented 11 years ago

@edgarSilva & @adzankich can you guys please look into this? Thanks!

zankich commented 11 years ago

@PragTob whats the output of

$ socat -V
PragTob commented 11 years ago

Output is this:

tobi@speedy:~/github/shoes-artoo$ socat -V
socat by Gerhard Rieger - see www.dest-unreach.org
socat version 1.7.2.2 on Jul 21 2013 16:13:55
   running on Linux version #1 SMP Debian 3.10.5-1 (2013-08-07), release 3.10-2-amd64, machine x86_64
features:
  #define WITH_STDIO 1
  #define WITH_FDNUM 1
  #define WITH_FILE 1
  #define WITH_CREAT 1
  #define WITH_GOPEN 1
  #define WITH_TERMIOS 1
  #define WITH_PIPE 1
  #define WITH_UNIX 1
  #define WITH_ABSTRACT_UNIXSOCKET 1
  #define WITH_IP4 1
  #define WITH_IP6 1
  #define WITH_RAWIP 1
  #define WITH_GENERICSOCKET 1
  #define WITH_INTERFACE 1
  #define WITH_TCP 1
  #define WITH_UDP 1
  #define WITH_SCTP 1
  #define WITH_LISTEN 1
  #define WITH_SOCKS4 1
  #define WITH_SOCKS4A 1
  #define WITH_PROXY 1
  #define WITH_SYSTEM 1
  #define WITH_EXEC 1
  #undef WITH_READLINE
  #define WITH_TUN 1
  #define WITH_PTY 1
  #define WITH_OPENSSL 1
  #undef WITH_FIPS
  #define WITH_LIBWRAP 1
  #define WITH_SYCLS 1
  #define WITH_FILAN 1
  #define WITH_RETRY 1
  #define WITH_MSGLEVEL 0 /*debug*/

Is socat a dependecy that i missed? Needed to install that package.

Thanks for the help! Tobi

PragTob commented 11 years ago

Yes it seems that socat was a dependency, sample works now, thanks.

That dependency should absolutely be mentioned in the docs and the failure message maybe could be improved at one point.

Is the website open source e.g. can I submit a PR? I dunno the source so improving the error message seems harder to do for me, but if you give me a pointer I'd also love to do this.

Thanks for your help, Tobi