Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serving Foxy + Gazebo11 to a Web Broswer #157

Open
mis-eu opened this issue Oct 8, 2020 · 2 comments
Open

serving Foxy + Gazebo11 to a Web Broswer #157

mis-eu opened this issue Oct 8, 2020 · 2 comments

Comments

@mis-eu
Copy link

mis-eu commented Oct 8, 2020

Please validate if ros2-web-bridge supports deploying a ROS2 Foxy 20.04 Focal simulation via gzclient11 to a Web browser (gzweb is still ROS1)

<title>Gazebo11 Web Bridge v 0.0.1</title>
<link rel="stylesheet" href="css/base.css">

<script type="text/javascript" src="http://static.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script type="text/javascript" src="http://static.robotwebtools.org/roslibjs/current/roslib.min.js"></script>
<!-- GAZEBO config
    [gazebo-1] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
    [gazebo-1] [Msg] Publicized address: 172.31.159.229
-->

<!-- ROS2-web-bridge 
    $ node bin/rosbridge.js 
    ros2-web-bridge: ROS2 node started +0ms
    ros2-web-bridge: Starting server on port 9090 +1ms
    Websocket started on ws://localhost:9090 -->

<script>
	let ros = new ROSLIB.Ros();
	let bridgeHost = window.location.hostname;
	let bridgePort = 9090;

// monitor the connection    
// listener for a connection event to the ros object. 
// two blocks following do the same for error and close events. 
    
	ros.on('connection', function() {
	console.log('bridge connected');
});
    ros.on('error', function(error) {
	console.log('Error connecting to websocket server: ', error);
});
    ros.on('close', function() {
	console.log('Connection to websocket server closed.');
});
    ros.connect('ws://' + bridgeHost + ':' + bridgePort);
   

</script>  


<iframe id="iframeGazebo" src="http://172.31.159.229:11345"></iframe>
@minggangw
Copy link
Member

I never try to combine them together, my first thought is that as ROSLIB doesn't aware if backed by ROS 1 or ROS 2, it seems feasible to interact gzweb with ros2-web-bridge by the ROSLIB.

@mis-eu
Copy link
Author

mis-eu commented Oct 12, 2020

thank you for this response @minggangw, about the ROSLIB being agnostic to ros1/ros2.

To your knowledge, can ros2-web-bridge serve a full Gazebo11 Foxy world/model simulation to a Browser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants