summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/space.hh
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/space.hh')
-rw-r--r--2005/i/robert/src/ovision/see/space.hh104
1 files changed, 104 insertions, 0 deletions
diff --git a/2005/i/robert/src/ovision/see/space.hh b/2005/i/robert/src/ovision/see/space.hh
new file mode 100644
index 0000000..0a3b224
--- /dev/null
+++ b/2005/i/robert/src/ovision/see/space.hh
@@ -0,0 +1,104 @@
+// robert - programme du robot 2005
+//
+// Copyright (C) 2005 Olivier Gaillard
+//
+// Robot APB Team/Efrei 2005.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef space_h
+#define space_h
+
+#include <vector>
+#include <iostream>
+#include <stdio.h>
+
+#include "group.hh"
+#include "oconfig.hh"
+
+//#define NB_NODES_X 5
+//#define NB_NODES_Y 3
+
+//#define START_WEIGHT_MIN 0.1
+//#define START_WEIGHT_MAX 0.9
+
+
+struct SETUP_POINT
+{
+ int x, y;
+ int distx, disty;
+};
+
+
+/// Etalonnage des distances et localisation de la balle
+class Space
+{
+ /// Classe config
+ OConfig *oconfig;
+
+ /// tableau d'index des distances
+ double *tabX;
+ double *tabY;
+
+ /// liste des distances etalonnees
+ std::vector<SETUP_POINT> setupTab;
+
+ /// hautdddeur de l'image
+ int imgHeight;
+
+ /// largeur de l'image
+ int imgWidth;
+
+ double aY, bY, cY;
+
+ public:
+
+ // Constructeur
+ Space (int width, int height);
+
+ // Destructeur
+ ~Space ();
+
+ /// Position d'un objet dans le referentiel du robot
+ void GetLoc(int locImgX, int locImgY, int &locX, int &locY);
+ void GetLoc(int locImgX, int locImgY, double &locX, double &locY);
+
+ /// Donne la position reelle sur la table de la balle
+ void GetPos(double locX, double locY, double posRobotX, double posRobotY, double angleRobot, double &posX, double &posY);
+
+ /// Ajoute un point pour l'etalonnage
+ void AddSetupPoint(int x, int y, int distx, int disty);
+
+ /// Chargement des points a partir d'un fichier
+ void LoadFromFile();
+
+ /// Etalonnage des distances
+ int Setup(double aY, double bY, double cY);
+
+ protected:
+
+ /// Donne les coefficients d'une ligne
+ void FindCoeffLine (double x1, double y1, double x2, double y2, double &a, double &b);
+
+ /// Cree un fichier gnuplot avec la courbe des points donnés par la courbe x et y
+ void CreateGnuPlotFile (int y = 100);
+
+ /// Cree un fichier avec l'erreur en fonction des itérations
+ void LogErrorPoint (FILE *f, int iter);
+};
+
+#endif // space_h