Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Added order for sweeper+canon and fixed fifo issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindstan committed May 6, 2017
1 parent 2086750 commit 2e6f7cf
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 1 deletion.
4 changes: 4 additions & 0 deletions clients/Extension/baseconstructor.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ class BaseConstructor extends Extension {
// open
// rotate
// close
this.fifo.orderFinished();
break;

case "drop_middle_1":
// same thing
this.fifo.orderFinished();
break;

case "drop_middle_2":
// same thing
this.fifo.orderFinished();
break;

default:
this.logger.error("Order " + name + " does not exist !");
this.fifo.orderFinished();
}
}

Expand Down
10 changes: 9 additions & 1 deletion clients/Extension/canon.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ class Canon extends Extension {
processFifoOrder (name, param) {
this.logger.info ("Order received: " + name);
switch (name) {
case "turn_on":
this.fifo.orderFinished();
break;
case "turn_off":
this.fifo.orderFinished();
break;

default:
logger.error ("Order " + name + " does not exist!");
this.logger.error ("Order " + name + " does not exist!");
this.fifo.orderFinished();
}
}

Expand Down
7 changes: 7 additions & 0 deletions clients/Extension/sweeper.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ class Sweeper extends Extension {
processFifoOrder (name, param) {
this.logger.info("Order received: " + name);
switch (name) {
case "turn_on":
this.fifo.orderFinished();
break;
case "turn_off":
this.fifo.orderFinished();
break;
default:
this.logger.error("Order " + name + " does not exist!");
this.fifo.orderFinished();
}
}

Expand Down
5 changes: 5 additions & 0 deletions clients/Extension/unitgrabber.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ class UnitGrabber extends Extension {
switch (name) {
case "open":
this.servos.moduleArmOpen();
this.fifo.orderFinished();
break;
case "close":
this.servos.moduleArmClose();
this.fifo.orderFinished();
break;
case "take_1":
//add a mechanism to process some functions in sequential order, waiting the first has finished before
Expand All @@ -42,14 +44,17 @@ class UnitGrabber extends Extension {
// - close arms
// - up grabber
// - open arms
this.fifo.orderFinished();
break;

case "take_4":
// Order : same thing but 4 times
this.fifo.orderFinished();
break;

default:
this.logger.error("Order " + name + " does not exist !");
this.fifo.orderFinished();
}
}

Expand Down
6 changes: 6 additions & 0 deletions clients/Robot/grobot.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class Grobot extends Robot{
super.stop();
}

start () {
super.start();
this.sweeper.start();
this.canon.start();
}

// Exiting :
//do something when app is closing
//process.on('exit', quit);
Expand Down
16 changes: 16 additions & 0 deletions webclient/pages/telecommande/grobotdisplay.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,20 @@ class GrobotDisplay extends RobotDisplay {
// Specific to grobot
// example : this.PID_P = 0.5
}

turnOnCanon () {
this.client.send("canon", "turn_on");
}

turnOffCanon () {
this.client.send("canon", "turn_off");
}

turnOnSweeper () {
this.client.send("sweeper", "turn_on");
}

turnOffSweeper () {
this.client.send("sweeper", "turn_off");
}
}
10 changes: 10 additions & 0 deletions webclient/pages/telecommande/telecommande.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ <h3>Asserv</h3>

<div>
<h3>Extensions : </h3>
<p>
Canon :
<button type="button" class="btn" ng-click="grobot.turnOnCanon()">Turn on</button>
<button type="button" class="btn" ng-click="grobot.turnOffCanon()">Turn off</button>
</p>
<p>
Sweeper :
<button type="button" class="btn" ng-click="grobot.turnOnSweeper()">Turn on</button>
<button type="button" class="btn" ng-click="grobot.turnOffSweeper()">Turn off</button>
</p>
</div>
</section>

Expand Down

0 comments on commit 2e6f7cf

Please sign in to comment.