Skip to content

Commit

Permalink
Merge pull request #47 from RoboCup-MSL/Version20
Browse files Browse the repository at this point in the history
Version20
  • Loading branch information
BernardoCunha authored Feb 6, 2020
2 parents 234e12a + eb54e5c commit b168f5c
Show file tree
Hide file tree
Showing 33 changed files with 730 additions and 169 deletions.
2 changes: 2 additions & 0 deletions RefereeClient/Comms.pde
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static final String COMM_THROWIN = "THROWIN";
public static final String COMM_CORNER = "CORNER";
public static final String COMM_PENALTY = "PENALTY";
public static final String COMM_DROP_BALL = "DROP_BALL";
public static final String COMM_ISALIVE = "IS_ALIVE";

// repair Commands
public static final String COMM_REPAIR = "REPAIR";
Expand Down Expand Up @@ -93,6 +94,7 @@ void comms_initDescriptionDictionary() {
Description.set(COMM_SECOND_HALF_OVERTIME, "Overtime 2nd half");
Description.set(COMM_PARK, "Park");
Description.set(COMM_SUBSTITUTION, "Substitution");
Description.set(COMM_ISALIVE, "Is Alive");

Description.set(COMM_KICKOFF, "Kickoff");
Description.set(COMM_FREEKICK, "Freekick");
Expand Down
169 changes: 159 additions & 10 deletions RefereeClient/RefereeClient.pde
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@ public static PVector offsetLeft= new PVector(250, 160);
public static PVector offsetRight= new PVector(610, 160);
public static PFont buttonFont, clockFont, panelFont, scoreFont, debugFont, teamFont, watermark;
public static PImage backgroundImage;
public static PImage stop;
public static PImage playOn;
public static PImage preGame;
public static PImage halfTime;
public static PImage gameOver;
public static PImage endGame;
public static PImage substitutionLeft;
public static PImage substitutionRight;
public static PImage kickOffLeft;
public static PImage goalKickLeft;
public static PImage throwInLeft;
public static PImage freeKickLeft;
public static PImage cornerKickLeft;
public static PImage penaltyKickLeft;
public static PImage kickOffRight;
public static PImage throwInRight;
public static PImage goalKickRight;
public static PImage freeKickRight;
public static PImage cornerKickRight;
public static PImage penaltyKickRight;
public static PImage dropBall;
public static PImage isAliveLeft;
public static PImage isAliveRight;


public static PApplet mainApplet = null;

Expand All @@ -77,8 +101,31 @@ void setup() {
size(1000, 680);

backgroundImage = loadImage("img/bg_normal.png");

frame.setTitle(MSG_WINDOWTITLE);
stop = loadImage("img/stop.png");
playOn = loadImage("img/PlayOn.png");
preGame = loadImage("img/PreGame.png");
halfTime = loadImage("img/HalfTime.png");
gameOver = loadImage("img/GameOver.png");
endGame = loadImage("img/EndGame.png");
substitutionLeft = loadImage("img/SubstitutionLeft.png");
substitutionRight = loadImage("img/SubstitutionRight.png");
kickOffLeft = loadImage("img/KickOffLeft.png");
goalKickLeft = loadImage("img/GoalKickLeft.png");
throwInLeft = loadImage("img/ThrowInLeft.png");
freeKickLeft = loadImage("img/FreeKickLeft.png");
cornerKickLeft = loadImage("img/CornerKickLeft.png");
penaltyKickLeft = loadImage("img/PenaltyLeft.png");
kickOffRight = loadImage("img/KickOffRight.png");
throwInRight = loadImage("img/ThrowInRight.png");
goalKickRight = loadImage("img/GoalKickRight.png");
freeKickRight = loadImage("img/FreeKickRight.png");
cornerKickRight = loadImage("img/CornerKickRight.png");
penaltyKickRight = loadImage("img/PenaltyRight.png");
dropBall = loadImage("img/DropBall.png");
isAliveLeft = loadImage("img/IsAliveLeft.png");
isAliveRight = loadImage("img/IsAliveRight.png");

surface.setTitle(MSG_WINDOWTITLE);
clockFont = createFont("fonts/LCDM.TTF", 64, false);
scoreFont = createFont("fonts/LED.ttf", 40, false);
buttonFont=loadFont("fonts/Futura-CondensedExtraBold-24.vlw");
Expand All @@ -90,6 +137,7 @@ void setup() {
//==============================================
//=== Modules Initialization
Config.Load(this, "config.json"); // Load config file

Log.init(this); // Init Log module
comms_initDescriptionDictionary(); // Initializes the dictionary for communications with the basestations

Expand Down Expand Up @@ -152,12 +200,112 @@ void draw() {
//refresh command show
PImage img = null;
String imageName = "";
if(lastCommandCode.equals(COMM_STOP)) imageName = "stop";
if(imageName.length() > 0 && new File(dataPath("img/"+imageName+".png")).exists() && (img = loadImage("img/"+imageName+".png")) != null)
{
imageMode(CENTER);
image(img, width/2, height/2 + 45, 230, 230);
}else{
imageMode(CENTER);
textFont(teamFont, 30);
textAlign(CENTER, CENTER-5);
if(lastCommandCode.equals(COMM_STOP)){
image(stop, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_START)) {
image(playOn, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_DROP_BALL)) {
image(dropBall, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_HALF_TIME)) {
image(halfTime, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_END_GAME)) {
image(endGame, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_GAMEOVER)) {
image(gameOver, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_RESET)) {
image(preGame, width/2, height/2 + 45, 230, 230);
}
else if (lastCommandCode.equals(COMM_KICKOFF)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(kickOffLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(kickOffRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_FREEKICK)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(freeKickLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(freeKickRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_GOALKICK)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(goalKickLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(goalKickRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_THROWIN)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(throwInLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(throwInRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_CORNER)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(cornerKickLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(cornerKickRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_PENALTY)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(penaltyKickLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(penaltyKickRight, width/2, height/2 + 25, 230, 230);
}
text(lastCommandTeam, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_SUBSTITUTION)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(substitutionLeft, width/2, height/2 + 25, 230, 230); //<>//
}
else {
image(substitutionRight, width/2, height/2 + 25, 230, 230);
}
text("ID: "+ lastRobotID, width/2, height/2 + 175);
}
else if (lastCommandCode.equals(COMM_ISALIVE)) {
if (teamA.longName.equals(lastCommandTeam)){ //<>//
image(isAliveLeft, width/2, height/2 + 25, 230, 230);
}
else {
image(isAliveRight, width/2, height/2 + 25, 230, 230);
}
text("ID: "+ lastRobotID, width/2, height/2 + 175);

}
/*
Description.set(COMM_WELCOME, "Welcome");
Description.set(COMM_FIRST_HALF, "1st half");
Description.set(COMM_SECOND_HALF, "2nd half");
Description.set(COMM_FIRST_HALF_OVERTIME, "Overtime 1st half");
Description.set(COMM_SECOND_HALF_OVERTIME, "Overtime 2nd half");
Description.set(COMM_PARK, "Park");
*/
else{
fill(#E0F000);
String description = lastCommandDescription;
if(description.contains("START"))
Expand All @@ -171,14 +319,15 @@ void draw() {
textAlign(CENTER, CENTER);
text(description, width/2, height/2 + 10);
//team dest command
textFont(teamFont, 35);

textFont(teamFont, 30);
textAlign(CENTER, CENTER-5);
text(lastCommandTeam, width/2, height/2 + 100);
if(lastRobotID != -1)
{
text("ID: "+ lastRobotID, width/2, height/2 + 150);
}
}
}
}

//receive message and get from json important information for referee Client
Expand Down
4 changes: 2 additions & 2 deletions RefereeClient/data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"robotDoubleYellowCardColor": "#707000",
"robotRedCardColor": "#E01010",
"defaultCyanTeamShortName": "***",
"defaultCyanTeamLongName": "Disconnected",
"defaultCyanTeamLongName": "TeamA Disconnected",
"defaultCyanTeamColor": "#007BA7",
"defaultMagentaTeamShortName": "***",
"defaultMagentaTeamLongName": "Disconnected",
"defaultMagentaTeamLongName": "TeamB Disconnected",
"defaultMagentaTeamColor": "#DA70D6"
}
}
Expand Down
Binary file added RefereeClient/data/img/CornerKickLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/CornerKickRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/DropBall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/EndGame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/FreeKickLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/FreeKickRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/GameOver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/GoalKickLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/GoalKickRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/HalfTime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/IsAliveLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/IsAliveRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/KickOffLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/KickOffRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/PenaltyLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/PenaltyRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/PlayOn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/PreGame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/SubstitutionLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/SubstitutionRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/ThrowInLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RefereeClient/data/img/ThrowInRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mslrb2015/Button.pde
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void buttonEvent(char group, int pos) {

// Special cases, that send only event message on game change (flags)
if( clickedButton.isYellow() || clickedButton.isRed() || clickedButton.isRepair() || clickedButton.isConfig() ||
clickedButton.isEndPart() || clickedButton.isReset() || clickedButton.isAlive())
clickedButton.isEndPart() || clickedButton.isReset() || clickedButton.isAlive() || clickedButton.isSubs())
{
// Do literally nothing...
}else{
Expand Down
Loading

0 comments on commit b168f5c

Please sign in to comment.