summaryrefslogtreecommitdiff
path: root/n/asserv
diff options
context:
space:
mode:
Diffstat (limited to 'n/asserv')
-rw-r--r--n/asserv/utils/graph/asserv_graph.cc26
-rw-r--r--n/asserv/utils/graph/plot/avr.plot2
-rw-r--r--n/asserv/utils/graph/rc/config.avr18
-rw-r--r--n/asserv/utils/graph/rc/config.host5
4 files changed, 34 insertions, 17 deletions
diff --git a/n/asserv/utils/graph/asserv_graph.cc b/n/asserv/utils/graph/asserv_graph.cc
index 2453031..2edb612 100644
--- a/n/asserv/utils/graph/asserv_graph.cc
+++ b/n/asserv/utils/graph/asserv_graph.cc
@@ -28,6 +28,7 @@
#include <iostream>
#include <stdexcept>
+#include <cmath>
/// Classe de connexion à Proto.
class AsservGraph : public Proto::Receiver
@@ -49,7 +50,7 @@ class AsservGraph : public Proto::Receiver
int n;
int sP, sS, sC, sW, sY;
bool host;
- double iu_mm;
+ double iu_mm, footing;
int seq;
public:
AsservGraph (int argc, char **argv)
@@ -81,8 +82,9 @@ class AsservGraph : public Proto::Receiver
if (host)
{
sY = config.get<int> ("asserv.stat_simu");
- iu_mm = config.get<double> ("iu_mm");
}
+ iu_mm = config.get<double> ("iu_mm");
+ footing = config.get<double> ("footing");
proto_.open (config.get<std::string> ("asserv.tty"));
init ();
}
@@ -106,7 +108,6 @@ class AsservGraph : public Proto::Receiver
proto_.send ('W', "b", sW);
if (host)
proto_.send ('Y', "b", sY);
- ///proto_.send ('p', "bw", 'h', (int) ((110 - 0) * iu_mm));
}
void receive (char command, const Proto::Frame &frame)
{
@@ -155,6 +156,7 @@ class AsservGraph : public Proto::Receiver
" c teste le pas\n"
" s DUR teste la vitesse\n"
" p teste la position à vitesse controlée\n"
+ " r teste la position à vitesse controlée\n"
" h teste la detection de trous\n"
<< std::endl;
}
@@ -194,8 +196,8 @@ class AsservGraph : public Proto::Receiver
proto_.wait (-1);
break;
case 'c':
- proto_.send ('c', "ww", 128, 0);
- for (n = 0; n < 100;)
+ proto_.send ('c', "ww", 1000, 0);
+ for (n = 0; n < 400;)
proto_.wait (-1);
break;
case 's':
@@ -212,7 +214,19 @@ class AsservGraph : public Proto::Receiver
proto_.wait (-1);
break;
case 'p':
- proto_.send ('s', "wwbb", 1024, 0, 64, 0);
+ proto_.send ('s', "ddb", (int) (iu_mm * 420), 0, 1);
+ for (n = 0; n < 500;)
+ proto_.wait (-1);
+ break;
+ case 'r':
+ proto_.send ('s', "ddb", 0,
+ (int) (iu_mm * M_PI_2 * 0.5 * footing), 1);
+ for (n = 0; n < 500;)
+ proto_.wait (-1);
+ break;
+ case 'R':
+ proto_.send ('s', "ddb", (int) (iu_mm * 512),
+ (int) (iu_mm * -64), 1);
for (n = 0; n < 500;)
proto_.wait (-1);
break;
diff --git a/n/asserv/utils/graph/plot/avr.plot b/n/asserv/utils/graph/plot/avr.plot
index 10a0789..8403faf 100644
--- a/n/asserv/utils/graph/plot/avr.plot
+++ b/n/asserv/utils/graph/plot/avr.plot
@@ -1,2 +1,2 @@
set style data line
-plot 'avr' using 1 title "te", 'avr' using 2 title "ti", 'avr' using 3 title "ae", 'avr' using 4 title "ai", 'avr' using 5 title "pl", 'avr' using 6 title "pr"
+plot 'avr' using 1 title "te", 'avr' using 2 title "ti", 'avr' using 3 title "ae", 'avr' using 4 title "ai", 'avr' using 5 title "pl", 'avr' using 6 title "pr", 'avr' using ($13+$14) title "ct", 'avr' using ($13-$14) title "ca"
diff --git a/n/asserv/utils/graph/rc/config.avr b/n/asserv/utils/graph/rc/config.avr
index 0bf6222..cbfc174 100644
--- a/n/asserv/utils/graph/rc/config.avr
+++ b/n/asserv/utils/graph/rc/config.avr
@@ -1,24 +1,26 @@
asserv.tty = "/dev/ttyS0"
-asserv.tkp = 512
-asserv.tki = 64
+asserv.tkp = 100
+asserv.tki = 3
asserv.tkd = 0
-asserv.akp = 2048
-asserv.aki = 128
+asserv.akp = 550
+asserv.aki = 7
asserv.akd = 0
asserv.esat = 1023
-asserv.isat = 255
-asserv.tspm = 64
-asserv.aspm = 64
+asserv.isat = 3072
asserv.ta = 256
asserv.aa = 256
+asserv.tspm = 96
+asserv.aspm = 96
asserv.stat_pos = 1
asserv.stat_speed = 0
-asserv.stat_count = 0
+asserv.stat_count = 1
asserv.stat_pwm = 1
host = false
+iu_mm = 75.78789091394133410940
+footing = 276.0
diff --git a/n/asserv/utils/graph/rc/config.host b/n/asserv/utils/graph/rc/config.host
index 5661d96..5272743 100644
--- a/n/asserv/utils/graph/rc/config.host
+++ b/n/asserv/utils/graph/rc/config.host
@@ -13,8 +13,8 @@ asserv.isat = 128
asserv.ta = 256
asserv.aa = 256
-asserv.tspm = 64
-asserv.aspm = 64
+asserv.tspm = 96
+asserv.aspm = 96
asserv.stat_pos = 1
asserv.stat_speed = 1
@@ -24,3 +24,4 @@ asserv.stat_simu = 1
host = true
iu_mm = 75.78789091394133410940
+footing = 276.0