This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polar plot for hokuyo, delete Tree.js
- Loading branch information
Showing
7 changed files
with
201 additions
and
52 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 |
---|---|---|
@@ -1,4 +1,28 @@ | ||
.hokuyo{ | ||
} | ||
|
||
.test { | ||
margin: auto; | ||
margin-top: 1em; | ||
margin-bottom: 1em; | ||
width: 1000px; | ||
} | ||
|
||
#mainHokDisp { | ||
width: 99%; | ||
overflow-wrap: normal; | ||
background-color: #222; | ||
margin: auto; | ||
} | ||
|
||
#singleHokDisps { | ||
margin: auto; | ||
margin-top: 1em; | ||
margin-bottom: 3em; | ||
display: flex; | ||
justify-content: space-between; | ||
width: 1000px; | ||
} | ||
|
||
.singleHokDisp { | ||
/*background-color: #333;*/ | ||
} |
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 |
---|---|---|
@@ -1,21 +1,64 @@ | ||
angular.module('app').controller('HokuyoCtrl', ['$rootScope', '$scope', 'Hokuyo', | ||
function($rootScope, $scope, Hokuyo) { | ||
$rootScope.act_page = 'hokuyo'; | ||
var displays = new HokuyoDisplay("mainHokDisp", "main"); | ||
// $scope.logs = Hokuyo.logs; | ||
$scope.test = "Coucou !"; | ||
$scope.test3 = 42; | ||
Hokuyo.displays.main = new HokuyoDisplay("mainHokDisp", "main"); | ||
Hokuyo.displays.one = new HokuyoDisplay("hok1", "one"); | ||
Hokuyo.displays.two = new HokuyoDisplay("hok2", "two"); | ||
// $scope.test = "Coucou !"; | ||
// $scope.test3 = 42; | ||
|
||
$scope.name = "hokuyo.polar_raw_data"; | ||
$scope.from = "hokuyo"; | ||
$scope.data = '{\n\ | ||
"hokuyo": "corner",\n\ | ||
"polarSpots": [\n\ | ||
[ -40, 235 ],\n\ | ||
[ -30, 235 ],\n\ | ||
[ -35, 230 ],\n\ | ||
[ -25, 230 ],\n\ | ||
[ -20, 100 ],\n\ | ||
[ -15, 105 ],\n\ | ||
[ -5, 120 ],\n\ | ||
[ 0, 100 ],\n\ | ||
[ 5, 90 ],\n\ | ||
[ 10, 95 ],\n\ | ||
[ 15, 100 ],\n\ | ||
[ 20, 100 ],\n\ | ||
[ 25, 230 ],\n\ | ||
[ 30, 235 ]\n\ | ||
]\n\ | ||
}'; | ||
|
||
$scope.update = function() { | ||
Hokuyo.onOrder($scope.from, $scope.name, JSON.parse($scope.data)); | ||
} | ||
|
||
}]); | ||
|
||
angular.module('app').service('Hokuyo', ['$rootScope', '$sce', 'Client', | ||
function($rootScope, $sce, Client) { | ||
this.init = function () { | ||
this.displays = { | ||
main: null, | ||
one: null, | ||
two: null | ||
} | ||
|
||
this.init = function () { | ||
Client.order(this.onOrder); | ||
}; | ||
|
||
Client.order(function (from, name, data) { | ||
if(name == 'hokuyo') { | ||
// Do something | ||
this.onOrder = function (from, name, data) { | ||
if($rootScope.act_page == 'hokuyo') { | ||
if (name == 'hokuyo.polar_raw_data') { | ||
if (data.hokuyo == "corner" && !!this.displays.one) { | ||
this.displays.one.updatePolarSpots(data.polarSpots); | ||
} else if (data.hokuyo == "enemy" && !!this.displays.two) { | ||
this.displays.two.updatePolarSpots(data.polarSpots); | ||
} | ||
} else if (name == 'hokuyo.robots' | ||
&& !!this.displays.main) { | ||
this.displays.main.updateRobots(data.robots); | ||
} | ||
} | ||
}.bind(this)); | ||
}; | ||
}.bind(this); | ||
}]); |
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 |
---|---|---|
@@ -1,12 +1,34 @@ | ||
<style type="text/css"> | ||
@import url(pages/hokuyo/hokuyo.css); | ||
</style> | ||
<div ng-controller="HokuyoCtrl"> | ||
<div class="hokuyo"> | ||
<!-- Test 1 | ||
{{test}} | ||
<input type="number" ng-model="test3" ></input> --> | ||
|
||
<script type="text/javascript"> | ||
var displays = new HokuyoDisplay("mainHokDisp", "main");</script> | ||
<div id="mainHokDisp" name="mainHokDisp" > | ||
|
||
<div class="test"> | ||
<span class="legend">Name:</span> | ||
<input type="text" ng-model="name"/> | ||
<br /> | ||
<span class="legend">From:</span> | ||
<input type="text" ng-model="from"/> | ||
<br /> | ||
<textarea ng-model="data" rows="10" cols="45"></textarea> | ||
<br /> | ||
<button type="button" class="btn" ng-click="update()">Mettre à jour</button> | ||
</div> | ||
|
||
<div id="mainHokDisp" name="mainHokDisp" style="display: none;"> | ||
</div> | ||
|
||
<div id="singleHokDisps" name="singleHokDisps" > | ||
<div id="hok1" name="hok1" class="singleHokDisp" > | ||
</div> | ||
|
||
<div id="hok2" name="hok2" class="singleHokDisp" > | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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
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