summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2003-09-10 20:37:26 +0000
committerschodet2003-09-10 20:37:26 +0000
commit45e9ad53c377e594e03bf14fa4c6bab5322ada64 (patch)
tree51ec363e6c32c5559e668908c3fa9d4c4171c05d
parentf015c80c46842c758efa4c6e1fb7e9bc83ad5a90 (diff)
Apres 2003
-rw-r--r--2003/i/buzz/runtime/rc/motor9
-rw-r--r--2003/i/buzz/runtime/rc/qia1
-rw-r--r--2003/i/buzz/runtime/rc/vision/palets.rgb2
-rw-r--r--2003/i/buzz/src/GNUmakefile4
-rw-r--r--2003/i/buzz/src/vision/image.cc23
-rw-r--r--2003/i/buzz/src/vision/image.h5
-rw-r--r--2003/i/buzz/src/vision/test_vision.cc21
7 files changed, 46 insertions, 19 deletions
diff --git a/2003/i/buzz/runtime/rc/motor b/2003/i/buzz/runtime/rc/motor
index cd41a21..2a405a0 100644
--- a/2003/i/buzz/runtime/rc/motor
+++ b/2003/i/buzz/runtime/rc/motor
@@ -1,4 +1,5 @@
-accel 1000
-speed 1000
-raccel 360
-rspeed 360
+godistance 50 100
+turnangle 50 100
+turn 50 100
+go 25 25
+factors 0.194106 -0.281250
diff --git a/2003/i/buzz/runtime/rc/qia b/2003/i/buzz/runtime/rc/qia
new file mode 100644
index 0000000..cff6bf3
--- /dev/null
+++ b/2003/i/buzz/runtime/rc/qia
@@ -0,0 +1 @@
+550 0 -45 1800 0 90 25 0 90 1800 0 -90 25 0 -90 1800
diff --git a/2003/i/buzz/runtime/rc/vision/palets.rgb b/2003/i/buzz/runtime/rc/vision/palets.rgb
new file mode 100644
index 0000000..0bc366a
--- /dev/null
+++ b/2003/i/buzz/runtime/rc/vision/palets.rgb
@@ -0,0 +1,2 @@
+1 60 255 15 40 10 30
+2 0 60 50 255 15 30
diff --git a/2003/i/buzz/src/GNUmakefile b/2003/i/buzz/src/GNUmakefile
index b4f79f2..1ac5269 100644
--- a/2003/i/buzz/src/GNUmakefile
+++ b/2003/i/buzz/src/GNUmakefile
@@ -1,11 +1,11 @@
-SUBDIRS = automate busp camera config erreur motor serial vision
+SUBDIRS = automate busp camera config date erreur ia motor serial vision qia
TARGETS =
LIBS =
CXXFLAGS = -Wall -g
CPPFLAGS = -I. -I$(SRCDIR) -I/usr/pkg/include
-LDFLAGS = -L/usr/pkg/lib
+LDFLAGS = --static -L/usr/pkg/lib
SRCDIR ?= .
LIBPPM ?= -lppm
diff --git a/2003/i/buzz/src/vision/image.cc b/2003/i/buzz/src/vision/image.cc
index 27f13f8..48fc445 100644
--- a/2003/i/buzz/src/vision/image.cc
+++ b/2003/i/buzz/src/vision/image.cc
@@ -51,15 +51,16 @@ Image::Image (const char *filename, const Thresholds *thresholds)
// Initalisation
m_groups = 0;
m_thresholds = thresholds;
+ m_camera = 0;
}
-Image::Image (const Camera &camera, const Thresholds *thresholds)
+Image::Image (const Camera *camera, const Thresholds *thresholds)
{
+ // Copie la camera.
+ m_camera = camera;
// Allocate memory...
- camera.getSize (m_width, m_height);
+ m_camera->getSize (m_width, m_height);
m_image = new unsigned char [m_width * m_height * 4];
- // Lit l'image. TODO si = 0.
- while (!camera.read (m_image));
// Alloue de la memoire pour les zones.
m_zones = new unsigned char [m_width * m_height];
// Initalisation
@@ -327,3 +328,17 @@ Image::dump (const char *filename)
// Close it.
fclose (fp);
}
+
+// Relit les données de la camera et fait les analyses.
+bool
+Image::reread (void)
+{
+ // Lit l'image.
+ if (m_camera->read (m_image) == 0)
+ return false;
+ filter ();
+ group ();
+ groupFilter ();
+ return true;
+}
+
diff --git a/2003/i/buzz/src/vision/image.h b/2003/i/buzz/src/vision/image.h
index cbee54e..c4f1feb 100644
--- a/2003/i/buzz/src/vision/image.h
+++ b/2003/i/buzz/src/vision/image.h
@@ -21,10 +21,11 @@ class Image
unsigned char *m_zones;
ImageGroup *m_groups;
const Thresholds *m_thresholds;
+ const Camera *m_camera;
public:
// Constructeurs.
Image (const char *filename, const Thresholds *thresholds);
- Image (const Camera &camera, const Thresholds *thresholds);
+ Image (const Camera *camera, const Thresholds *thresholds);
// Destructeur.
~Image (void);
// Filtre l'image pour trouver les zones.
@@ -37,6 +38,8 @@ class Image
void dump (const char *filename);
// Filtre les packets de pixels.
void groupFilter (void);
+ // Relit les données de la camera et fait les analyses.
+ bool reread (void);
protected:
// Fait des packets de pixels sur les lignes.
void groupLine (void);
diff --git a/2003/i/buzz/src/vision/test_vision.cc b/2003/i/buzz/src/vision/test_vision.cc
index d60d915..91a5f7f 100644
--- a/2003/i/buzz/src/vision/test_vision.cc
+++ b/2003/i/buzz/src/vision/test_vision.cc
@@ -20,20 +20,25 @@ main (int argc, char **argv)
{
t = new Thresholds ("rc/vision/palets.rgb");
c = new Camera ();
- sleep (1);
- i = new Image (*c, t);
- i->filter ();
- i->group ();
- i->groupFilter ();
- i->dumpGroups ();
- i->dump ("dump.ppm");
+ i = new Image (c, t);
+ for (int j = 0; j < 5; ++j)
+ {
+ if (i->reread ())
+ {
+ char s[256];
+ i->dumpGroups ();
+ sprintf (s, "dump%d.ppm", j);
+ i->dump (s);
+ }
+ sleep (1);
+ }
delete i;
delete c;
delete t;
}
catch (const char *s)
{
- fprintf (stderr, "test_image: %s\n", s);
+ fprintf (stderr, "test_vision: %s\n", s);
return 1;
}
return 0;