rosbridge_server: share messages to non-ROS computer using HTTP
Is there a way to share a topic with a non-ROS computer? I am trying to send a string from my ros computer to another computer over a local static ip network. I was looking into using rosbridge_server to do this as it claims "Rosbridge provides a JSON API to ROS functionality for non-ROS programs."
I followed the tutorial: http://wiki.ros.org/rosbridge_suite/T... and used roslibjs as indicated here: http://wiki.ros.org/roslibjs/Tutorial...
While testing solely on my ros computer, I was able to subscribe to my topic over a websocket and have the string displayed on the web console using this HTML code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script type="text/javascript" src="http://cdn.robotwebtools.org/roslibjs/current/roslib.min.js"></script>
<script type="text/javascript" type="text/javascript">
// Connecting to ROS
// -----------------
var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
});
ros.on('connection', function() {
console.log('Connected to websocket server.');
});
ros.on('error', function(error) {
console.log('Error connecting to websocket server: ', error);
});
ros.on('close', function() {
console.log('Connection to websocket server closed.');
});
// Subscribing to a Topic
// ----------------------
var listener = new ROSLIB.Topic({
ros : ros,
name : '/copter_center_str',
messageType : 'std_msgs/String'
});
listener.subscribe(function(message) {
console.log('Received message on ' + listener.name + ': ' + message.data);
//listener.unsubscribe();
});
</script>
</head>
<body>
<h1>Simple roslib Example</h1>
<p>Check your Web Console for output.</p>
</body>
</html>
However, this method requires a web connection to include eventemitter2 and roslib. I tried installing both libraries and writing a javascript file to do it offline, but did not work as there were issues installing roslib.
It seems like roslib is designed to be used as a web interface to access ROS topics and services. Can rosbridge be used to give another computer access to a single topic and its messages over a local offline connection? If not, how is this interaction typically done? It would be perfect if there existed an HTTP call to subscribe to a topic on the rosbridge server.