ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rosbridge connection closed

asked 2012-07-19 15:21:10 -0600

koprenee gravatar image

updated 2012-07-20 12:04:54 -0600

Eric Perko gravatar image

I have already rosrun rosbridge rosbridge.py

And then when I run a test html file in browser "connection closed" has been showed...why it can`t connect to rosbridge?

html file:
<html>
<head>
<script type="text/javascript" src="http://brown-ros-pkg.googlecode.com/svn/tags/brown-ros-pkg/rosbridge/ros.js">
</script>
<script type="text/javascript">
function main() {
var connection = new ros.Connection("ws://hostname:9090");
connection.setOnClose(function (e) {
document.write('connection closed');
});
connection.setOnError(function (e) {
document.write('error!');
});
connection.setOnOpen(function (e) {
document.write('connected to ROS');
});
}
</script>
</head>
<body onload="main()">
</body>
</html>

edit retag flag offensive close merge delete

Comments

You have no tags on your question, it is unlikely to be found by people who know about these things

Felix Endres gravatar image Felix Endres  ( 2012-07-19 23:05:34 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2012-07-20 10:02:54 -0600

Could you test using the head version of rosbridge (svn url: http://brown-ros-pkg.googlecode.com/svn/trunk/experimental/rosbridge/). It's possible that you're experiencing a bug that has since been fixed but hasn't propagated to the latest version yet.

As for the "closed 10" error - the current version of rosbridge isn't very good at displaying meaningful errors. We're currently working on a more robust version of rosbridge which deals with this kind of thing much more gracefully. For now though, it may say "closed 10" even though you are actually connected.

edit flag offensive delete link more
2

answered 2012-07-20 00:00:16 -0600

A possible problem is that ws://hostname:9090 is unlikely to be your machine name. Use ws://localhost:9090 or ws://<your ip="">:9090 (eg. ws://192.168.0.1:9090)

If that doesn't help, could you tell me what browser you're using? There are a variety of websocket client implementations out there; some older browsers use variants of the protocol that may be outdated and therefore not compatible with rosbridge. If you find that you are using an old or obscure browser, can you try testing your code on the latest chromium or firefox and see if that helps?

Thanks, Jon

edit flag offensive delete link more
0

answered 2012-07-20 11:38:21 -0600

koprenee gravatar image

Thank you so much! Yep, there`s such bug in rosbridge download from source. It has been solved after I use the version checkout from svn.

edit flag offensive delete link more
0

answered 2012-07-20 09:28:01 -0600

koprenee gravatar image

updated 2012-07-20 09:51:20 -0600

Thank you for your answer, but it still doesn't work. I'm using the latest chromium broswer.

However I found that when I use ws://hostname:9090 ,there're nothing report under rosbridge, and when I change to ws://localhost:9090 and ws://127.0.0.1:9090 "closed 10" error will be reported under rosbridge's running

One more thing ,when I test in latest Firefox, it will always report "error!" but in Chromium, it always be "connection closed"...It's strange...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-07-19 15:21:10 -0600

Seen: 1,100 times

Last updated: Jul 20 '12