summaryrefslogtreecommitdiff
path: root/2005/i/robert
diff options
context:
space:
mode:
authorhaller2005-04-20 15:42:33 +0000
committerhaller2005-04-20 15:42:33 +0000
commitd4d957c826c80f8f730ba896cca78dc2da862762 (patch)
tree33e19269b2cfafc4d6dfa632d39485d0802c3bfb /2005/i/robert
parent43c33540dd681cce203d8e5584272374e28593ce (diff)
Correction de quelques bug
il reste encore des tests à faire
Diffstat (limited to '2005/i/robert')
-rw-r--r--2005/i/robert/src/asserv/asserv.cc5
-rw-r--r--2005/i/robert/src/asserv/test_asserv.cc37
2 files changed, 36 insertions, 6 deletions
diff --git a/2005/i/robert/src/asserv/asserv.cc b/2005/i/robert/src/asserv/asserv.cc
index d55a01f..c90eaa5 100644
--- a/2005/i/robert/src/asserv/asserv.cc
+++ b/2005/i/robert/src/asserv/asserv.cc
@@ -106,6 +106,7 @@ void Asserv::goToPosition(double xPos, double yPos)
proto_.send('g', "dd", x, y);
}
+// XXX Vérifier la conversion ca me parais un peu petit
void Asserv::fuckTheWall(double speed)
{
// Conversion mm/s->Pas/Period
@@ -158,9 +159,11 @@ void Asserv::finishAck(void)
proto_.send('F', "b", 0);
}
+/// XXX Valeurs bizarres
/// Statistiques
void Asserv::statCounter(int period)
{
+
pCounter_ = period;
// Convertion s->Period
int p = s2period(period);
@@ -451,7 +454,7 @@ int Asserv::radTo256(double angle, bool format24eme)
int Asserv::mms2ppp(double vitesse)
{
- return static_cast<int>(vitesse*(sPperiod_/mmPpas_));
+ return static_cast<int>(vitesse * sPperiod_ / mmPpas_);
}
int Asserv::rCycl2Pwm(double rCycl)
diff --git a/2005/i/robert/src/asserv/test_asserv.cc b/2005/i/robert/src/asserv/test_asserv.cc
index 302be6a..84c3366 100644
--- a/2005/i/robert/src/asserv/test_asserv.cc
+++ b/2005/i/robert/src/asserv/test_asserv.cc
@@ -151,19 +151,46 @@ main (int argc, char **argv)
i++;
break;
case 'f':
- if(++i > argc)
+ if(++i + 1 > argc)
throw std::runtime_error("syntax error");
- asserv.fuckTheWall(atoi(argv[i]));
+ switch(argv[i][0])
+ {
+ case 'd':
+ asserv.fuckTheWall(strtod(argv[i + 1], 0));
+ break;
+ case 'i':
+ asserv.fuckTheWall(atoi(argv[i + 1]));
+ break;
+ default:
+ throw std::runtime_error("syntax error");
+ break;
+ }
+ i++;
break;
case 's':
- if(++i + 1 > argc)
+ if(++i + 2 > argc)
throw std::runtime_error("syntax error");
- asserv.setSpeed(strtod(argv[i], 0), strtod(argv[++i], 0));
+ switch(argv[i][0])
+ {
+ case 'd':
+ i++;
+ asserv.setSpeed(strtod(argv[i], 0), strtod(argv[i + 1], 0));
+ break;
+ case 'i':
+ i++;
+ asserv.setSpeed(atoi(argv[i]), atoi(argv[i + 1]));
+ break;
+ default:
+ throw std::runtime_error("syntax error");
+ break;
+ }
+ i++;
break;
case 'w':
if(++i + 1 > argc)
throw std::runtime_error("syntax error");
- asserv.setPwm(strtod(argv[i], 0), strtod(argv[++i], 0));
+ asserv.setPwm(strtod(argv[i], 0), strtod(argv[i + 1], 0));
+ i++;
break;
case 'F':
asserv.finishAck();