summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/asserv/asserv.hh
diff options
context:
space:
mode:
authorhaller2005-04-13 20:42:50 +0000
committerhaller2005-04-13 20:42:50 +0000
commit04d791eb4668d32e84be22ea2ce8c221312f0e47 (patch)
tree5bf23e62da73d795907ea6b5f4c7162ac98eca2c /2005/i/robert/src/asserv/asserv.hh
parentd2dd07c7622f4ca6d01e6013c76d771fbb897fca (diff)
Première version qui compile
Elle ne marche pas, y'a encore du boulot
Diffstat (limited to '2005/i/robert/src/asserv/asserv.hh')
-rw-r--r--2005/i/robert/src/asserv/asserv.hh68
1 files changed, 40 insertions, 28 deletions
diff --git a/2005/i/robert/src/asserv/asserv.hh b/2005/i/robert/src/asserv/asserv.hh
index 08b8aa0..f587c71 100644
--- a/2005/i/robert/src/asserv/asserv.hh
+++ b/2005/i/robert/src/asserv/asserv.hh
@@ -26,6 +26,7 @@
// }}}
#include "utils/non_copyable.hh"
+#include "config/config.hh"
#include "proto/proto.hh"
#include "log/log.hh"
@@ -37,25 +38,37 @@ class Asserv : public NonCopyable, public Proto::Receiver
{
public:
/// Recoit un packet.
- virtual void receive (char command, const Frame &frame) = 0;
+ virtual void receive (char command) = 0; // XXX Classe à définir
};
// Communication avec l'AVR
Proto proto_;
std::string ttyName_;
// Paramètre de l'avr
- double footing_;
+ int16_t footing_;
double epsilon_;
double accel_;
double kp_;
double ki_;
double kd_;
double maxSpeed_;
+ // Stat
+ double pCounter_;
+ double pPosition_;
+ double pMotor_;
+ double pPwm_;
+ double pTiming_;
+ double pStatInPort_;
+
+ // Unités
+ double mmPpas_;
+ double sPperiod_;
+ double pwmMax_;
// Système de log.
Log log_;
public:
/// Constructeur.
- Asserv (const Config & config, Receiver & receiver);
+ Asserv (const Config & config, Asserv::Receiver & receiver);
/// Destructeur.
~Asserv (void);
/// Reset la carte et envois les paramètres.
@@ -66,34 +79,34 @@ class Asserv : public NonCopyable, public Proto::Receiver
bool wait (int timeout = -1);
/// Commandes asservissement
void linearMove(double distance);
- void angularMove(int8_t angle);
- void goToPosition(int32_t xPos, int32_t yPos);
- void fuckTheWall(int8_t speed);
- void setSpeed(int8_t xSpeed = 0, int8_t ySpeed = 0);
- void setPwm(int16_t leftPwm = 0, int16_t rightPwm = 0);
+ void angularMove(double angle);
+ void goToPosition(double xPos, double yPos);
+ void fuckTheWall(double speed);
+ void setSpeed(double xSpeed = 0, double ySpeed = 0);
+ void setPwm(double leftPwm = 0, double rightPwm = 0);
/// Statistiques
- void statCounter(int8_t period = 0);
- void statPosition(int8_t period = 0);
- void statMotor(int8_t period = 0);
- void statPwm(int8_t period = 0);
- void statTimer(int8_t period = 0);
- void statInPort(int8_t period = 0);
+ 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);
//@{
/// Change les paramètres de la carte.
- void setXPos(int32_t pos);
- void setYPos(int32_t pos);
- void setAngle(int32_t angle);
- void setFooting(int32_t dist);
- void setEpsilon(int32_t e);
- void setAccel (int accel);
- void setKp (int kp);
- void setKi (int ki);
- void setKd (int kd);
- void setMaxSpeed(int16_t);
+ void setXPos(double pos);
+ void setYPos(double pos);
+ void setAngle(double angle);
+ void setFooting(int16_t dist);
+ void setEpsilon(double e);
+ void setKp (double kp);
+ void setKi (double ki);
+ void setKd (double kd);
+ void setAccel (double accel);
+ void setMaxSpeed(double maxSpeed);
//@}
/// implémentation du proto::Receiver
- void receive (char command, const Frame &frame);
+ void receive (char command, const Proto::Frame &frame);
private:
/// Charge les données de la classe config
@@ -104,9 +117,8 @@ class Asserv : public NonCopyable, public Proto::Receiver
int radTo256(double angle);
int mms2ppp(double vitesse);
int rCycl2Pwm(double rCycl);
-
-
-
+ int s2period(double period);
+ int mmps2ppperiod(double accel);
};
#endif // asserv_h