summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-01 14:08:10 +0200
committerNicolas Schodet2013-05-03 23:10:18 +0200
commit047f5149364115b9b13bf0afe8990f15b699fb95 (patch)
tree853682045a082cc2e4540ce4ad804b62943de8cf
parent06a8ecd50af9289e2de49e5e95cfcf3fc617f61e (diff)
digital/io-hub/src/apbirthday: the cake is not an obstacle
-rw-r--r--digital/io-hub/src/apbirthday/radar_2013.cc13
-rw-r--r--host/simu/model/table_eurobot2013.py3
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