summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/asserv/asserv.hh
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/asserv/asserv.hh')
-rw-r--r--2005/i/robert/src/asserv/asserv.hh78
1 files changed, 42 insertions, 36 deletions
diff --git a/2005/i/robert/src/asserv/asserv.hh b/2005/i/robert/src/asserv/asserv.hh
index 4a19493..1cbe2c4 100644
--- a/2005/i/robert/src/asserv/asserv.hh
+++ b/2005/i/robert/src/asserv/asserv.hh
@@ -43,14 +43,16 @@ class Asserv : public NonCopyable, public Proto::Receiver
virtual void receivePosX (double xPos) = 0;
virtual void receivePosY (double yPos) = 0;
virtual void receivePosA (double aPos) = 0;
- virtual void receiveMotor (int oldLSpeed_e, int LSpeed_int, int oldRSpeed_e, int RSpeed_int) = 0;
+ virtual void receiveSpeedStat (int leftError, int leftInt, int rightError, int rightInt) = 0;
virtual void receivePwm (double leftPwm, double rightPwm) = 0;
- virtual void receiveTiming (double motorTimer5, double motorTimer4,
- double motorTimer3, double motorTimer2,
- double motorTimer1,
- double motorTimer0 ) = 0;
- virtual void receiveInPort (double command) = 0;
- virtual void jaifini (void) = 0;
+ virtual void receiveTiming (int motorTimer4,
+ int motorTimer3, int motorTimer2,
+ int motorTimer1,
+ int motorTimer0 ) = 0;
+ virtual void receiveInPort (int port) = 0;
+ virtual void receiveSharp (int sharp1, int sharp2, int sharp3) = 0;
+ virtual void receiveTazState(int state, int subState){}; // XXX Vérifier les formats
+ virtual void done (void) = 0;
};
private:
@@ -60,26 +62,29 @@ class Asserv : public NonCopyable, public Proto::Receiver
std::string ttyName_;
Receiver & receiver_;
// Paramètre de l'avr
- int16_t footing_;
- double epsilon_;
- double accel_;
- double kp_;
+ int footing_; //truc
+ double epsilon_; //mm
+ int accel_; //unité AVR
+ double kp_;
double ki_;
double kd_;
- int16_t speedIntMax_;
- double maxSpeed_;
+ int speedIntMax_;
+ int maxSpeed_; //unité AVR
+ bool leftInvPwm_, rightInvPwm_;
+ bool useTazFSM_;
// Stat
- double pCounter_;
- double pPosition_;
- double pMotor_;
- double pPwm_;
- double pTiming_;
- double pStatInPort_;
+ int pCounter_;
+ int pPosition_;
+ int pMotor_;
+ int pPwm_;
+ int pTiming_;
+ int pStatInPort_;
+ int pSharp_;
// Unités
double mmPpas_;
double sPperiod_;
- double pwmMax_;
+ int pwmMax_;
// Système de log.
Log log_;
@@ -97,16 +102,19 @@ class Asserv : public NonCopyable, public Proto::Receiver
void angularMove(double angle);
void goToPosition(double xPos, double yPos);
void fuckTheWall(double speed);
+ void fuckTheWall(int speed);
void setSpeed(double xSpeed = 0, double ySpeed = 0);
+ void setSpeed(int xSpeed = 0, int ySpeed = 0);
void setPwm(double leftPwm = 0, double rightPwm = 0);
void finishAck(void); //met le paramètre F à 0
/// Statistiques
- void statCounter(double period = 0);
- void statPosition(double period = 0);
- void statMotor(double period = 0);
- void statPwm(double period = 0);
- void statTiming(double period = 0);
- void statInPort(double period = 0);
+ void statCounter(int period = 0);
+ void statPosition(int period = 0);
+ void statMotor(int period = 0);
+ void statPwm(int period = 0);
+ void statTiming(int period = 0);
+ void statInPort(int period = 0);
+ void statSharp(int period = 0);
//@{
/// Change les paramètres de la carte.
void setXPos(double pos);
@@ -117,9 +125,12 @@ class Asserv : public NonCopyable, public Proto::Receiver
void setKp (double kp);
void setKi (double ki);
void setKd (double kd);
- void setSpeedIntMax (int16_t maxInt);
- void setAccel (double accel);
- void setMaxSpeed(double maxSpeed);
+ void setSpeedIntMax (int maxInt);
+ void setAccel (int accel);
+ double getAccel (void);
+ void setMaxSpeed(int maxSpeed);
+ void setUseTazFSM(bool use);
+ void setInvPwm(bool leftInvPwm, bool rightInvPwm);
//@}
/// implémentation du proto::Receiver
@@ -129,17 +140,12 @@ class Asserv : public NonCopyable, public Proto::Receiver
/// Charge les données de la classe config
void loadConfig(const Config & config);
/// Fonctions de conversion
- int mm2pasD(double dist); //Format 24/8
+ int mm2pas(double dist, bool format24eme = false); //Format 24/8 ou 8
int radTo256(double angle, bool format24eme = false); //Format 8 ou 8/24
int mms2ppp(double vitesse); // Format 8
int rCycl2Pwm(double rCycl); // Format 16
int s2period(double period); // Format 8
- int mmps2ppperiod(double accel); //Format 8 (1 vitesse par x period)
+ //int mmps2ppperiod(double accel); //Format 8 (1 vitesse par x period)
};
#endif // asserv_h
-
-
-// Vérifier le format finale des conversions
-// Vérifier toutes les commandes passé à l'AVR
-// Faire la fonction receive