Skip to content

Commit

Permalink
Updated occupancy grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
jstnhuang committed Jul 25, 2017
1 parent 13b47ed commit 99441bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
1 change: 1 addition & 0 deletions ros-rviz-display.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ <h1 hidden$="[[!permanent]]">{{name}}</h1>
is-shown="[[isShown]]"
opacity="{{options.opacity}}"
ros="[[ros]]"
tf-client="[[tfClient]]"
topic="{{options.topic}}"
viewer="{{viewer}}"
></ros-rviz-occupancy-grid>
Expand Down
31 changes: 9 additions & 22 deletions ros-rviz-occupancy-grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<dom-module id="ros-rviz-occupancy-grid">
<template>
<paper-input label="Map topic" value="{{topic}}"></paper-input>
<paper-checkbox checked="{{continuous}}">Continuously update</paper-checkbox>
<paper-input label="Opacity" value="{{opacity}}"></paper-input>
<paper-checkbox checked="{{continuous}}">Continuously update</paper-input>
</template>
<script>
Polymer({
Expand All @@ -22,15 +22,9 @@
type: String,
value: '/map'
},
color: {
type: Object,
value: function() {
return { r: 255, g: 255, b: 255 };
}
},
continuous: {
type: Boolean,
value: false,
value: true,
},
opacity: {
type: Number,
Expand All @@ -39,44 +33,37 @@
globalOptions: Object,
isShown: Boolean,
ros: Object,
tfClient: Object,
viewer: Object,
},

observers: [
'_optionsChanged(topic, continuous, opacity, color.*)',
'_optionsChanged(topic, continuous, opacity)',
],

//ready: function() {
// var that = this;
// this._updateDisplay(function() {
// that.show();
// });
//},

destroy: function() {
// Nothing to destroy.
},

hide: function() {
if (this.viewer && this._gridClient) {
this.viewer.scene.remove(this._gridClient.currentGrid);
}
if (this._gridClient) {
this._gridClient.unsubscribe();
this._gridClient = null;
}
if (this.viewer && this._gridClient) {
this.viewer.scene.remove(this._gridClient.currentGrid);
}
},

show: function() {
if (this.viewer && this.isShown) {
if (!this._gridClient) {
this._updateDisplay();
}
this.viewer.scene.add(this._gridClient.currentGrid);
}
},

_optionsChanged: function(topic, continuous, opacity, color) {
_optionsChanged: function(topic, continuous, opacity) {
this.hide();
this._updateDisplay();
this.show();
Expand All @@ -97,7 +84,7 @@
continuous: this.continuous,
rootObject: this.viewer.scene,
offsetPose: null, // Maybe implement in the future
color: this.color,
color: {r: 255, g: 255, b: 255},
opacity: this.opacity
});
},
Expand Down
2 changes: 1 addition & 1 deletion ros-rviz.html
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
g: 255,
b: 255
},
continuous: false,
continuous: true,
opacity: 1.0,
topic: '/map',
},
Expand Down

0 comments on commit 99441bc

Please sign in to comment.