Changes for new robot

This commit is contained in:
Marvin Martinson 2018-11-02 12:50:15 +02:00
parent 661c0134bc
commit 23b67e490d
4 changed files with 14 additions and 9 deletions

View File

@ -120,7 +120,8 @@ window.addEventListener('load', function() {
init: function() { init: function() {
var OPERATORS = [ var OPERATORS = [
['line left', 'LEFT'], ['line left', 'LEFT'],
['line right', 'RIGHT'] ['line right', 'RIGHT'],
['line middle', 'MIDDLE']
]; ];
this.setColour('#E6BF00'); this.setColour('#E6BF00');
var dropdown = new Blockly.FieldDropdown(OPERATORS); var dropdown = new Blockly.FieldDropdown(OPERATORS);

View File

@ -137,6 +137,8 @@ window.addEventListener('load', function() {
foundTrue = (sumorobot.sensors['line_left'] > 2000); foundTrue = (sumorobot.sensors['line_left'] > 2000);
} else if (/RIGHT/.test(code)) { } else if (/RIGHT/.test(code)) {
foundTrue = (sumorobot.sensors['line_right'] > 2000); foundTrue = (sumorobot.sensors['line_right'] > 2000);
} else if (/MIDDLE/.test(code)) {
foundTrue = (sumorobot.sensors['line_middle'] > 2000);
} else { } else {
foundTrue = true; foundTrue = true;
} }

View File

@ -16,6 +16,7 @@ var Sumorobot = function(wsUri, robotId) {
this.sensors = { this.sensors = {
'opponent': 99, 'opponent': 99,
'line_left': 0, 'line_left': 0,
'line_middle': 0,
'line_right': 0, 'line_right': 0,
'battery_voltage': 0 'battery_voltage': 0
}; };

View File

@ -33,15 +33,16 @@
<div id="battery"><img src="assets/img/battery_disconnected.png"></div> <div id="battery"><img src="assets/img/battery_disconnected.png"></div>
<div id="panel"> <div id="panel">
<img class="logo" src="assets/img/logo.png" alt="logo"> <div id="central">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text" id="robot-label">SumoID</span> <span class="input-group-text" id="robot-label">SumoID</span>
</div>
<input type="text" class="form-control" id="robot-id" placeholder="xxxxxxxx" />
</div>
<div class="btn-group btn-group-robot" role="group" aria-label="robots">
<a href="#" class="btn btn-lg btn-robot-go">GO!</a>
</div> </div>
<input type="text" class="form-control" id="robot-id" placeholder="xxxxxxxx" />
</div>
<div class="btn-group btn-group-robot" role="group" aria-label="robots">
<a href="#" class="btn btn-lg btn-robot-go">GO!</a>
</div> </div>
</div> </div>