From 97a0f343ce3865e26910626d58ff30afd00e0c70 Mon Sep 17 00:00:00 2001 From: dsavvinov Date: Thu, 1 Sep 2016 11:44:36 +0300 Subject: [PATCH] Algorithm: uncommented checks in RoomBypassingAlgorithm.getCommand() that was commented by mistake. Refactored SPURIOUD_REFLECTION_DIFF into ECHO_REFLECTION_DIFF to match meaning more closely --- .../main/java/algorithm/RoomBypassingAlgorithm.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/algorithm/RoomBypassingAlgorithm.kt b/server/src/main/java/algorithm/RoomBypassingAlgorithm.kt index 18ca2e2a1e4..07884fdbf85 100644 --- a/server/src/main/java/algorithm/RoomBypassingAlgorithm.kt +++ b/server/src/main/java/algorithm/RoomBypassingAlgorithm.kt @@ -24,8 +24,8 @@ class RoomBypassingAlgorithm(thisCar: Car, exchanger: Exchanger) : Abs private val ISOSCALENESS_MAX_DIFF = 50 // almost reached outer corner but not yet, and 120 meas. founds far wall private val DISTANCE_TO_WALL_UPPER_BOUND = 60 // have to move closer to the parallel wall private val DISTANCE_TO_WALL_LOWER_BOUND = 40 // have to move farther to the parallel wall - private val SPURIOUS_REFLECTION_DIFF = 70 // we're approaching corner and get spurious reflection from two walls on 60 meas. ! Should be before outer corner case ! - private val RANGE_FROM_ZERO_POINT_TO_FINISH_ALG = 60 + private val ECHO_REFLECTION_DIFF = 70 // we're approaching corner and get spurious reflection from two walls on 60 meas. ! Should be before outer corner case ! + private val RANGE_FROM_ZERO_POINT_TO_FINISH_ALG = 50 private var calibrateAfterRotate = false @@ -209,8 +209,6 @@ class RoomBypassingAlgorithm(thisCar: Car, exchanger: Exchanger) : Abs return moveForward(dist0.distance) } - // Approaching inner corner and getting spurious reflection from 2 walls on 60 - just move forward to get closer to corner - for (i in 70..110 step 10) { if (i == 90) { continue // point on 90 was already added @@ -240,15 +238,18 @@ class RoomBypassingAlgorithm(thisCar: Car, exchanger: Exchanger) : Abs return correctDistanceToParallelWall(anglesDistances, state) } - if (dist70.distance - dist0.distance > SPURIOUS_REFLECTION_DIFF) { + // Approaching inner corner and getting spurious reflection from 2 walls on 60; + // Just move forward to get closer to the corner; + if (dist70.distance - dist0.distance > ECHO_REFLECTION_DIFF) { log("Spurious reflection detected, moving forward") return moveForward(dist0.distance) } - // Approaching outer corner (parallel wall is ending soon, but not yet) - just move forward to get to the end of the wall + // Approaching outer corner (parallel wall is ending soon, but not yet); + // Just move forward to get to the end of the wall if (dist80.distance == -1 || Math.abs(dist100.distance - dist80.distance) > ISOSCALENESS_MAX_DIFF) { log("Aprroaching outer corner, moving forward") - return moveForward(30) + return moveForward(dist0.distance) } // default case: everything is ok, just move forward