From f00a32284c2dd778ba731b87b620f5ec5e118fd7 Mon Sep 17 00:00:00 2001 From: Miguel Angel Astor Romero Date: Tue, 28 Jun 2016 18:40:02 -0400 Subject: [PATCH] Changed the pheromone sensing a bit. --- pheromone.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pheromone.cpp b/pheromone.cpp index 1ccd62a..89a3b3b 100644 --- a/pheromone.cpp +++ b/pheromone.cpp @@ -214,14 +214,14 @@ void PheromoneMap::s_sample(phero_sensor_t * sensor, float x, float y, float yaw index = static_cast((NUM_PHERO_SAMPLES / 2.0f) - ang); index = index >= NUM_PHERO_SAMPLES ? NUM_PHERO_SAMPLES - 1 : index; if(MAP_POS(i, j) > sensor->samples[index]) { - sensor->samples[index] += MAP_POS(i, j); + sensor->samples[index] = MAP_POS(i, j); sensor->sample_amnt[index] += 1; } } else { index = static_cast((NUM_PHERO_SAMPLES / 2.0f) + ang); index = index >= NUM_PHERO_SAMPLES ? NUM_PHERO_SAMPLES - 1 : index; if(MAP_POS(i, j) > sensor->samples[index]) { - sensor->samples[index] += MAP_POS(i, j); + sensor->samples[index] = MAP_POS(i, j); sensor->sample_amnt[index] += 1; } } @@ -231,8 +231,8 @@ void PheromoneMap::s_sample(phero_sensor_t * sensor, float x, float y, float yaw } } sem_post(&map_semaphore); - for(unsigned int i = 0; i < NUM_PHERO_SAMPLES; i++) { + /*for(unsigned int i = 0; i < NUM_PHERO_SAMPLES; i++) { sensor->samples[i] = (sensor->sample_amnt[i] > 0) ? (sensor->samples[i] / sensor->sample_amnt[i]) : 0.0f; - } + }*/ } }