Skip to content

Commit

Permalink
Merge pull request #22 from robocup-logistics/thofmann/two-maintenanc…
Browse files Browse the repository at this point in the history
…es-per-bot

Allow two maintenances per bot
  • Loading branch information
morxa authored Apr 17, 2019
2 parents 1af10a5 + eb382ad commit a02529a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/games/rcll/globals.clp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
?*TECHCHALL-WAM-TIME* = 300
?*TECHCHALL-NAVIGATION-TIME* = 60
; number of allowed robot maintenance cycles
?*MAINTENANCE-ALLOWED-CYCLES* = 1
?*MAINTENANCE-ALLOWED-CYCLES* = 2
?*MAINTENANCE-COST* = (create$ 0 5)
?*MAINTENANCE-ALLOWED-TIME* = 120
?*MAINTENANCE-WARN-TIME* = 105
?*MAINTENANCE-GRACE-TIME* = 15
Expand Down
2 changes: 1 addition & 1 deletion src/games/rcll/orders.clp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,6 @@
(defrule order-print-points
(points (game-time ?gt) (points ?points) (team ?team) (phase ?phase) (reason ?reason))
=>
(printout t "Awarding " ?points " points to team " ?team ": " ?reason
(printout t "Giving " ?points " points to team " ?team ": " ?reason
" (" ?phase " @ " ?gt ")" crlf)
)
10 changes: 9 additions & 1 deletion src/games/rcll/robots.clp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

(defrule robot-recv-SetRobotMaintenance
?pf <- (protobuf-msg (type "llsf_msgs.SetRobotMaintenance") (ptr ?p) (rcvd-via STREAM))
(gamestate (cont-time ?ctime))
(gamestate (phase ?phase) (cont-time ?ctime) (game-time ?game-time))
=>
(retract ?pf) ; message will be destroyed after rule completes
(do-for-fact ((?robot robot))
Expand All @@ -99,6 +99,14 @@
(printout t "Robot " ?robot:number " scheduled for maintenance cycle " ?cycle crlf)
(modify ?robot (state MAINTENANCE) (maintenance-start-time ?ctime)
(maintenance-cycles ?cycle) (maintenance-warning-sent FALSE))
(bind ?cycle-cost (nth$ ?cycle ?*MAINTENANCE-COST*))
(if (neq ?cycle-cost nil)
then
(assert (points (game-time ?game-time)
(points (* -1 ?cycle-cost))
(team ?robot:team-color) (phase ?phase)
(reason (str-cat "Maintenance of robot " ?robot:number))))
)
)
else
(bind ?maint-time (- ?ctime ?robot:maintenance-start-time))
Expand Down
8 changes: 4 additions & 4 deletions src/shell/robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ LLSFRefBoxShellRobot::refresh()
printw(1, width() - 5, "%s", RobotState_Name(state_).substr(0,3).c_str());
standend();

attron(A_BOLD);
if (maintenance_cycles_ > 0) {
attron(A_BOLD);
attron(' '|COLOR_PAIR(COLOR_RED_ON_BACK));
//mvwaddwstr(w, 1, width() - 1, L"\u26a0");
printw(1, width() - 1, "!");
standend();
}
//mvwaddwstr(w, 1, width() - 1, L"\u26a0");
printw(1, width() - 1, "%1i", maintenance_cycles_);
standend();

} else {
bkgd(' '|COLOR_PAIR(COLOR_DEFAULT));
Expand Down

0 comments on commit a02529a

Please sign in to comment.