Skip to content
This repository has been archived by the owner on Mar 3, 2019. It is now read-only.

Commit

Permalink
Commandes actionneurs par télécommandes
Browse files Browse the repository at this point in the history
  • Loading branch information
PFGimenez committed May 27, 2017
1 parent 401a748 commit 3660598
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 7 deletions.
8 changes: 8 additions & 0 deletions pc/src/config/ConfigInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ public enum ConfigInfo
TURN_LEFT_KEY(37),
TURN_RIGHT_KEY(39),
RESET_WHEELS_KEY(10),
BAISSE_FILET_KEY(66),
LEVE_FILET_KEY(76),
EJECTE_DROITE_KEY(68),
EJECTE_GAUCHE_KEY(71),
REARME_DROITE_KEY(69),
REARME_GAUCHE_KEY(84),
FERME_FILET_KEY(70),
OUVRE_FILET_KEY(79),

/**
* Paramètres bas niveau des capteurs
Expand Down
10 changes: 9 additions & 1 deletion pc/src/remoteControl/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ public Client(String[] args) throws InterruptedException
Commandes.SPEED_UP.setCode(config.getInt(ConfigInfo.SPEED_UP_KEY));
Commandes.TURN_LEFT.setCode(config.getInt(ConfigInfo.TURN_LEFT_KEY));
Commandes.TURN_RIGHT.setCode(config.getInt(ConfigInfo.TURN_RIGHT_KEY));

Commandes.BAISSE_FILET.setCode(config.getInt(ConfigInfo.BAISSE_FILET_KEY));
Commandes.LEVE_FILET.setCode(config.getInt(ConfigInfo.LEVE_FILET_KEY));
Commandes.EJECTE_DROITE.setCode(config.getInt(ConfigInfo.EJECTE_DROITE_KEY));
Commandes.EJECTE_GAUCHE.setCode(config.getInt(ConfigInfo.EJECTE_GAUCHE_KEY));
Commandes.REARME_GAUCHE.setCode(config.getInt(ConfigInfo.REARME_GAUCHE_KEY));
Commandes.REARME_DROITE.setCode(config.getInt(ConfigInfo.REARME_DROITE_KEY));
Commandes.FERME_FILET.setCode(config.getInt(ConfigInfo.FERME_FILET_KEY));
Commandes.OUVRE_FILET.setCode(config.getInt(ConfigInfo.OUVRE_FILET_KEY));

InetAddress rpiAdresse = null;
boolean loop = false;
log.debug("Démarrage du client de contrôle à distance");
Expand Down
19 changes: 13 additions & 6 deletions pc/src/remoteControl/Commandes.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@

public enum Commandes implements Serializable
{
SPEED_UP(38), SPEED_DOWN(40), TURN_RIGHT(39), TURN_LEFT(37), STOP(32), RESET_WHEELS(10), SHUTDOWN(-1), PING(-1);
SPEED_UP, SPEED_DOWN,
TURN_RIGHT, TURN_LEFT,
STOP,
RESET_WHEELS,
SHUTDOWN,
PING,
LEVE_FILET, BAISSE_FILET,
FERME_FILET, OUVRE_FILET,
EJECTE_GAUCHE, EJECTE_DROITE,
REARME_GAUCHE, REARME_DROITE;

private Commandes(int code)
{
this.code = code;
}
private Commandes()
{}

public int code;
public int code = -1;

public void setCode(int code)
{
Expand Down
18 changes: 18 additions & 0 deletions pc/src/threads/ThreadRemoteControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,24 @@ else if(c == Commandes.TURN_LEFT || c == Commandes.TURN_RIGHT)
data.setCurvature(courbure);
}
}
else if(c == Commandes.BAISSE_FILET)
data.baisseFilet();
else if(c == Commandes.LEVE_FILET)
data.leveFilet();
else if(c == Commandes.OUVRE_FILET)
data.ouvreFilet();
else if(c == Commandes.FERME_FILET)
data.fermeFilet();
else if(c == Commandes.EJECTE_DROITE)
data.ejecteBalles(true);
else if(c == Commandes.EJECTE_GAUCHE)
data.ejecteBalles(false);
else if(c == Commandes.REARME_GAUCHE)
data.rearme(false);
else if(c == Commandes.REARME_DROITE)
data.rearme(true);


else if(c == Commandes.SHUTDOWN)
{
Thread.sleep(1000);
Expand Down

0 comments on commit 3660598

Please sign in to comment.