Absender: Frank Menzel
Datum: Mi, 13.05.2009 19:48:37
Hallo Timo, ich habe im Pfadplanungsverhalten den Bug bei der Endeerkennung beseitigt, so dass nun wieder ein Pfad gefunden wird. Ohne diese Änderung hat er bei mir oft bis zum maximalen Zaehler hochgezaehlt, ohne den Pfad zu finden. Weiterhin ist es nun moeglich, wieder einen Pfad auf befahrenem Gebiet zu planen, was ja seit der letzten Änderung nicht mehr ging. Selbst beim ?Ziehen? einer einzelnen Spur findet er den Weg darauf zurück. Patch dazu anbei? Gruß, Frank
Index: C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_pathplaning.c =================================================================== --- C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_pathplaning.c (revision 1585) +++ C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_pathplaning.c (working copy) @@ -50,7 +50,7 @@ #include "display.h" #include "log.h" #include "pos_store.h" - + //#define DEBUG_PATHPLANING // Schalter fuer Debugausgaben //#define DEBUG_PATHPLANING_VERBOSE // zeichnet Zellen in die Map-Anzeige des Sim ein, rot: Hindernis, gruen: frei @@ -85,6 +85,7 @@ #define MAP_CELL_SIZE_LOWRES ((uint16_t)(1000 / MAP_RESOLUTION_LOWRES)) /*!< Breite eines Map-Feldes in mm */ #define MAP_LENGTH_LOWRES ((uint16_t)(MAP_SIZE_LOWRES * MAP_RESOLUTION_LOWRES)) /*!< Kantenlaenge der gesamten Karte in Map-Punkten */ #define RATIO_THRESHOLD (MAP_RATIO_FULL - 5) /*!< Schwellwert, unterhalb dem das Ergebnis von map_get_ratio() als Hindernis gilt */ +#define RATIO_THRESHOLD_DRIVEN 110 /*!< bei Pfadsuche auf befahrener Strecke gilt dieser Schwellwert */ /*! Anzahl der Sections in der Lowres-Map */ #define MAP_SECTIONS_LOWRES (((uint16_t)(MAP_SIZE_LOWRES * MAP_RESOLUTION_LOWRES) / MAP_SECTION_POINTS_LOWRES)) @@ -246,7 +247,8 @@ #endif // DEBUG_PATHPLANING_VERBOSE uint8_t ratio = map_get_ratio(x1, yw, x2, yw, MAP_CELL_SIZE_LOWRES, map_compare_haz, 127); - if (ratio < RATIO_THRESHOLD) { +//fuer Vergleich auf bereits befahrene Strecke gilt anderer Schwellwert als fuer Hindernis + if (ratio < ((map_compare_haz==0)?RATIO_THRESHOLD:RATIO_THRESHOLD_DRIVEN)) { access_field_lowres((position_t) {x, y}, 1, 1); #if defined DEBUG_PATHPLANING_VERBOSE && defined MAP_2_SIM_AVAILABLE // LOG_DEBUG("Trage Hindernis in (%d|%d) ein, ratio=%u", x, y, ratio); @@ -434,6 +436,8 @@ neighbour_found = False; } else { // abarbeiten aller 4 Nachbarn zu einem Punkt der Queue, auch wenn schon gefunden wurde zwecks guter Pfadfindung; ein True wird nicht ueberschrieben + // nur 4 Nachbarn kann bei Pfadsuche auf befahrenem Gebiet zu keinem Pfad fuehren, wenn Bot bisher nur eine Fahrspur hat und schraeg faehrt, dann wuerde + // nur 8er Nachbarschaft Pfad erkennen for (j=-1; j<=1; j++) { for (i=-1; i<=1; i++) { if ((j == 0 && i != 0) || (i == 0 && j != 0)) { @@ -505,6 +509,14 @@ tmp.x += i; tmp.y += j; minval = access_field_lowres(tmp, 0, 0); // Mapwert auslesen + + // Mapwert ist zur Zielerkennung egal, sind die Koords erreicht ist Schluss; wegen Mapwert 1 wurde manchmal oft kein Ziel erkannt + // wenn ein Nachbar Zielpunkt ist, wird Endekennung gesetzt egal wie der Mapwert aussieht + if (tmp.x == startwave.x && tmp.y == startwave.y) { + endreached = True; + LOG_DEBUG("Ende gefunden %1d %1d map: %1d", tmp.x, tmp.y, minval); + } + // die Koordinate mit niedrigstem Wellenwert merken if (minval> 1 && minval < mapval_min) { // naechster genommener Wellenwert muss kleiner aus letztem Lauf sein nextdest.x = pos.x + i; @@ -515,12 +527,6 @@ // Wellenwert und Kennung fuer Nachbar gefunden setzen mapval_min = minval; neighbour_found = True; - - // wenn ein Nachbar Zielpunkt ist Endekennung setzen - if (nextdest.x == startwave.x && nextdest.y == startwave.y) { - endreached = True; - LOG_DEBUG("Ende gefunden %1d %1d", nextdest.x, nextdest.y); - } } } } @@ -698,6 +704,11 @@ RC5_Code = 0; show_labmap(); break; + + case RC5_CODE_7: + RC5_Code = 0; + set_hazards(); + break; #endif case RC5_CODE_8: RC5_Code = 0; @@ -716,7 +727,11 @@ display_cursor(2, 1); display_printf("4:PlanOnDrivenArea"); // nur auf befahrenem Gebiet planen display_cursor(3, 1); +#ifdef DEBUG_PATHPLANING + display_printf("5/7:GoPlaning/Haz"); +#else display_printf("5:GoPlaning"); +#endif display_cursor(4, 1); #ifdef DEBUG_PATHPLANING display_printf("6/8:ShowMap/SetDest"); Index: C:/eclipse/workspace/ct-Bot/Changelog.txt =================================================================== --- C:/eclipse/workspace/ct-Bot/Changelog.txt (revision 1585) +++ C:/eclipse/workspace/ct-Bot/Changelog.txt (working copy) @@ -1,5 +1,7 @@ CHANGELOG fuer c't-Bot ====================== +2009-05-13 Frank Menzel [Menzelfr@xxxxxx]: Korrekturen im Pfadplanungsverhalten; Bug bei Endeerkennung beseitigt und Planung auf bereits befahrenem Gebiet ermoeglicht + 2009-04-30 Frank Menzel [Menzelfr@xxxxxx]: Einzeichnen der Fahrspuren in drive_area zur Visualisierung der Arbeitsweise des Verhaltens sowie Korrekturen und mehr Debugausgaben 2009-04-22 Timo Sandmann [mail@xxxxxxxxxxxxxxx]: Bugfix fuer map_2_sim_send() Index: C:/eclipse/workspace/ct-Bot/ct-Bot.h =================================================================== --- C:/eclipse/workspace/ct-Bot/ct-Bot.h (revision 1585) +++ C:/eclipse/workspace/ct-Bot/ct-Bot.h (working copy) @@ -59,7 +59,7 @@ #define ADC_AVAILABLE /*!< A/D-Konverter */ -//#define MOUSE_AVAILABLE /*!< Maus Sensor */ +#define MOUSE_AVAILABLE /*!< Maus Sensor */ #define ENA_AVAILABLE /*!< Enable-Leitungen */ #define SHIFT_AVAILABLE /*!< Shift Register */ @@ -72,8 +72,8 @@ #define POS_STORE_AVAILABLE /*!< Positionsspeicher vorhanden */ -//#define MAP_AVAILABLE /*!< Aktiviert die Kartographie */ -//#define MAP_2_SIM_AVAILABLE /*!< Sendet die Map zur Anzeige an den Sim */ +#define MAP_AVAILABLE /*!< Aktiviert die Kartographie */ +#define MAP_2_SIM_AVAILABLE /*!< Sendet die Map zur Anzeige an den Sim */ //#define SPEED_CONTROL_AVAILABLE /*!< Aktiviert die Motorregelung */ //#define ADJUST_PID_PARAMS /*!< macht PID-Paramter zur Laufzeit per FB einstellbar */ Index: C:/eclipse/workspace/ct-Bot/include/bot-logic/available_behaviours.h =================================================================== --- C:/eclipse/workspace/ct-Bot/include/bot-logic/available_behaviours.h (revision 1585) +++ C:/eclipse/workspace/ct-Bot/include/bot-logic/available_behaviours.h (working copy) @@ -34,7 +34,7 @@ #define BEHAVIOUR_SERVO_AVAILABLE /*!< Kontrollverhalten fuer die Servos */ -//#define BEHAVIOUR_PATHPLANING_AVAILABLE /*!< Pfadplanungsverhalten */ +#define BEHAVIOUR_PATHPLANING_AVAILABLE /*!< Pfadplanungsverhalten */ //#define BEHAVIOUR_DRIVE_STACK_AVAILABLE /*!< Abfahren der auf dem Stack gesicherten Koordinaten */ //#define BEHAVIOUR_OLYMPIC_AVAILABLE /*!< Olympiadenverhalten vorhanden? */ Index: C:/eclipse/workspace/ct-Bot/.cdtbuild =================================================================== --- C:/eclipse/workspace/ct-Bot/.cdtbuild (revision 1585) +++ C:/eclipse/workspace/ct-Bot/.cdtbuild (working copy) @@ -10,8 +10,8 @@ <option id="gnu.c.compiler.option.include.paths.387475860" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${ProjDirPath}""/> <listOptionValue builtIn="false" value=""${ProjDirPath}/include""/> -<listOptionValue builtIn="false" value=""C:\Programme\MinGW\include""/> -<listOptionValue builtIn="false" value=""C:\Programme\pthreads\pthreads.2""/> +<listOptionValue builtIn="false" value=""C:\MinGW\include""/> +<listOptionValue builtIn="false" value=""C:\pthreads\pthreads.2""/> </option> <option id="gnu.c.compiler.option.preprocessor.def.symbols.1823712582" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols"> <listOptionValue builtIn="false" value="PC"/> @@ -27,8 +27,8 @@ <listOptionValue builtIn="false" value="pthreadGC2"/> </option> <option id="gnu.c.link.option.paths.142594843" superClass="gnu.c.link.option.paths" valueType="stringList"> -<listOptionValue builtIn="false" value=""C:\Programme\pthreads\Pre-built.2\lib""/> -<listOptionValue builtIn="false" value=""C:\Programme\MinGW\lib""/> +<listOptionValue builtIn="false" value=""C:\pthreads\Pre-built.2\lib""/> +<listOptionValue builtIn="false" value=""C:\MinGW\lib""/> </option> <option id="gnu.c.link.option.noshared.1812776571" superClass="gnu.c.link.option.noshared" value="true" valueType="boolean"/> </tool> Index: C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.core.prefs =================================================================== --- C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.core.prefs (revision 0) +++ C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.core.prefs (revision 0) @@ -0,0 +1,3 @@ +#Tue May 12 19:17:54 CEST 2009 +eclipse.preferences.version=1 +indexerId=org.eclipse.cdt.core.fastIndexer Index: C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.managedbuilder.core.prefs =================================================================== --- C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.managedbuilder.core.prefs (revision 1585) +++ C:/eclipse/workspace/ct-Bot/.settings/org.eclipse.cdt.managedbuilder.core.prefs (working copy) @@ -1,13 +1,15 @@ -#Thu Mar 29 15:23:55 CEST 2007 -cdt.managedbuild.config.gnu.exe.debug.1197043799/internalBuilder/enabled=false -cdt.managedbuild.config.gnu.exe.debug.1197043799/internalBuilder/ignoreErr=true -eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1197043799.2016949464=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1197043799.2016949464=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n -environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n -environment/project/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="\:" name\="PATH" operation\="append" value\="/usr/local/avr/bin"/>\n</environment>\n +#Tue May 12 19:19:04 CEST 2009 +cdt.managedbuild.config.gnu.exe.debug.1077176217/internalBuilder/enabled=false +cdt.managedbuild.config.gnu.exe.debug.1077176217/internalBuilder/ignoreErr=true +cdt.managedbuild.config.gnu.exe.debug.1197043799/internalBuilder/enabled=false +cdt.managedbuild.config.gnu.exe.debug.1197043799/internalBuilder/ignoreErr=true +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1197043799.2016949464=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="C_INCLUDE_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1197043799.2016949464=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n +environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<environment/>\r\n +environment/project/cdt.managedbuild.config.gnu.exe.debug.1077176217=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<environment/>\r\n +environment/project/cdt.managedbuild.config.gnu.exe.debug.1197043799=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="\:" name\="PATH" operation\="append" value\="/usr/local/avr/bin"/>\n</environment>\n