Doc URBI

Pour urbiengine-surveyor

Documentation des périphériques

(book compiled from )

Thomas Moulard

Guillaume Deslandes

Traduction de l'anglais Antoine (zelig) Hue

This document is released under the Attribution-NonCommercial-NoDerivs 2.0 Creative Commons licence (http://creativecommons.org/licenses/by-nc-nd/2.0/deed.en).


Table of Contents

1. Introduction
2. Démarrage rapide
3. Premières commandes
Préface
Liste rapide des périphériques
Des commandes simples
4. Les périphériques
Camera
Motors
IR emitters
5. SRV-1 scripting
Préface
Bumper
Navigator
6. Dépannage et FAQ
Dépannage
Frequently Asked Questions
A. Copyright

List of Tables

3.1. Caractéristiques des périphériques
4.1. Les attributs de Camera
4.2. Les méthodes de Camera
4.3. caractéristiques de motor
4.4. attributs de Motor
4.5. Les caractèristiques de Motor
4.6. Les attributs d'IR

Chapter 1. Introduction

Cette documentation contient des informations sur le Surveyor SRV-1 Robot URBI engine (SRV-1 URBI engine, ou SRV-1 engine pour faire court).

Vous serez intéressé de lire des informations à propos du SRV-1 à surveyor.com si vous n'êtes pas déjà familier avec lui.

Le premier chapitre donne des instructions pour un lancement rapide et un petit tutoriel pour utiliser URBI sur le SRV-1.

Le reste de la documentation contient une référence exhaustive pour le SRV-1 URBI engine et des exemples plus avancés de scrips URBI.

Chapter 2. Démarrage rapide

En premier, assurez vous que votre SRV-1 Robot est opérationnel. Vous allez devoir installer driver pour le module radio si ce n'est pas déjà fait.

Maintenant que vous avez un robot en état de marche vous pouvez installer le SRV-1 engine. La procédure d'installation dépendra de votre système, mais vous sera familier. Une fois que c'est fait, vous trouverez un répertoire bin dans lequel vous trouverez le binaire du urbi-server-surveyor. D'autres fichiers importants sont localisés dans le répertoire data.

Avant de lancer l'engine, vous devrez changer la valeur system.comport dans le fichier data/config.u . Il doit avoir une valeur comme COM1 sur MS Windows, /dev/cu.SLAB_USBtoUART sur Mac OS X ou /dev/ttyUSB0 sur Linux. L'engine échouera si le port spécifié est incorrect ou n'a pas les bonnes permissions.

Allez dans votre répertoire d'installation SRV-1, passez dans le répertoire bin et lancez urbi-server-surveyor. Le message d'aide suivant apparaitra :

usage: ./urbi-server-surveyor [options] period [path1 path2 ...]
  period : base URBI interval in milliseconds
  les item path(chemin) sont des éléments absolus ou relatifs où l'on recherche dans l'ordre quand 'load' est appelé.
  options:
    -p port : précise le port tcp qu'URBI écoutera.
    -b address: lie à l'adresse ip spécifiée.
    -n      : n'autorise pas le travail en réseau.
    -r      : autorise le report du temps pris par la boucle URBI pour s'exécuter
    -s <period>: shell-mode (pas de réseau) avec une période donnée
    -f      : enable fast mode: le serveur tournera aussi vite que possible et émulera la période spécifiée

pour un lancement rapide du SRV-1 engine, tapez simplement :

./urbi-engine-surveyor 50 ../data

L'engine affichera un header(en-tête) et dira que c'est prêt. Si tout est va bien, rien de plus ne se produira. Si votre robot est éteint, ou injoignable, l'engine dira Waiting for robot initialisation.

Maintenant votre robot devrait fonctionner. Pour tester la connection, utilisez ou l'outil spécialement fournit par Gostai, ou un simple client telnet (notez que tout les URBI engine URBI ont le port 54000 par défaut).

telnet localhost 54000

S'il n'y a pas d'erreurs, votre client telnet devrait recevoir le même type d'en-tête que vous avez vu dans l'engine window. La dernière ligne donnera votre id de connection et sera de la forme :

[65000000:ident] *** ID: U135766920

Si ce n'est pas le cas, assurez vous que vous avez correctement installé l'engine et suivez les étapes suivantes. référez vous à Dépannage et FAQ si vous avez encore des difficultés pour lancer le serveur.

Vous êtes maintenant prêt à envoyer des commandes à votre robot par le Surveyor SRV-1 URBI engine. Par exemple essayez :

vars;
...
[00004004:notag] *** Camera = OBJ
...

La première ligne demande pour toutes les variables connues par le serveur et les lignes suivantes, dont vous n'avez pas à vous inquiéter pour l'instant, liste les symboles et leurs valeurs respectives.

Chapter 3. Premières commandes

Préface

Ce chapitre introduira des concepts de base pour l'utilisation du SRV-1 URBI engine. Il peut être passé si vous êtes déjà familier avec les URBI engines.

Pour de plus amples instructions et informations sur les commandes URBI, lisez le premier chapitre du tutoriel URBI.

Avant tout autre chose, assurez vous du succès des étapes présentées dans le chapitre Démarrage rapide.

Liste rapide des périphériques

Voici une liste rapide des périphériques disponibles pour le SRV-1 avec lesquels vous pouvez contrôler l'engine.

Table 3.1. Caractéristiques des périphériques

NomTypeDescription
cameraSensorPériphérique camera principale
wheelLActorRoue gauche
wheelRActorRoue droite
wheelsActor groupRoues ensembles
irFSensorEmetteur IR avant
irBSensorEmetteur IR arrière
irLSensorEmetteur IR gauche
irRSensorEmetteur IR droit
irsSensor groupTous les émetteurs IR


Des commandes simples

Essayez cette première commande dans votre cession telnet :

irF;
[00000476:notag] 0.000000

La première ligne demande la valeur de l'émetteur IR avant. La seconde est la réponse du SRV-1 engine. La première valeur integer est un timestamp(marqueur temporel) pour la réponse (en millisecondes depuis le démarrage de l'engine). Elle est suivie d'un tag. Référez vous au tutoriel URBI pour plus de détails. Ce qui est important ici est la virgule flottante finissant la ligne. C'est la valeur stockée dans l'émetteur IR avant. Ici 0.000000 indique qu'il n'y a rien en face du robot. Avec votre main en face du robot, vous devriez récupérer une valeur approximative de 150.000000.

Notez que les prochaines commandes seront incluses dans +end:{...};. Ceci préviendra de la fin d'une commande par l'engine.

Essayez ce qui suit :

+end:{wheels = 40; wait (2s) | wheels = 0;};
[00002622:notag] *** end

Votre robot avancera tout droit pendant 2 secondes, puis s'arrêtera. Vous devez maintenant essayer de le faire revenir à sa position initiale par une commande similaire.

Ensuite, essayez ceci :

+end:{wheelL = -50; wheelR = 50; wait (2s) | wheels = 0;};
[00005095:notag] *** end

Votre robot tournera sur lui-même pendant 2 secondes.

La dernière commande simple sera :

irFDetect:at (irF > 100) echo "Front obstacle : " + irF;

maintenant essayer de mettre votre main devant leSRV-1. Vous aurez un message du genre :

[00008215:notag] *** irF : 150

Le mot-clé at vous permet de détecter des événements et de faire agir votre SRV-1 en conséquence.

Vous devriez à présent être capable de jouer avec votre SRV-1 URBI engine. Le chapitre suivant vous donnera des détails complets à propos de l'engine, mais ce que nous avons vu ici est suffisant pour utiliser SRV-1 et URBI.

Chapter 4. Les périphériques

Table of Contents

Camera
Motors
IR emitters

Camera

La caméra du SRV-1 est accessible par l'objet camera de l'engine. Le tableau suivant décrit les attributs et les méthodes de camera.

Table 4.1. Les attributs de Camera

NomDescription
valImage (jpeg image, binary data)
blindSi different de 0, l'image de la caméra n'est pas automatiquement demandée par le serveur.
resolutionCamera resolution: 1 = 80x64px, 3 = 160x128px, 5 = 320x240px
dump_pathRépertoire par défaut pour écrire les images venant de la caméra. Changer sa valeur n'est pas sûr, veuillez utilisez set_dump_path


essayer camera.val; directement dans une cession telnet affichera des données brutes sur votre terminal. Utilisez les méthodes suivantes pour récupérer les images. Notez que les fonctions dump empêche l'attribut blind de l'image d'être écrit.

Table 4.2. Les méthodes de Camera

NomRetoursParamètresDescription
adumpnonenoneDump(écrit les données) de camera dans le fichier, donne automatiquement un nom au fichier.
dumpnonestring:filenameDump camera dans un fichier donné.
set_dump_path0/1string:pathFixe le répertoire de dump de camera. Par défaut le répertoire courant.


Motors

Les moteurs de SRV-1, sont accessibles par les objets wheelX et ont les caractéristiques suivantes :

Table 4.3. caractéristiques de motor

NomRangeminRangemaxDescription
wheelL-128127Left wheel
wheelR-128127Right wheel
wheels-128127Both wheels (device group)


Un moteur à les attributs suivants :

Table 4.4. attributs de Motor

NomDescription
valMotor speed.


IR emitters

L'émetteur d'infrarouges de SRV-1 est accessible par les objets irX et ont les caractéristiques suivantes :

Table 4.5. Les caractèristiques de Motor

NomRangeminRangemaxDescription
irF0154Front IR emitter
irB0154Back IR emitter
irL0154Left IR emitter
irR0154Right IR emitter
irs0154All IR emitters


Un IR emitter a les attributs suivants :

Table 4.6. Les attributs d'IR

NomDescription
valSensor input


Le groupe hardware qui contient tous les périphériques est disponible.

Chapter 5. SRV-1 scripting

Table of Contents

Préface
Bumper
Navigator

Préface

Ce chapitre introduira quelques scripts simples. Pour les utiliser tapez

load ("filename.u");

dépendant de la version du URBI engine que vous avez, quelques scripts sont disponibles dans les dossiers data ou scripts de votre répertoire d'installation.

Avant tout autre chose, soyez certain que vous soyez familier avec les parties précédentes de ce document.

Pour de plus amples instructions et informations sur les commandes URBI , lisez le premier chapitre du tutoriel URBI.

Bumper

/* ----------------- Bumper for SRV-1 -------------------------------------- */

bumper:at (irF > 100)         // détection d'un obstacle
{
  wheels = 0 | wait (500ms);  // stop et attend un peu
  wheels = -50 | wait (1s);   // recule
  wheels = 0 time:1s |        // stop doucement
  wheels = 40;                // avance
};

wheels = 40;                  // initial start

/* ----------------- Bumper for SRV-1 -------------------------------------- */

Ce script fera avancer votre SRV-1, s'arrêter devant le premier obstacle reculer un peu et avancer à nouveau. Vous aurez a imaginer comment l'arrêter.

Navigator

/* ----------------- Navigator for SRV-1 ----------------------------------- */

WHEEL_SLOW = 40;              // moving speed
WHEEL_FAST = 60;              // turning speed
NAV.side = 1;                 // way to turn

navigator:at (irF > 100)                      // détection d'un obstacle
{
  wheels = 0 | wait (500ms);                  // stop et attend un peu
  wheels = -40 | wait (500ms);                // recule
  NAV.side = NAV.side * -1;                   // change de direction
  wheelL = NAV.side * WHEEL_FAST &            // tourne
    wheelR = - NAV.side * WHEEL_FAST;
  waituntil (irF < 50) | wheels = WHEEL_SLOW; // attend que la voie soit libre
                                              // et avance
};

wheels = WHEEL_SLOW;          // initial start

/* ----------------- Navigator for SRV-1 ----------------------------------- */

Ce script fera tourner votre robot soit à gauche soit à droite jusqu'à ce qu'il trouve une voie libre. Puis il avancera à nouveau jusqu'au prochain obstacle.

Chapter 6. Dépannage et FAQ

Ce chapitre n'est pas encore fini.

Dépannage

Frequently Asked Questions

Appendix A. Copyright


THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE
TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR
"LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE
LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE
OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS
YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF
SUCH TERMS AND CONDITIONS.

1. Definitions

   1. "Collective Work" means a work, such as a periodical issue,
   anthology or encyclopedia, in which the Work in its entirety in
   unmodified form, along with a number of other contributions,
   constituting separate and independent works in themselves, are
   assembled into a collective whole. A work that constitutes a
   Collective Work will not be considered a Derivative Work (as
   defined below) for the purposes of this License.  2. "Derivative
   Work" means a work based upon the Work or upon the Work and other
   pre-existing works, such as a translation, musical arrangement,
   dramatization, fictionalization, motion picture version, sound
   recording, art reproduction, abridgment, condensation, or any other
   form in which the Work may be recast, transformed, or adapted,
   except that a work that constitutes a Collective Work will not be
   considered a Derivative Work for the purpose of this License. For
   the avoidance of doubt, where the Work is a musical composition or
   sound recording, the synchronization of the Work in timed-relation
   with a moving image ("synching") will be considered a Derivative
   Work for the purpose of this License.  3. "Licensor" means the
   individual or entity that offers the Work under the terms of this
   License.  4. "Original Author" means the individual or entity who
   created the Work.  5. "Work" means the copyrightable work of
   authorship offered under the terms of this License.  6. "You" means
   an individual or entity exercising rights under this License who
   has not previously violated the terms of this License with respect
   to the Work, or who has received express permission from the
   Licensor to exercise rights under this License despite a previous
   violation.

2. Fair Use Rights. Nothing in this license is intended to reduce,
limit, or restrict any rights arising from fair use, first sale or
other limitations on the exclusive rights of the copyright owner under
copyright law or other applicable laws.

3. License Grant. Subject to the terms and conditions of this License,
Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:

   1. to reproduce the Work, to incorporate the Work into one or more
   Collective Works, and to reproduce the Work as incorporated in the
   Collective Works; 2. to distribute copies or phonorecords of,
   display publicly, perform publicly, and perform publicly by means
   of a digital audio transmission the Work including as incorporated
   in Collective Works;

The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make
such modifications as are technically necessary to exercise the rights
in other media and formats, but otherwise you have no rights to make
Derivative Works. All rights not expressly granted by Licensor are
hereby reserved, including but not limited to the rights set forth in
Sections 4(d) and 4(e).

4. Restrictions.The license granted in Section 3 above is expressly
made subject to and limited by the following restrictions:

   1. You may distribute, publicly display, publicly perform, or
   publicly digitally perform the Work only under the terms of this
   License, and You must include a copy of, or the Uniform Resource
   Identifier for, this License with every copy or phonorecord of the
   Work You distribute, publicly display, publicly perform, or
   publicly digitally perform. You may not offer or impose any terms
   on the Work that alter or restrict the terms of this License or the
   recipients' exercise of the rights granted hereunder. You may not
   sublicense the Work. You must keep intact all notices that refer to
   this License and to the disclaimer of warranties. You may not
   distribute, publicly display, publicly perform, or publicly
   digitally perform the Work with any technological measures that
   control access or use of the Work in a manner inconsistent with the
   terms of this License Agreement. The above applies to the Work as
   incorporated in a Collective Work, but this does not require the
   Collective Work apart from the Work itself to be made subject to
   the terms of this License. If You create a Collective Work, upon
   notice from any Licensor You must, to the extent practicable,
   remove from the Collective Work any reference to such Licensor or
   the Original Author, as requested.  2. You may not exercise any of
   the rights granted to You in Section 3 above in any manner that is
   primarily intended for or directed toward commercial advantage or
   private monetary compensation. The exchange of the Work for other
   copyrighted works by means of digital file-sharing or otherwise
   shall not be considered to be intended for or directed toward
   commercial advantage or private monetary compensation, provided
   there is no payment of any monetary compensation in connection with
   the exchange of copyrighted works.  3. If you distribute, publicly
   display, publicly perform, or publicly digitally perform the Work,
   You must keep intact all copyright notices for the Work and give
   the Original Author credit reasonable to the medium or means You
   are utilizing by conveying the name (or pseudonym if applicable) of
   the Original Author if supplied; the title of the Work if supplied;
   and to the extent reasonably practicable, the Uniform Resource
   Identifier, if any, that Licensor specifies to be associated with
   the Work, unless such URI does not refer to the copyright notice or
   licensing information for the Work. Such credit may be implemented
   in any reasonable manner; provided, however, that in the case of a
   Collective Work, at a minimum such credit will appear where any
   other comparable authorship credit appears and in a manner at least
   as prominent as such other comparable authorship credit.  4.

      For the avoidance of doubt, where the Work is a musical
         composition: 1. Performance Royalties Under Blanket
         Licenses. Licensor reserves the exclusive right to collect,
         whether individually or via a performance rights society
         (e.g. ASCAP, BMI, SESAC), royalties for the public
         performance or public digital performance (e.g. webcast) of
         the Work if that performance is primarily intended for or
         directed toward commercial advantage or private monetary
         compensation.  2. Mechanical Rights and Statutory
         Royalties. Licensor reserves the exclusive right to collect,
         whether individually or via a music rights agency or
         designated agent (e.g. Harry Fox Agency), royalties for any
         phonorecord You create from the Work ("cover version") and
         distribute, subject to the compulsory license created by 17
         USC Section 115 of the US Copyright Act (or the equivalent in
         other jurisdictions), if Your distribution of such cover
         version is primarily intended for or directed toward
         commercial advantage or private monetary compensation.
         5. Webcasting Rights and Statutory Royalties. For the
         avoidance of doubt, where the Work is a sound recording,
         Licensor reserves the exclusive right to collect, whether
         individually or via a performance-rights society
         (e.g. SoundExchange), royalties for the public digital
         performance (e.g. webcast) of the Work, subject to the
         compulsory license created by 17 USC Section 114 of the US
         Copyright Act (or the equivalent in other jurisdictions), if
         Your public digital performance is primarily intended for or
         directed toward commercial advantage or private monetary
         compensation.

5. Representations, Warranties and Disclaimer

UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR
OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE,
MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR
THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF
ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO
NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY
NOT APPLY TO YOU.

6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY
APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY
LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR
EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK,
EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. Termination

   1. This License and the rights granted hereunder will terminate
   automatically upon any breach by You of the terms of this
   License. Individuals or entities who have received Collective Works
   from You under this License, however, will not have their licenses
   terminated provided such individuals or entities remain in full
   compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
   survive any termination of this License.  2. Subject to the above
   terms and conditions, the license granted here is perpetual (for
   the duration of the applicable copyright in the
   Work). Notwithstanding the above, Licensor reserves the right to
   release the Work under different license terms or to stop
   distributing the Work at any time; provided, however that any such
   election will not serve to withdraw this License (or any other
   license that has been, or is required to be, granted under the
   terms of this License), and this License will continue in full
   force and effect unless terminated as stated above.

8. Miscellaneous

   1. Each time You distribute or publicly digitally perform the Work
   or a Collective Work, the Licensor offers to the recipient a
   license to the Work on the same terms and conditions as the license
   granted to You under this License.  2. If any provision of this
   License is invalid or unenforceable under applicable law, it shall
   not affect the validity or enforceability of the remainder of the
   terms of this License, and without further action by the parties to
   this agreement, such provision shall be reformed to the minimum
   extent necessary to make such provision valid and enforceable.
   3. No term or provision of this License shall be deemed waived and
   no breach consented to unless such waiver or consent shall be in
   writing and signed by the party to be charged with such waiver or
   consent.  4. This License constitutes the entire agreement between
   the parties with respect to the Work licensed here. There are no
   understandings, agreements or representations with respect to the
   Work not specified here. Licensor shall not be bound by any
   additional provisions that may appear in any communication from
   You. This License may not be modified without the mutual written
   agreement of the Licensor and You.