summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/asserv/asserv.cc
diff options
context:
space:
mode:
authorhaller2005-05-02 19:02:10 +0000
committerhaller2005-05-02 19:02:10 +0000
commit4fa1434052dd603cec70f0edfeeca8f47905fbfe (patch)
tree051959314bd51ca17d9b90567b64a90ff3a1f876 /2005/i/robert/src/asserv/asserv.cc
parent1919e963fa7c7004e121b690b2d6d0021ddf41a2 (diff)
Ajout des paramètres d'asserv eSat et dSample
Ajout d'une vietesse linéaire et rotation
Diffstat (limited to '2005/i/robert/src/asserv/asserv.cc')
-rw-r--r--2005/i/robert/src/asserv/asserv.cc49
1 files changed, 35 insertions, 14 deletions
diff --git a/2005/i/robert/src/asserv/asserv.cc b/2005/i/robert/src/asserv/asserv.cc
index fea281a..3288ac6 100644
--- a/2005/i/robert/src/asserv/asserv.cc
+++ b/2005/i/robert/src/asserv/asserv.cc
@@ -50,18 +50,20 @@ void Asserv::reset(void)
setKp(kp_);
setKi(ki_);
setKd(kd_);
+ setESat(eSat_);
setSpeedIntMax(speedIntMax_);
+ setDSample(dSample_);
setAccel(accel_);
- setMaxSpeed(maxSpeed_);
+ setMaxSpeed(maxSLin_, maxSRot_);
setUseTazFSM(useTazFSM_);
- //setInvPwm(leftInvPwm_, rightInvPwm_);
- //statCounter(pCounter_);
- //statPosition(pPosition_);
- //statMotor(pMotor_);
- //statPwm(pPwm_);
- //statTiming(pTiming_);
- //statInPort(pStatInPort_);
- //statSharp(pStatInPort_);
+ setInvPwm(leftInvPwm_, rightInvPwm_);
+ statCounter(pCounter_);
+ statPosition(pPosition_);
+ statMotor(pMotor_);
+ statPwm(pPwm_);
+ statTiming(pTiming_);
+ statInPort(pStatInPort_);
+ statSharp(pStatInPort_);
}
/// Essaie de purger la liste d'mission et indique si elle est vide.
@@ -281,12 +283,25 @@ void Asserv::setKd(double Kd)
proto_.send('p',"bw", 'd', static_cast<int>(Kd * 256));
}
+void Asserv::setESat(int eSat)
+{
+ eSat_ = eSat;
+ // Envoie l'AVR
+ proto_.send('p', "bw", 'E', eSat);
+}
+
void Asserv::setSpeedIntMax(int maxInt)
{
speedIntMax_ = maxInt;
proto_.send('p', "bW", 'I', maxInt);
}
+void Asserv::setDSample (int dSample)
+{
+ dSample_ = dSample;
+ proto_.send('p', "bb", 's', dSample);
+}
+
void Asserv::setAccel(int accel)
{
accel_ = accel_;
@@ -301,13 +316,16 @@ double Asserv::getAccel(void)
return mmPpas_ / (sPperiod_ * sPperiod_) / accel_; // XXX Vrifier ca
}
-void Asserv::setMaxSpeed(int maxSpeed)
+/// Rgle les vitesses maximum(lineaire et rotation)
+void Asserv::setMaxSpeed(int maxSLin, int maxSRot)
{
- maxSpeed_ = maxSpeed;
+ maxSLin_ = maxSLin;
+ maxSRot_ = maxSRot;
// Conversion mm->ppp
- int p = mms2ppp(maxSpeed);
+ int p = mms2ppp(maxSLin);
+ int r = radTo256(maxSRot);
// Envoie l'AVR
- proto_.send('p',"bb", 'm', p);
+ proto_.send('p',"bbb", 'm', p, r);
}
void Asserv::setUseTazFSM(bool use)
@@ -413,8 +431,11 @@ void Asserv::loadConfig(const Config & config)
kp_ = config.get<double>("asserv.kp");
ki_ = config.get<double>("asserv.ki");
kd_ = config.get<double>("asserv.kd");
+ eSat_ = config.get<int>("asserv.eSat");
speedIntMax_ = config.get<int>("asserv.speedIntMax");
- maxSpeed_ = config.get<int>("asserv.maxSpeed");
+ dSample_ = config.get<int>("asserv.dSample");
+ maxSLin_ = config.get<int>("asserv.maxSLin");
+ maxSRot_ = config.get<int>("asserv.maxSRot");
useTazFSM_ = config.get<bool>("asserv.useTazFSM");
mmPpas_ = config.get<double>("asserv.mmPpas");
sPperiod_ = config.get<double>("asserv.sPperiod");