From 047f5149364115b9b13bf0afe8990f15b699fb95 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 1 May 2013 14:08:10 +0200 Subject: digital/io-hub/src/apbirthday: the cake is not an obstacle --- digital/io-hub/src/apbirthday/radar_2013.cc | 13 ++++++++++--- host/simu/model/table_eurobot2013.py | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/digital/io-hub/src/apbirthday/radar_2013.cc b/digital/io-hub/src/apbirthday/radar_2013.cc index 5cbbe0ca..3d0707f5 100644 --- a/digital/io-hub/src/apbirthday/radar_2013.cc +++ b/digital/io-hub/src/apbirthday/radar_2013.cc @@ -22,7 +22,7 @@ // // }}} #include "radar_2013.hh" -#include "playground.hh" +#include "playground_2013.hh" RadarSensor sensors[] = { { 0, { 102, 84 }, G_ANGLE_UF016_DEG (0), true }, @@ -44,7 +44,14 @@ Radar2013::Radar2013 (ucoo::UsDist &dist0, ucoo::UsDist &dist1, bool Radar2013::valid (int sensor_index, vect_t &p) { - return p.x >= margin_mm && p.x < pg_width - margin_mm - && p.y >= margin_mm && p.y < pg_length - margin_mm; + if (p.x < margin_mm || p.x >= pg_width - margin_mm + || p.y < margin_mm || p.y >= pg_length - margin_mm) + return false; + vect_t v = pg_cake_pos; vect_sub (&v, &p); + int dist_sq = vect_dot_product (&v, &v); + int cake_margin = pg_cake_radius + 50; + if (dist_sq < cake_margin * cake_margin) + return false; + return true; } diff --git a/host/simu/model/table_eurobot2013.py b/host/simu/model/table_eurobot2013.py index 0181ac00..2f9c9680 100644 --- a/host/simu/model/table_eurobot2013.py +++ b/host/simu/model/table_eurobot2013.py @@ -66,6 +66,8 @@ class Table (simu.model.table.Table): add_candle_circle ((1500, 2000), 450, pi + pi / 24, pi / 12, colors, 2) cake = RoundObstacle (500, 0) cake.pos = (1500, 2000) + cake_us = RoundObstacle (400, 4) + cake_us.pos = (1500, 2000) # Glasses. self.glasses = [ ] def add_glass (pos): @@ -119,6 +121,7 @@ class Table (simu.model.table.Table): add_gifts ((2400, 0)) # Add everything to obstacles. self.obstacles.append (cake) + self.obstacles.append (cake_us) self.obstacles += self.candles self.obstacles += self.glasses self.obstacles += self.plates -- cgit v1.2.3