-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from guilhermelawless/develop
Fix continuous map updates
- Loading branch information
Showing
4 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
||
<script src="http://cdn.robotwebtools.org/EaselJS/current/easeljs.js"></script> | ||
<script src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script> | ||
<script src="http://cdn.robotwebtools.org/roslibjs/current/roslib.js"></script> | ||
<script src="../build/ros2d.js"></script> | ||
|
||
<script> | ||
/** | ||
* 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 : 308, | ||
height : 250 | ||
}); | ||
|
||
// Setup the map client. | ||
var gridClient = new ROS2D.OccupancyGridClient({ | ||
ros : ros, | ||
rootObject : viewer.scene, | ||
// Use this property in case of continuous updates | ||
continuous: true | ||
}); | ||
// Scale the canvas to fit to the map | ||
gridClient.on('change', function() { | ||
viewer.scaleToDimensions(gridClient.currentGrid.width, gridClient.currentGrid.height); | ||
viewer.shift(gridClient.currentGrid.pose.position.x, gridClient.currentGrid.pose.position.y); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onload="init()"> | ||
<h1>Continuous Map Example</h1> | ||
<p> | ||
Use any method to publish continuous updates to topic /map and use this page to visualize updates. Follow these commands: | ||
</p> | ||
<ol> | ||
<li><tt>roscore</tt></li> | ||
<li><tt>(method of choice to publish to /map)</tt></li> | ||
<li><tt>roslaunch rosbridge_server rosbridge_websocket.launch</tt></li> | ||
</ol> | ||
<div id="map"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters