Absender: Frank Menzel
Datum: Mi, 22.08.2007 19:07:39
In-reply-to:
<812F86EC9E1A96489D5E83C2AB7D68860130921E@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Hallo, hier erst einmal meine Anpassungen als Patch für das Pillarverhalten. Wenn der Bot nach einer Umdrehung kein passendes Objekt zum Einfangen gefunden hat, wird das Verhalten nun beendet und nicht endlos weitergedreht. Passend heisst, dass nicht beide Sensoren etwas detektieren dürfen innerhalb der definierten Reichweite (ausgelagert nach bot-local.h), da dann das Objekt ja für unseren Schacht zu breit wäre. So wird auch eine Wand nun nicht mehr als einzufangendes Objekt erkannt. Weiterhin gibt?s das bot_unload_pillar_behaviour, welches das eingefangene Objekt wieder entlädt durch Klappe auf-etwas rückwärts-Klappe zu und fertig. War nix im Bauch, wird das Verhalten gleich wieder beendet. Gruß, Frank Menzel -----Ursprüngliche Nachricht----- Von: ct-bot-entwickler-bounces@xxxxxxxxxxxxxxxxx [mailto:ct-bot-entwickler-bounces@xxxxxxxxxxxxxxxxx] Im Auftrag von Menzel, Frank IT-OO4 Gesendet: Dienstag, 21. August 2007 15:26 An: Entwicklung rund um den c't-bot Betreff: RE: [ct-bot] Bot_catch_pillar... Hallo, dieses Verhalten habe ich schon parat, wollte bloß erst einmal grundsätzliche Voraussetzungen bestehender Verhalten schaffen, um nicht gleich zu viel anzubieten... Mit freundlichen Grüßen Frank Menzel -----Original Message----- From: ct-bot-entwickler-bounces@xxxxxxxxxxxxxxxxx [mailto:ct-bot-entwickler-bounces@xxxxxxxxxxxxxxxxx] On Behalf Of Benjamin Benz Sent: Tuesday, August 21, 2007 11:54 AM To: Entwicklung rund um den c't-bot Subject: Re: [ct-bot] Bot_catch_pillar... Hi, klar, das Verhalten war ein ganz einfach gestricktes Beispiel, wie man die Klappe verwenden kann. Erweiterungen/Perfektionierungen sind extrem willkommen. Schön wäre sicher auch eine Kombination mit einem Explore-Verhalten, bei dem der Bot rumfährt und einen Gegenstand sucht.. MfG Benjamin Benz Menzel, Frank IT-OO4 schrieb: > > Hallo, > beim experimentieren mit dem bot_catch_pillar-Verhalten ist mir aufgefallen, dass dieses den bot endlos im Kreis drehen lässt, wenn im Umkreis kein Objekt zum Einfangen vorhanden ist. Hier könnte doch nach 360 Grad beendet werden, damit das Verhalten sinnvoll eingesetzt werden kann durch Aufruf von anderen Verhalten aus. Weiterhin ist mir aufgefallen, dass eine Wand (wenn in Reichweite) als einzufangendes Objekt erkannt wird. Hierfür müßte noch eine Sicherheit rein, dass nur ein Sensor das Objekt sehen darf. Denn sehen beide ein Objekt innerhalb der Reichweite, so ist es eine Wand oder eben zu dick zum Einfangen und darf nicht als einzufangendes Objekt gelten. > > Mit freundlichen Grüßen > Frank Menzel > > > > Confidentiality note: > The information in this email and any attachment may contain confidential and proprietary information of Heidelberger Druckmaschinen AG and/or its affiliates and may be privileged or otherwise protected >from disclosure. If you are not the intended recipient, you are hereby notified that any review, reliance or distribution by others or forwarding without express permission is strictly prohibited and may cause liability. In case you have received this message due to an error in transmission, we kindly ask you to notify the sender immediately and to delete this email and any attachment from your system. > > _______________________________________________ > ct-bot-entwickler Mailingliste > ct-bot-entwickler@xxxxxxxxxxxxxxxxx > http://www.heise.de/bin/newsletter/listinfo/ct-bot-entwickler > -- Benjamin Benz Heise Zeitschriften Verlag Redaktion c't eMail: bbe@xxxxxxxx WWW : http://www.heise.de Heise Zeitschriften Verlag GmbH & Co. KG Registergericht: Amtsgericht Hannover HRA 26709 Persönlich haftende Gesellschafterin: Heise Zeitschriften Verlag Geschäftsführung GmbH Registergericht: Amtsgericht Hannover, HRB 60405 Geschäftsführer: Ansgar Heise, Steven P. Steinkraus, Dr. Alfons Schräder _______________________________________________ ct-bot-entwickler Mailingliste ct-bot-entwickler@xxxxxxxxxxxxxxxxx http://www.heise.de/bin/newsletter/listinfo/ct-bot-entwickler Confidentiality note: The information in this email and any attachment may contain confidential and proprietary information of Heidelberger Druckmaschinen AG and/or its affiliates and may be privileged or otherwise protected >from disclosure. If you are not the intended recipient, you are hereby notified that any review, reliance or distribution by others or forwarding without express permission is strictly prohibited and may cause liability. In case you have received this message due to an error in transmission, we kindly ask you to notify the sender immediately and to delete this email and any attachment from your system. _______________________________________________ ct-bot-entwickler Mailingliste ct-bot-entwickler@xxxxxxxxxxxxxxxxx http://www.heise.de/bin/newsletter/listinfo/ct-bot-entwickler
Index: C:/eclipse/workspace/ct-Bot/bot-logic/bot-logik.c =================================================================== --- C:/eclipse/workspace/ct-Bot/bot-logic/bot-logik.c (revision 1221) +++ C:/eclipse/workspace/ct-Bot/bot-logic/bot-logik.c (working copy) @@ -198,6 +198,7 @@ #ifdef BEHAVIOUR_CATCH_PILLAR_AVAILABLE insert_behaviour_to_list(&behaviour, new_behaviour(44, bot_catch_pillar_behaviour,INACTIVE)); + insert_behaviour_to_list(&behaviour, new_behaviour(43, bot_unload_pillar_behaviour,INACTIVE)); #endif Index: C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_catch_pillar.c =================================================================== --- C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_catch_pillar.c (revision 1221) +++ C:/eclipse/workspace/ct-Bot/bot-logic/behaviour_catch_pillar.c (working copy) @@ -1,26 +1,26 @@ /* * c't-Bot - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your - * option) any later version. - * This program is distributed in the hope that it will be + * option) any later version. + * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307, USA. - * + * */ /*! @file behaviour_catch_pillar.c * @brief sucht nach einer Dose und fängt sie ein - * + * * @author Benjamin Benz (bbe@xxxxxxxx) * @date 08.12.06 */ @@ -28,26 +28,50 @@ #include "bot-logic/bot-logik.h" #ifdef BEHAVIOUR_CATCH_PILLAR_AVAILABLE + #include <math.h> -#define MAX_PILLAR_DISTANCE 350 - #define START 0 -#define LEFT_FOUND 1 -#define TURN_MIDDLE 2 -#define GO 3 +#define SEARCH_LEFT 1 +#define LEFT_FOUND 2 +#define TURN_MIDDLE 3 +#define GO 4 +#define P_END 9 static uint8 pillar_state=START; -/*! - * Fange eine Dose ein +static int16 startangle=0; // gemerkter Anfangswinkel einfach als Integer +static uint8 cancelcheck=False; +/*! + * Fange eine Dose ein * @param *data der Verhaltensdatensatz */ -void bot_catch_pillar_behaviour(Behaviour_t *data){ +void bot_catch_pillar_behaviour(Behaviour_t *data){ static float angle; - + switch (pillar_state){ case START: - if (sensDistL < MAX_PILLAR_DISTANCE){ // sieht der linke Sensor schon was? + startangle=heading; + cancelcheck=False; + pillar_state=SEARCH_LEFT; + break; + + case SEARCH_LEFT: + // Nach 1x Rundumsuche und nix gefunden ist Schluss; Dazu wird der Check zum Start + // nach Ueberschreiten der 5Grad-Toleranz eingeschaltet und die Drehung dann beendet wenn + // der Winkel wieder innerhalb dieser Toleranz liegt + if (cancelcheck) { + if (fabs(heading - startangle) < 5 ) + // Damit nicht endlos rundum gedreht wird Abbruch, wenn kein Gegenstand gefunden + pillar_state = P_END; + } + else { + if (fabs(heading - startangle) >= 5) + cancelcheck=True; + } + + + // linker Sensor muss was sehen, der rechte aber nicht + if (sensDistL < MAX_PILLAR_DISTANCE && sensDistR > MAX_PILLAR_DISTANCE){ // sieht der linke Sensor schon was? angle=heading; pillar_state=LEFT_FOUND; } else @@ -56,6 +80,12 @@ //bot_turn(data,5); // Ein Stueck drehen break; case LEFT_FOUND: + // links und rechts darf nicht gleichzeitig was gesehen werden, sonst weiter mit drehen + if (sensDistL < MAX_PILLAR_DISTANCE && sensDistR < MAX_PILLAR_DISTANCE){ + pillar_state=SEARCH_LEFT; + break; + } + if (sensDistR < MAX_PILLAR_DISTANCE){ // sieht der rechte Sensor schon was? angle= heading- angle; if (angle < 0) @@ -81,14 +111,19 @@ if (sensTrans ==0){ speedWishLeft=+BOT_SPEED_SLOW; speedWishRight=+BOT_SPEED_SLOW; - } else { - bot_servo(data,SERVO1,DOOR_CLOSE); - pillar_state++; + // nicht endlos vorwaertslaufen, weiter mit Suche bis Drehende + if (sensDistL < MAX_PILLAR_DISTANCE && sensDistR < MAX_PILLAR_DISTANCE) + pillar_state=SEARCH_LEFT; } + else { + bot_servo(data,SERVO1,DOOR_CLOSE); + pillar_state++; + } + break; - + default: - pillar_state=START; + pillar_state=START; return_from_behaviour(data); break; } @@ -101,6 +136,52 @@ void bot_catch_pillar(Behaviour_t * caller){ pillar_state=0; // Zielwerte speichern - switch_to_behaviour(caller,bot_catch_pillar_behaviour,OVERRIDE); + switch_to_behaviour(caller,bot_catch_pillar_behaviour,OVERRIDE); } + +/*! + * Gibt die Dose wieder aus, Entladevorgang + * @param *data der Verhaltensdatensatz + */ +void bot_unload_pillar_behaviour(Behaviour_t *data){ + + switch (pillar_state){ + case START: + pillar_state=P_END; + if (sensTrans ==1){ // ist was im Bauch gehts los + pillar_state=1; + // ist was drin, dann Klappe auf und danach Rueckwaerts + bot_servo(data,SERVO1,DOOR_OPEN); // Klappe auf + } + break; + + case 1: + bot_drive_distance(data,0,-BOT_SPEED_FOLLOW,10);// 10cm rueckwaerts nur bei Hindernis + pillar_state++; + break; + case 2: + bot_servo(data,SERVO1,DOOR_CLOSE); + pillar_state++; + break; + default: + pillar_state=START;// bei Umschaltung via Verhaltensscreen ist dies notwendig + return_from_behaviour(data); + break; + } +} + + + + + +/*! + * Entlaedt das Objekt wieder + * @param caller Der obligatorische Verhaltensdatensatz des Aufrufers + */ +void bot_unload_pillar(Behaviour_t * caller){ + pillar_state=START; + // Zielwerte speichern + switch_to_behaviour(caller,bot_unload_pillar_behaviour,OVERRIDE); +} + #endif Index: C:/eclipse/workspace/ct-Bot/include/bot-logic/behaviour_catch_pillar.h =================================================================== --- C:/eclipse/workspace/ct-Bot/include/bot-logic/behaviour_catch_pillar.h (revision 1221) +++ C:/eclipse/workspace/ct-Bot/include/bot-logic/behaviour_catch_pillar.h (working copy) @@ -46,6 +46,19 @@ */ void bot_catch_pillar(Behaviour_t * caller); +/*! + * Gibt die Dose wieder aus, Entladevorgang + * @param *data der Verhaltensdatensatz + */ +void bot_unload_pillar_behaviour(Behaviour_t *data); + +/*! + * Botenfkt + * Entlaedt das Objekt wieder + * @param caller Der obligatorische Verhaltensdatensatz des Aufrufers + */ +void bot_unload_pillar(Behaviour_t * caller); + #endif #endif /*BEHAVIOUR_CATCH_PILLAR_H_*/ Index: C:/eclipse/workspace/ct-Bot/include/bot-local.h =================================================================== --- C:/eclipse/workspace/ct-Bot/include/bot-local.h (revision 1221) +++ C:/eclipse/workspace/ct-Bot/include/bot-local.h (working copy) @@ -114,7 +114,12 @@ #define PRIO_VISIBLE_MAX 154 /*!< Prioritaet, die ein Verhalten hoechstens haben darf, um angezeigt zu werden */ +/* Konstanten fuer die Entfernung. innerhalb derer nur ein Objekt eingefangen wird */ +#ifdef PC + #define MAX_PILLAR_DISTANCE 350 +#else + #define MAX_PILLAR_DISTANCE 200 +#endif - #endif /*BOTLOCAL_H_*/ Index: C:/eclipse/workspace/ct-Bot/Changelog.txt =================================================================== --- C:/eclipse/workspace/ct-Bot/Changelog.txt (revision 1221) +++ C:/eclipse/workspace/ct-Bot/Changelog.txt (working copy) @@ -1,5 +1,7 @@ CHANGELOG fuer c't-Bot ====================== +2007-08-21 Frank Menzel [Menzelfr@xxxxxxx]: Entladeverhalten bot_unload_pillar_behaviour und Aenderungen catch_pillar + 2007-08-16 Benjamin Benz [bbe@xxxxxxxx]: neue Kartenorganisation fertiggestellt ==> kann noch per Schalter deaktiviert werden. Testmuster für Karte eingeführt 2007-08-16 Timo Sandmann [mail@xxxxxxxxxxxxxxx]: Hinweise zur Abgrund- und Liniensensorkalibrierung in Documentation/sensor.html ergaenzt 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 @@ +#Wed Aug 22 18:50:05 CEST 2007 +eclipse.preferences.version=1 +indexerId=org.eclipse.cdt.core.fastIndexer