Ask Your Question

Exceptions not being caught using rosbridge version 1.0

asked 2012-10-05 04:15:37 -0500

Pi Robot gravatar image

updated 2012-10-05 04:16:21 -0500


I have been developing an HTML5/Javascript GUI using version 1.0 of rosbridge and most functions are working perfectly. However, I just noticed that my Javascript is not catching rosbridge exceptions where I assume they should occur. For example, if I follow the tutorial and run:

var connection = null;
try {
    connection = new ros.Connection("ws://foobar:1234");
} catch (err) {
    log('Failed to connect to rosbridge!');
log('Connection successful!');

where neither host foobar nor the port 1234 is valid, I don't see the "Failed to connect" message. Instead I see the "Connection successful" message. Similar exceptions such as trying to connect to a non-existent service are not being caught. Is this a Javascript problem or a rosbridge problem?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-05 04:22:26 -0500

Victor Lopez gravatar image

updated 2012-10-05 04:22:42 -0500

I know this is not the answer you are expecting, but I recently migrated from rosbridge 1.0 to rosbridge 2.0 and I'm extremely pleased with the results.

Rosbridge 2.0 is much more robust, consumes way less resources and has many other features.

If you already have a working websocket implementation, the migration shouldn't be hard at all.

edit flag offensive delete link more


Thanks @Victor. Migrating to version 2.0 is probably the best answer so I'll give it a try. I'll wait to see if anyone has a fix for version 1.0 before checking off your answer.

Pi Robot gravatar image Pi Robot  ( 2012-10-05 06:20:45 -0500 )edit

@Victor: I'm finding the rosbridge 2.0 documentation very sparse and not sufficient for me to figure out how to translate my rosbridge 1.0 code to 2.0. Do you know of any 2.0 examples out there that use the Javascript client in an HTML application?

Pi Robot gravatar image Pi Robot  ( 2012-10-11 04:21:57 -0500 )edit

No, I am sorry. I implemented a client using Qt in C++. But I believe all you need is a websocket client and on top of that implement the protocol described in this document:

Victor Lopez gravatar image Victor Lopez  ( 2012-10-14 21:31:14 -0500 )edit

@Pi Robot Did you eventually migrate to Rosbridge 2.0? Can you show the process of your migration?

Andrew.A gravatar image Andrew.A  ( 2014-10-23 22:59:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-10-05 04:15:37 -0500

Seen: 184 times

Last updated: Oct 05 '12