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

Robot Web Tools -> Map Visualisation Problem

asked 2018-10-06 11:16:08 -0500

MarkyMark2012 gravatar image

updated 2018-10-06 11:28:10 -0500

Hi All,

I'm experimenting with RWT to create a web front end for my ROS robots.

I've followed the 2D tutorial here:

http://wiki.ros.org/ros2djs/Tutorials...

The UI is coming up but I can't see the map being published. The rosbridge_server aka's the connection then disconnects straight away.

image description

and the Web UI looks like:

image description

lastly the code below (slightly modified from the code in the tutorial - because the script files server is no longer online)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<script type="text/javascript" src="./EaselJS-master/lib/easeljs.min.js"></script>
<script type="text/javascript" src="./EventEmitter2-master/lib/eventemitter2.js"></script>
<script type="text/javascript" src="./roslibjs-develop/build/roslib.min.js"></script>
<script type="text/javascript" src="./ros2djs-develop/build/ros2d.min.js"></script>

<script type="text/javascript" type="text/javascript">
  /**
   * Setup all visualization elements when the page is loaded.
   */
  function init() {
    // Connect to ROS.
    var ros = new ROSLIB.Ros({
      url : 'ws://localhost:9090'
    });

    // Create the main viewer.
    var viewer = new ROS2D.Viewer({
      divID : 'map',
      width : 600,
      height : 500
    });

    // Setup the map client.
    var gridClient = new ROS2D.OccupancyGridClient({
      ros : ros,
      rootObject : viewer.scene
    });
    // Scale the canvas to fit to the map
    gridClient.on('change', function(){
      viewer.scaleToDimensions(gridClient.currentGrid.width, gridClient.currentGrid.height);
    });
  }
</script>
</head>

<body onload="init()">
  <h1>Simple Map Example</h1>
  <div id="map"></div>
</body>
</html>

If anyone could suggest what might be the problem I'd appreciate it. The map is being published on the /map topic.

Thanks

Mark

edit retag flag offensive close merge delete

Comments

1

I tested your code and also only got a black image. Problem is that my own page also no longer works. I get the following error:

roslib.js:3671 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-10-07 13:51:29 -0500 )edit
1

Luckily I have an old chrome 60 lying around and tested your code with it: works. I guess there is a problem with new browsers?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-10-07 13:54:07 -0500 )edit

Hey - thanks for verifying. That's annoying - not sure what the status of Robot Web Tools is. From looking at git it still seems to be maintained.I'll continue to investigate and post back if I get an answer/find a solution.

MarkyMark2012 gravatar image MarkyMark2012  ( 2018-10-08 02:44:21 -0500 )edit

Hello everyone, I have the same problem. Was anybody able to solve it?

Hemanth gravatar image Hemanth  ( 2020-04-10 07:24:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-10 08:04:02 -0500

Hemanth gravatar image
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-10-06 11:16:08 -0500

Seen: 956 times

Last updated: Apr 10 '20