summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--n/asserv/utils/graph/asserv_graph.cc33
-rw-r--r--n/asserv/utils/graph/rc/config.avr11
-rw-r--r--n/asserv/utils/graph/rc/config.host5
3 files changed, 35 insertions, 14 deletions
diff --git a/n/asserv/utils/graph/asserv_graph.cc b/n/asserv/utils/graph/asserv_graph.cc
index de7e337..6de6c52 100644
--- a/n/asserv/utils/graph/asserv_graph.cc
+++ b/n/asserv/utils/graph/asserv_graph.cc
@@ -44,6 +44,7 @@ class AsservGraph : public Proto::Receiver
int cl, cr;
int pl, pr;
int n;
+ int sP, sS, sC, sW;
public:
AsservGraph (int argc, char **argv)
: proto_ (*this), argc_ (argc), argv_ (argv),
@@ -62,6 +63,10 @@ class AsservGraph : public Proto::Receiver
is = config.get<int> ("asserv.isat");
ta = config.get<int> ("asserv.ta");
aa = config.get<int> ("asserv.aa");
+ sP = config.get<int> ("asserv.stat_pos");
+ sS = config.get<int> ("asserv.stat_speed");
+ sC = config.get<int> ("asserv.stat_count");
+ sW = config.get<int> ("asserv.stat_pwm");
proto_.open (config.get<std::string> ("asserv.tty"));
init ();
}
@@ -78,10 +83,10 @@ class AsservGraph : public Proto::Receiver
proto_.send ('p', "bw", 'E', es);
proto_.send ('p', "bw", 'I', is);
proto_.send ('p', "bww", 'a', ta, aa);
- proto_.send ('P', "b", 1);
- proto_.send ('S', "b", 1);
- proto_.send ('C', "b", 1);
- proto_.send ('W', "b", 1);
+ proto_.send ('P', "b", sP);
+ proto_.send ('S', "b", sS);
+ proto_.send ('C', "b", sC);
+ proto_.send ('W', "b", sW);
}
void receive (char command, const Proto::Frame &frame)
{
@@ -115,10 +120,10 @@ class AsservGraph : public Proto::Receiver
std::cout << "asserv_graph - graphe des variables de"
" l'asservissement.\n"
"Syntaxe : asserv_graph [commands]\n"
- " w teste la pwm\n"
- " c teste le pas\n"
- " s teste la vitesse\n"
- " p teste la position à vitesse controlée\n"
+ " w teste la pwm\n"
+ " c teste le pas\n"
+ " s DUR teste la vitesse\n"
+ " p teste la position à vitesse controlée\n"
<< std::endl;
}
int main (void)
@@ -130,6 +135,7 @@ class AsservGraph : public Proto::Receiver
}
for (int i = 1; i < argc_; ++i)
{
+ int dur;
if (argv_[i][0] == '\0' || argv_[i][1] != '\0')
throw std::runtime_error ("bad command line");
switch (argv_[i][0])
@@ -140,13 +146,18 @@ class AsservGraph : public Proto::Receiver
proto_.wait (-1);
break;
case 'c':
- proto_.send ('c', "ww", 64, 0);
+ proto_.send ('c', "ww", 128, 0);
for (n = 0; n < 100;)
proto_.wait (-1);
break;
case 's':
+ if (++i >= argc_)
+ throw std::runtime_error ("no duration");
+ dur = atoi (argv_[i]);
+ if (dur == 0)
+ throw std::runtime_error ("bad duration");
proto_.send ('s', "bb", 64, 0);
- for (n = 0; n < 100;)
+ for (n = 0; n < dur;)
proto_.wait (-1);
proto_.send ('s');
for (n = 0; n < 100;)
@@ -154,7 +165,7 @@ class AsservGraph : public Proto::Receiver
break;
case 'p':
proto_.send ('s', "wwbb", 1024, 0, 64, 0);
- for (n = 0; n < 100;)
+ for (n = 0; n < 500;)
proto_.wait (-1);
break;
default:
diff --git a/n/asserv/utils/graph/rc/config.avr b/n/asserv/utils/graph/rc/config.avr
index 2a87000..dad73b8 100644
--- a/n/asserv/utils/graph/rc/config.avr
+++ b/n/asserv/utils/graph/rc/config.avr
@@ -1,15 +1,20 @@
asserv.tty = "/dev/ttyS0"
asserv.tkp = 1024
-asserv.tki = 32
+asserv.tki = 128
asserv.tkd = 0
-asserv.akp = 1024
+asserv.akp = 512
asserv.aki = 32
asserv.akd = 0
asserv.esat = 1023
-asserv.isat = 256
+asserv.isat = 255
asserv.ta = 256
asserv.aa = 256
+
+asserv.stat_pos = 1
+asserv.stat_speed = 0
+asserv.stat_count = 1
+asserv.stat_pwm = 1
diff --git a/n/asserv/utils/graph/rc/config.host b/n/asserv/utils/graph/rc/config.host
index 3636d74..3bf18ed 100644
--- a/n/asserv/utils/graph/rc/config.host
+++ b/n/asserv/utils/graph/rc/config.host
@@ -13,3 +13,8 @@ asserv.isat = 128
asserv.ta = 256
asserv.aa = 256
+
+asserv.stat_pos = 1
+asserv.stat_speed = 1
+asserv.stat_count = 1
+asserv.stat_pwm = 1