From 58c6fc6fa7beb2e8a57f49b94e95c9c0eb3e08b8 Mon Sep 17 00:00:00 2001 From: dufourj Date: Wed, 22 Jun 2005 08:24:48 +0000 Subject: Correction du calcul de la position de la quille et ajout de log --- 2005/i/robert/src/ovision/see/ovision.cc | 6 ++++-- 2005/i/robert/src/ovision/see/test_ovision.cc | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to '2005/i/robert') diff --git a/2005/i/robert/src/ovision/see/ovision.cc b/2005/i/robert/src/ovision/see/ovision.cc index a316306..2cbb4a1 100644 --- a/2005/i/robert/src/ovision/see/ovision.cc +++ b/2005/i/robert/src/ovision/see/ovision.cc @@ -136,8 +136,10 @@ OVision::getLoc (Zone &zone, int &x, int &y, int &angle, int &dist) int tmpY = (int)((zone.ymax - zone.centery) * newPcY + zone.centery); int newX, newY; space_->getLoc (tmpX, tmpY, newX, newY); - angle = (int)(atan (newX / (newY + 9))); - dist = newY; + angle = (int)(atan ((double)newX / ((double)newY + 90))); + x = newX; y = newY; + dist = (int)sqrt (y*y + x*x); + std::cout << " " << " " << newX << " " << newY << " " << angle << " " << dist << "\n"; } /// Renvoie la liste des quilles diff --git a/2005/i/robert/src/ovision/see/test_ovision.cc b/2005/i/robert/src/ovision/see/test_ovision.cc index 25e7e88..c86c37d 100644 --- a/2005/i/robert/src/ovision/see/test_ovision.cc +++ b/2005/i/robert/src/ovision/see/test_ovision.cc @@ -38,6 +38,13 @@ main(int argv, char **argc) // double x, y; // if (ovision.getBall (x, y)) // std::cout << x <<"----" << y << std::endl; + + std::vector &z = ovision.getSkittles (); + for (unsigned i=0; i < z.size (); ++i) + { + int x, y, dist, angle; + ovision.getLoc (z[i], x, y, dist, angle); + } usleep (500000); } return 0; -- cgit v1.2.3