ROStful vs rosbridge for web control of my bot?

482 views
Skip to first unread message

Mark Johnston

unread,
Dec 31, 2014, 3:24:54 AM12/31/14
to hbrob...@googlegroups.com
I was forming a simple javascript interface that I would hack to control my ROS bot when it dawned on me this is no new issue and there must be solutions.

I'll be researching ROStful as it seems least clumbsy from it's description but am open to comments on successes with rosbridge

I wonder if anybody could comment on successes or headaches related to control of a bot through either of these methods?
Feel free to discus control of a bot using some other simple  http get sort of approach



MORE DETAIL FOLLOWS FOR MY GENERAL NEEDS/EXPECTATIONS for those who may know of these things

The high level control would come from android with widgets and so on or buttons at first building off a simple REST Api starting project for android I got going today.

In the last day I put together proto code that does very simple Node.js server on my RaspberryPi that replies to http requests that come in from my android app.  This is just proto-mess-around stuff at this time but works ok but does NOT involve my ROS nodes in any way.  THAT is what I want to do, control/monitor ROS using REST or some similary standard interface but prefer 'clean' and not some hacked low-level socket stuff. 

My high level goals at this time include these things:
 - Press buttons on android that tell my bot do do assorted things.  This means send perhaps separate REST messages with parameter(s) for 8 or more functions. Ideally I would like to receive these requests in an existing or new ROS node that I could then do state control of my bot much like my existing RF control input or SparkCore serial interface.
 
 - Query info from my bot with replies that I then present on Android.   All I need here is some way to expose a ROS service that can respond to queries from information my ROS node(s) have obtained (so some internal topic conversations may be done to get the reply info).

- Here is the 'biggie'.   Two days ago I got my raspicam capturing images encoded to jpeg and I wish to have a request for latest image with associated reply back to my android again using REST with perhaps JSON packaging the jpeg.    

Any recommendations from those of you who I know have done some of these things?

Thanks for any experiences or pointers to perhaps other clean web intefaces into a ROS oriented bot

Mark Johnston

anfederman@comcast

unread,
Dec 31, 2014, 1:25:16 PM12/31/14
to hbrob...@googlegroups.com
Patrick's second book covers this topic in detail and the code is downloadable.
--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.

Mark Johnston

unread,
Dec 31, 2014, 5:02:17 PM12/31/14
to hbrob...@googlegroups.com
Thanks Alan.  Had been meaning to look into his books.  Have bought second edition.
I had been meaning to support his great efforts anyway, just had not gotten to it AND the book looks real good.
mark

Happy New Year All!

Message has been deleted

Mark Johnston

unread,
Jan 9, 2015, 2:53:55 AM1/9/15
to hbrob...@googlegroups.com
Little help:    How do I enable verbose logging or at least warnings and errors and maybe packet reception in the rosapi and rosbridge_websocket log?.  At this time both the rosapi and the rosbridge_websocket logs have diddly squat once the nodes start up (nicely I think).

I have removed a much longer discussion earlier posted to keep this clean.  I do see packets hitting my RaspPi port 9090  via tshark packet capture now running native on the RaspPi so packets ARE hitting the port 9090.

My BIG question besides logging is if there has been some issues using javascript to a protocol such as ws:   as used in rosbridge like firewall or setting legal protocols and so on that may not naturally be expected by some part of my TCP stack on a Raspberry pi.  Gotta admit,  protocol ws: is anything but 'standard' outside of our nitch usage and I 'bet' it means willow springs protocol.   I question if something is converting it to http and that is why I see a 'GET /HTTP/1.1 ...  to port 9090 in my packet snoops.

Has anyone seen issues in the rosbridge use of  URLs like   ws://192.168.1.85:9090 in  demos like  simple_gui  javascript ros frontend in Patricks second ROS book, chapter 13.  

anfederman@comcast

unread,
Jan 9, 2015, 9:55:31 AM1/9/15
to hbrob...@googlegroups.com
Can you turn on verbose logging when connected via ssh or console?
--

Rudy Rimland, CISSP

unread,
Jan 9, 2015, 2:43:20 PM1/9/15
to hbrob...@googlegroups.com
Check the bottom of this link (setting ROS log verbosity level) to see if it helps:
http://wiki.ros.org/roscpp/Overview/Logging

Separately, do you have strace in your OS image?  At least you might get some insight into the system calls, and maybe drill into where things go south.

strace <command>                            # trace (and run) the specified command, output system calls to stdout
strace -p <pid> -o someLogFile              # log all system calls from specified process ID to file
strace -p <pid> -e trace=network -o someLogFile # Trace a process by process ID, log network system calls to file

strace -f -p <pid> -o someLogfile           # Follow into forked processes, log all system calls to file

Hope this helps if no authoritive answer on your log question.  Since you are sending a GET from a client (and seeing the packets on the local interface), the basic TCP network handshake must have succeeded.  Therefore I assume ping succeeds, and if you are running sshd, that also works.  This does point to an application-level issue.

Regards,
Rudy

Rudy Rimland, CISSP

unread,
Jan 9, 2015, 2:43:21 PM1/9/15
to hbrob...@googlegroups.com
Oops, small error.  Fingers were on autopilot.  By default, strace writes to stderr.  In my first strace example, replace stdout with stderr in the comment.

Mark Johnston

unread,
Jan 9, 2015, 6:25:45 PM1/9/15
to hbrob...@googlegroups.com
Ok on logging, thanks.   Sadly, zip happens in the log even DEBUG level BUT I wanted to know how to set log level and you 'delivered'.  I should have just searched ros wiki for that one but again, thanks.  I have wanted DEBUG in the past, just never dug in yet.  Lot of stuff in ROS.
  
On a little more using netstat -l -p   I see that in fact I do have port 9090 open BUT it seems no process hanging on the socket listen that  'cares'
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:9090                  *:*                     LISTEN      -

Above seems highly suspicious of a grave issue.

I have python-dev  version 2.7.3-4+deb7u1.  I bet something opened the socket but things went sour with no log somehow or something is missing.

I should state that my attempts to get Patricks rbx2 simple_gui packages installed lead to huge amounts of grief as the install of all that stuff for the full demo failed badly on my raspberry pi in many ways.  So I backed out install of packages for full Book 2 and tried to install what I could that would work.  I feel uncomfortable with the install process yet rosbridge_websocket and rosapi appear to be very 'happy' running.   This may be a subtle lack of some key python piece that if not present rosbridge_websocket just blindly goes on and does not think that may be an issue.

Remember:  'Nothing is easy, anybody who tells you so is selling something'
Cheers,   Mark  (I continue to work on this ...)

anfederman@comcast

unread,
Jan 9, 2015, 6:52:26 PM1/9/15
to hbrob...@googlegroups.com
I think Raspberry Pi on ROS Hydro is a tall order.  I don't know of too many who have gotten far.  I gave up after about 8 hours.   Moving on isn't the same thing as quitting.  Can you duplicate the problem on two Ubuntu systems?  I am going to try rosbridge eventually, so by all means flail away, as you may discover something valuable.  It might be more rewarding to beat a horse that isn't already dead. 
 
BTW  -  does anyone know of a remote desktop app that works Android to Ubuntu?  Even a good ssh term would suffice for keyboard teleop. If we could get a remote desktop up from a phone, you could do some demos without have to worry about ROStful or rosbridge. (yes it is cheating, but I am not proud.)   I tried Chrome remote desktop - but either I am stupid, the documentation is poor, or it doesn't work.

Sent: Friday, January 09, 2015 3:25 PM
Subject: [HBRobotics] Re: ROStful vs rosbridge for web control of my bot?

Rudy Rimland, CISSP

unread,
Jan 9, 2015, 7:22:22 PM1/9/15
to hbrob...@googlegroups.com

On 1/9/15 3:52 PM, anfederman@comcast wrote:
 It might be more rewarding to beat a horse that isn't already dead. 
:D

 
BTW  -  does anyone know of a remote desktop app that works Android to Ubuntu?  Even a good ssh term would suffice for keyboard teleop.
Check out this for a desktop client:
https://www.realvnc.com/products/android/
Then install a VNC server on whatever device.  For ubuntu 12:
https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12

On iPhone, I have iSSH from Zinger-Soft as a remote terminal.  Screen size is an issue, I can have full lines or tiny fonts.
For Android, this is similar, with same criticism:
https://play.google.com/store/apps/details?id=com.sonelli.juicessh&hl=en


Regards,
Rudy

Rudy Rimland, CISSP

unread,
Jan 9, 2015, 7:22:23 PM1/9/15
to hbrob...@googlegroups.com
Try:
sudo netstat -l -p

On some *nix's, PID is not displayed to non-root users...

Mark Johnston

unread,
Jan 10, 2015, 2:29:32 AM1/10/15
to hbrob...@googlegroups.com

Alan:  Yes, I have had many struggles with ros hydro on top of wheezy mostly related to anything using gui or visualization things.
I do have a many-node bot running ROS on hydro well but all the nodes are hand-made so up to now it has gone rather well.

My only linux box is indigo at this time and I'm likely to mess with that next to hopefully make some progress on rosbridge.

Rudy: On my problem at hand, yes, I can see a phthon PID hanging off in listen mode on port 9090 using 'sudo netstat' so good tip Rudy.
I don't see anything from the DEBUG mode on rosbridge_wsocket 
I also don't see any activity using strace on that python pid but again, nice tools are better than none.

I did run a  'telnet  <myRaspPiIpAddr> 9090 and I can see the netstat show established connection but I don't know (yet) what to force into that telnet to see if rosbridge would pick it up.  I found the rosbridge api and will look for something 'simple' to test with telnet as long as no binary is required for me to enter in telnet ...

Right after the RaspPi sends out the  'GET /HTTP/1.1'  message the Pi sends back a TCP ACK but nothing more


In the way of remotes to RaspPi (not ubuntu)
On my RPi I generally run 

Rafael Skodlar

unread,
Jan 10, 2015, 3:48:17 AM1/10/15
to hbrob...@googlegroups.com
Mark,

On 01/09/2015 03:25 PM, Mark Johnston wrote:
> Ok on logging, thanks. Sadly, zip happens in the log even DEBUG level
> BUT I wanted to know how to set log level and you 'delivered'. I should
> have just searched ros wiki for that one but again, thanks. I have
> wanted DEBUG in the past, just never dug in yet. Lot of stuff in ROS.
>
> On a little more using netstat -l -p I see that in fact I do have port
> 9090 open BUT it seems no process hanging on the socket listen that 'cares'
> Proto Recv-Q Send-Q Local Address Foreign Address
> State PID/Program name
> tcp 0 0 *:9090 *:*
> LISTEN -
>
> Above seems highly suspicious of a grave issue.

That seems OK to me. To see what program is listening on that port you
may try the following
lsof | grep 9090 | less

It's not possible that port would be open but nothing there to listen.
It could be broken daemon but that should be evident some other way.

You may restart the listening daemon or try to setup debugging session
like this:

infile=/tmp/inflow.$$
outfile=/tmp/outflow.$$
bpipe=/tmp/backpipe.$$
debug_port=8080
port=9090
export infile outfile bpipe debug_port port

start the following command on the server side; all on one command line:

nc -l -p $debug_port < $bpipe | tee -a $infile | nc localhost $port |
tee -a $outfile > $bpipe

From your client side send a request with whatever app you are using,
to server side on $debug_port that will be redirected to your server
daemon and captured into a file at the same time. The nc command will
terminate after each connection.

I tested it with connection to the webserver using appropriate ports as
I do not have ROS system running.

You may inject desired string to netcat from client side as well. Open
two terminals, one for listening on the server side using the above
command, and one for emulating the client:

echo "some string" | nc localhost $debug_port

There are variations on how to use netcat with pipes etc. see man pages ...
I hope it helps.

--
Rafael

Mark Johnston

unread,
Jan 10, 2015, 6:15:49 PM1/10/15
to hbrob...@googlegroups.com
Thanks Rafael,
I was able to see that the pid that was listening was the python from rosbridge.   I will try your great suggestions later.

Since yesterday I have gotten rosbridge and the demo from Patricks book to be easily installed and working fine on Ubuntu 14.04 running ros indigo per Alan's post.

I have easily gotten the web browser to connect to javascript/rosbridge so that at least is a 'sainity check' although on extremely more supported platform.

I'll keep poking along and at some point have to abort on rosbridge to go back to my older simple javascript home-brew scheme but I badly want rosbridge as it's much more standard and I could use it on other platforms (like my Ubuntu that does work)

Thanks,  Mark

Mark Johnston

unread,
Jan 30, 2015, 9:03:13 PM1/30/15
to hbrob...@googlegroups.com

After extremely low level debug of this issue on Raspberry Pi soaking up intense numbers of hours and days I decided it was time to cut my losses and switch gears in a dramatic way.
I had a BeagleBone Black that I had extreme grief on prior to RaspPi trying to get ROS to run on it's native Angstrom dist (Important safety tip:  Don't go there, go straight to Ubuntu on BBBlack)

SO I have not done a few things to resolve my problem in the last several  days although they are 'rather extreme' I'll cut to the quick and summarize:
 - Make a converter board to allow running my custom IO board for fiddlerbot  http://www.mark-toys.com/RoboticsCreations.html#FiddlerBot) on a beaglebone black.  
   NO frying of any hardware due to very careful triple checks as is required in mixed 5V/3.3V logic common these days.  fortunately I have very accurate schematic and used a TON of I2C so it's simple.
 - Bring up Ubuntu 14.04.1 LTS on my BeagleBone black on 16Gig microSD and install ROS indigo and Patrick's rbx2 code (using minimal required code and avoiding rviz)  
 - Place my entire raspberry Pi source of 8 custom ROS nodes for FiddlerBot in my GitHub (not really required but I did it as it was a goal anyway).
 - Pull my GitHub RosBo repository to BeagleBoneBlack and make an hours worth of changes in my hardware .h file so I could run this code on BBBlack AND RaspPi if I every go back. 

Result:    1)  rosbridge issue is no longer an issue and that works 'out of box' for Patrick's ROS vol 2 book chapter 13 demo.  
               2) My FiddlerBot is back with 100% functionality but now powered by BBBlack and RaspPi is in a box of 'old' parts.  PLUS BBBlack finally on air with lot more IO than RaspPi.

Conclusion:   I got a heck of a lot to work under ROS on RaspPi but hit a HUGE brick wall in working with RosBridge and have decided that is NOT going to happen (ever) on RaspPi on my watch.  Total waste of WEEKS of effort.  Oh well, such is life in Tech-City.

Thanks for inputs,
Mark Johnston

Reply all
Reply to author
Forward
0 new messages