Index: branches/semaphore/trunk/LICENCE-fr.txt
===================================================================
--- branches/semaphore/trunk/LICENCE-fr.txt (revision 115)
+++ branches/semaphore/trunk/LICENCE-fr.txt (revision 115)
@@ -0,0 +1,529 @@
+
+Le framework de développement UTC/CNRS Heudiasyc Flair est distribué
+sous les termes de la licence CECILL-C version 1.0.
+
+Copyright (c) UTC/CNRS Heudiasyc. All rights reserved.
+
+
+
+CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-C
+
+
+ Avertissement
+
+Ce contrat est une licence de logiciel libre issue d'une concertation
+entre ses auteurs afin que le respect de deux grands principes préside à
+sa rédaction:
+
+ * d'une part, le respect des principes de diffusion des logiciels
+ libres: accès au code source, droits étendus conférés aux
+ utilisateurs,
+ * d'autre part, la désignation d'un droit applicable, le droit
+ français, auquel elle est conforme, tant au regard du droit de la
+ responsabilité civile que du droit de la propriété intellectuelle
+ et de la protection qu'il offre aux auteurs et titulaires des
+ droits patrimoniaux sur un logiciel.
+
+Les auteurs de la licence CeCILL-C (pour Ce[a] C[nrs] I[nria] L[ogiciel]
+L[ibre]) sont:
+
+Commissariat à l'Energie Atomique - CEA, établissement public de
+recherche à caractère scientifique, technique et industriel, dont le
+siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris.
+
+Centre National de la Recherche Scientifique - CNRS, établissement
+public à caractère scientifique et technologique, dont le siège est
+situé 3 rue Michel-Ange, 75794 Paris cedex 16.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, établissement public à caractère scientifique et technologique,
+dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153
+Le Chesnay cedex.
+
+
+ Préambule
+
+Ce contrat est une licence de logiciel libre dont l'objectif est de
+conférer aux utilisateurs la liberté de modifier et de réutiliser le
+logiciel régi par cette licence.
+
+L'exercice de cette liberté est assorti d'une obligation de remettre à
+la disposition de la communauté les modifications apportées au code
+source du logiciel afin de contribuer à son évolution.
+
+L'accessibilité au code source et les droits de copie, de modification
+et de redistribution qui découlent de ce contrat ont pour contrepartie
+de n'offrir aux utilisateurs qu'une garantie limitée et de ne faire
+peser sur l'auteur du logiciel, le titulaire des droits patrimoniaux et
+les concédants successifs qu'une responsabilité restreinte.
+
+A cet égard l'attention de l'utilisateur est attirée sur les risques
+associés au chargement, à l'utilisation, à la modification et/ou au
+développement et à la reproduction du logiciel par l'utilisateur étant
+donné sa spécificité de logiciel libre, qui peut le rendre complexe à
+manipuler et qui le réserve donc à des développeurs ou des
+professionnels avertis possédant des connaissances informatiques
+approfondies. Les utilisateurs sont donc invités à charger et tester
+l'adéquation du logiciel à leurs besoins dans des conditions permettant
+d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus
+généralement, à l'utiliser et l'exploiter dans les mêmes conditions de
+sécurité. Ce contrat peut être reproduit et diffusé librement, sous
+réserve de le conserver en l'état, sans ajout ni suppression de clauses.
+
+Ce contrat est susceptible de s'appliquer à tout logiciel dont le
+titulaire des droits patrimoniaux décide de soumettre l'exploitation aux
+dispositions qu'il contient.
+
+
+ Article 1 - DEFINITIONS
+
+Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une
+lettre capitale, auront la signification suivante:
+
+Contrat: désigne le présent contrat de licence, ses éventuelles versions
+postérieures et annexes.
+
+Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code
+Source et le cas échéant sa documentation, dans leur état au moment de
+l'acceptation du Contrat par le Licencié.
+
+Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et
+éventuellement de Code Objet et le cas échéant sa documentation, dans
+leur état au moment de leur première diffusion sous les termes du Contrat.
+
+Logiciel Modifié: désigne le Logiciel modifié par au moins une
+Contribution Intégrée.
+
+Code Source: désigne l'ensemble des instructions et des lignes de
+programme du Logiciel et auquel l'accès est nécessaire en vue de
+modifier le Logiciel.
+
+Code Objet: désigne les fichiers binaires issus de la compilation du
+Code Source.
+
+Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur
+sur le Logiciel Initial.
+
+Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le
+Contrat.
+
+Contributeur: désigne le Licencié auteur d'au moins une Contribution
+Intégrée.
+
+Concédant: désigne le Titulaire ou toute personne physique ou morale
+distribuant le Logiciel sous le Contrat.
+
+Contribution Intégrée: désigne l'ensemble des modifications,
+corrections, traductions, adaptations et/ou nouvelles fonctionnalités
+intégrées dans le Code Source par tout Contributeur.
+
+Module Lié: désigne un ensemble de fichiers sources y compris leur
+documentation qui, sans modification du Code Source, permet de réaliser
+des fonctionnalités ou services supplémentaires à ceux fournis par le
+Logiciel.
+
+Logiciel Dérivé: désigne toute combinaison du Logiciel, modifié ou non,
+et d'un Module Lié.
+
+Parties: désigne collectivement le Licencié et le Concédant.
+
+Ces termes s'entendent au singulier comme au pluriel.
+
+
+ Article 2 - OBJET
+
+Le Contrat a pour objet la concession par le Concédant au Licencié d'une
+licence non exclusive, cessible et mondiale du Logiciel telle que
+définie ci-après à l'article 5 pour toute la durée de protection des droits
+portant sur ce Logiciel.
+
+
+ Article 3 - ACCEPTATION
+
+3.1 L'acceptation par le Licencié des termes du Contrat est réputée
+acquise du fait du premier des faits suivants:
+
+ * (i) le chargement du Logiciel par tout moyen notamment par
+ téléchargement à partir d'un serveur distant ou par chargement à
+ partir d'un support physique;
+ * (ii) le premier exercice par le Licencié de l'un quelconque des
+ droits concédés par le Contrat.
+
+3.2 Un exemplaire du Contrat, contenant notamment un avertissement
+relatif aux spécificités du Logiciel, à la restriction de garantie et à
+la limitation à un usage par des utilisateurs expérimentés a été mis à
+disposition du Licencié préalablement à son acceptation telle que
+définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris
+connaissance.
+
+
+ Article 4 - ENTREE EN VIGUEUR ET DUREE
+
+
+ 4.1 ENTREE EN VIGUEUR
+
+Le Contrat entre en vigueur à la date de son acceptation par le Licencié
+telle que définie en 3.1.
+
+
+ 4.2 DUREE
+
+Le Contrat produira ses effets pendant toute la durée légale de
+protection des droits patrimoniaux portant sur le Logiciel.
+
+
+ Article 5 - ETENDUE DES DROITS CONCEDES
+
+Le Concédant concède au Licencié, qui accepte, les droits suivants sur
+le Logiciel pour toutes destinations et pour la durée du Contrat dans
+les conditions ci-après détaillées.
+
+Par ailleurs, si le Concédant détient ou venait à détenir un ou
+plusieurs brevets d'invention protégeant tout ou partie des
+fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas
+opposer les éventuels droits conférés par ces brevets aux Licenciés
+successifs qui utiliseraient, exploiteraient ou modifieraient le
+Logiciel. En cas de cession de ces brevets, le Concédant s'engage à
+faire reprendre les obligations du présent alinéa aux cessionnaires.
+
+
+ 5.1 DROIT D'UTILISATION
+
+Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant
+aux domaines d'application, étant ci-après précisé que cela comporte:
+
+ 1. la reproduction permanente ou provisoire du Logiciel en tout ou
+ partie par tout moyen et sous toute forme.
+
+ 2. le chargement, l'affichage, l'exécution, ou le stockage du
+ Logiciel sur tout support.
+
+ 3. la possibilité d'en observer, d'en étudier, ou d'en tester le
+ fonctionnement afin de déterminer les idées et principes qui sont
+ à la base de n'importe quel élément de ce Logiciel; et ceci,
+ lorsque le Licencié effectue toute opération de chargement,
+ d'affichage, d'exécution, de transmission ou de stockage du
+ Logiciel qu'il est en droit d'effectuer en vertu du Contrat.
+
+
+ 5.2 DROIT DE MODIFICATION
+
+Le droit de modification comporte le droit de traduire, d'adapter,
+d'arranger ou d'apporter toute autre modification au Logiciel et le
+droit de reproduire le logiciel en résultant. Il comprend en particulier
+le droit de créer un Logiciel Dérivé.
+
+Le Licencié est autorisé à apporter toute modification au Logiciel sous
+réserve de mentionner, de façon explicite, son nom en tant qu'auteur de
+cette modification et la date de création de celle-ci.
+
+
+ 5.3 DROIT DE DISTRIBUTION
+
+Le droit de distribution comporte notamment le droit de diffuser, de
+transmettre et de communiquer le Logiciel au public sur tout support et
+par tout moyen ainsi que le droit de mettre sur le marché à titre
+onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé.
+
+Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou
+non, à des tiers dans les conditions ci-après détaillées.
+
+
+ 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION
+
+Le Licencié est autorisé à distribuer des copies conformes du Logiciel,
+sous forme de Code Source ou de Code Objet, à condition que cette
+distribution respecte les dispositions du Contrat dans leur totalité et
+soit accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le Code Objet du Logiciel est redistribué,
+le Licencié permette un accès effectif au Code Source complet du
+Logiciel pendant au moins toute la durée de sa distribution du Logiciel,
+étant entendu que le coût additionnel d'acquisition du Code Source ne
+devra pas excéder le simple coût de transfert des données.
+
+
+ 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE
+
+Lorsque le Licencié apporte une Contribution Intégrée au Logiciel, les
+conditions de distribution du Logiciel Modifié en résultant sont alors
+soumises à l'intégralité des dispositions du Contrat.
+
+Le Licencié est autorisé à distribuer le Logiciel Modifié sous forme de
+code source ou de code objet, à condition que cette distribution
+respecte les dispositions du Contrat dans leur totalité et soit
+accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le code objet du Logiciel Modifié est
+redistribué, le Licencié permette un accès effectif à son code source
+complet pendant au moins toute la durée de sa distribution du Logiciel
+Modifié, étant entendu que le coût additionnel d'acquisition du code
+source ne devra pas excéder le simple coût de transfert des données.
+
+
+ 5.3.3 DISTRIBUTION DU LOGICIEL DERIVE
+
+Lorsque le Licencié crée un Logiciel Dérivé, ce Logiciel Dérivé peut
+être distribué sous un contrat de licence autre que le présent Contrat à
+condition de respecter les obligations de mention des droits sur le
+Logiciel telles que définies à l'article 6.4. Dans le cas où la création du
+Logiciel Dérivé a nécessité une modification du Code Source le licencié
+s'engage à ce que:
+
+ 1. le Logiciel Modifié correspondant à cette modification soit régi
+ par le présent Contrat,
+ 2. les Contributions Intégrées dont le Logiciel Modifié résulte
+ soient clairement identifiées et documentées,
+ 3. le Licencié permette un accès effectif au code source du Logiciel
+ Modifié, pendant au moins toute la durée de la distribution du
+ Logiciel Dérivé, de telle sorte que ces modifications puissent
+ être reprises dans une version ultérieure du Logiciel, étant
+ entendu que le coût additionnel d'acquisition du code source du
+ Logiciel Modifié ne devra pas excéder le simple coût du transfert
+ des données.
+
+
+ 5.3.4 COMPATIBILITE AVEC LA LICENCE CeCILL
+
+Lorsqu'un Logiciel Modifié contient une Contribution Intégrée soumise au
+contrat de licence CeCILL, ou lorsqu'un Logiciel Dérivé contient un
+Module Lié soumis au contrat de licence CeCILL, les stipulations prévues
+au troisième item de l'article 6.4 sont facultatives.
+
+
+ Article 6 - PROPRIETE INTELLECTUELLE
+
+
+ 6.1 SUR LE LOGICIEL INITIAL
+
+Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel
+Initial. Toute utilisation du Logiciel Initial est soumise au respect
+des conditions dans lesquelles le Titulaire a choisi de diffuser son
+oeuvre et nul autre n'a la faculté de modifier les conditions de
+diffusion de ce Logiciel Initial.
+
+Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi
+par le Contrat et ce, pour la durée visée à l'article 4.2.
+
+
+ 6.2 SUR LES CONTRIBUTIONS INTEGREES
+
+Le Licencié qui a développé une Contribution Intégrée est titulaire sur
+celle-ci des droits de propriété intellectuelle dans les conditions
+définies par la législation applicable.
+
+
+ 6.3 SUR LES MODULES LIES
+
+Le Licencié qui a développé un Module Lié est titulaire sur celui-ci des
+droits de propriété intellectuelle dans les conditions définies par la
+législation applicable et reste libre du choix du contrat régissant sa
+diffusion dans les conditions définies à l'article 5.3.3.
+
+
+ 6.4 MENTIONS DES DROITS
+
+Le Licencié s'engage expressément:
+
+ 1. à ne pas supprimer ou modifier de quelque manière que ce soit les
+ mentions de propriété intellectuelle apposées sur le Logiciel;
+
+ 2. à reproduire à l'identique lesdites mentions de propriété
+ intellectuelle sur les copies du Logiciel modifié ou non;
+
+ 3. à faire en sorte que l'utilisation du Logiciel, ses mentions de
+ propriété intellectuelle et le fait qu'il est régi par le Contrat
+ soient indiqués dans un texte facilement accessible notamment
+ depuis l'interface de tout Logiciel Dérivé.
+
+Le Licencié s'engage à ne pas porter atteinte, directement ou
+indirectement, aux droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs sur le Logiciel et à prendre, le cas échéant, à
+l'égard de son personnel toutes les mesures nécessaires pour assurer le
+respect des dits droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs.
+
+
+ Article 7 - SERVICES ASSOCIES
+
+7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de
+prestations d'assistance technique ou de maintenance du Logiciel.
+
+Cependant le Concédant reste libre de proposer ce type de services. Les
+termes et conditions d'une telle assistance technique et/ou d'une telle
+maintenance seront alors déterminés dans un acte séparé. Ces actes de
+maintenance et/ou assistance technique n'engageront que la seule
+responsabilité du Concédant qui les propose.
+
+7.2 De même, tout Concédant est libre de proposer, sous sa seule
+responsabilité, à ses licenciés une garantie, qui n'engagera que lui,
+lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce,
+dans les conditions qu'il souhaite. Cette garantie et les modalités
+financières de son application feront l'objet d'un acte séparé entre le
+Concédant et le Licencié.
+
+
+ Article 8 - RESPONSABILITE
+
+8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la
+faculté, sous réserve de prouver la faute du Concédant concerné, de
+solliciter la réparation du préjudice direct qu'il subirait du fait du
+Logiciel et dont il apportera la preuve.
+
+8.2 La responsabilité du Concédant est limitée aux engagements pris en
+application du Contrat et ne saurait être engagée en raison notamment:
+(i) des dommages dus à l'inexécution, totale ou partielle, de ses
+obligations par le Licencié, (ii) des dommages directs ou indirects
+découlant de l'utilisation ou des performances du Logiciel subis par le
+Licencié et (iii) plus généralement d'un quelconque dommage indirect. En
+particulier, les Parties conviennent expressément que tout préjudice
+financier ou commercial (par exemple perte de données, perte de
+bénéfices, perte d'exploitation, perte de clientèle ou de commandes,
+manque à gagner, trouble commercial quelconque) ou toute action dirigée
+contre le Licencié par un tiers, constitue un dommage indirect et
+n'ouvre pas droit à réparation par le Concédant.
+
+
+ Article 9 - GARANTIE
+
+9.1 Le Licencié reconnaît que l'état actuel des connaissances
+scientifiques et techniques au moment de la mise en circulation du
+Logiciel ne permet pas d'en tester et d'en vérifier toutes les
+utilisations ni de détecter l'existence d'éventuels défauts. L'attention
+du Licencié a été attirée sur ce point sur les risques associés au
+chargement, à l'utilisation, la modification et/ou au développement et à
+la reproduction du Logiciel qui sont réservés à des utilisateurs avertis.
+
+Il relève de la responsabilité du Licencié de contrôler, par tous
+moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et
+de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens.
+
+9.2 Le Concédant déclare de bonne foi être en droit de concéder
+l'ensemble des droits attachés au Logiciel (comprenant notamment les
+droits visés à l'article 5).
+
+9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le
+Concédant sans autre garantie, expresse ou tacite, que celle prévue à
+l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale,
+son caractère sécurisé, innovant ou pertinent.
+
+En particulier, le Concédant ne garantit pas que le Logiciel est exempt
+d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible
+avec l'équipement du Licencié et sa configuration logicielle ni qu'il
+remplira les besoins du Licencié.
+
+9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le
+Logiciel ne porte pas atteinte à un quelconque droit de propriété
+intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout
+autre droit de propriété. Ainsi, le Concédant exclut toute garantie au
+profit du Licencié contre les actions en contrefaçon qui pourraient être
+diligentées au titre de l'utilisation, de la modification, et de la
+redistribution du Logiciel. Néanmoins, si de telles actions sont
+exercées contre le Licencié, le Concédant lui apportera son aide
+technique et juridique pour sa défense. Cette aide technique et
+juridique est déterminée au cas par cas entre le Concédant concerné et
+le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage
+toute responsabilité quant à l'utilisation de la dénomination du
+Logiciel par le Licencié. Aucune garantie n'est apportée quant à
+l'existence de droits antérieurs sur le nom du Logiciel et sur
+l'existence d'une marque.
+
+
+ Article 10 - RESILIATION
+
+10.1 En cas de manquement par le Licencié aux obligations mises à sa
+charge par le Contrat, le Concédant pourra résilier de plein droit le
+Contrat trente (30) jours après notification adressée au Licencié et
+restée sans effet.
+
+10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à
+utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les
+licences qu'il aura concédées antérieurement à la résiliation du Contrat
+resteront valides sous réserve qu'elles aient été effectuées en
+conformité avec le Contrat.
+
+
+ Article 11 - DISPOSITIONS DIVERSES
+
+
+ 11.1 CAUSE EXTERIEURE
+
+Aucune des Parties ne sera responsable d'un retard ou d'une défaillance
+d'exécution du Contrat qui serait dû à un cas de force majeure, un cas
+fortuit ou une cause extérieure, telle que, notamment, le mauvais
+fonctionnement ou les interruptions du réseau électrique ou de
+télécommunication, la paralysie du réseau liée à une attaque
+informatique, l'intervention des autorités gouvernementales, les
+catastrophes naturelles, les dégâts des eaux, les tremblements de terre,
+le feu, les explosions, les grèves et les conflits sociaux, l'état de
+guerre...
+
+11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou
+plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du
+Contrat, ne pourra en aucun cas impliquer renonciation par la Partie
+intéressée à s'en prévaloir ultérieurement.
+
+11.3 Le Contrat annule et remplace toute convention antérieure, écrite
+ou orale, entre les Parties sur le même objet et constitue l'accord
+entier entre les Parties sur cet objet. Aucune addition ou modification
+aux termes du Contrat n'aura d'effet à l'égard des Parties à moins
+d'être faite par écrit et signée par leurs représentants dûment habilités.
+
+11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat
+s'avèrerait contraire à une loi ou à un texte applicable, existants ou
+futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les
+amendements nécessaires pour se conformer à cette loi ou à ce texte.
+Toutes les autres dispositions resteront en vigueur. De même, la
+nullité, pour quelque raison que ce soit, d'une des dispositions du
+Contrat ne saurait entraîner la nullité de l'ensemble du Contrat.
+
+
+ 11.5 LANGUE
+
+Le Contrat est rédigé en langue française et en langue anglaise, ces
+deux versions faisant également foi.
+
+
+ Article 12 - NOUVELLES VERSIONS DU CONTRAT
+
+12.1 Toute personne est autorisée à copier et distribuer des copies de
+ce Contrat.
+
+12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé
+et ne peut être modifié que par les auteurs de la licence, lesquels se
+réservent le droit de publier périodiquement des mises à jour ou de
+nouvelles versions du Contrat, qui posséderont chacune un numéro
+distinct. Ces versions ultérieures seront susceptibles de prendre en
+compte de nouvelles problématiques rencontrées par les logiciels libres.
+
+12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra
+faire l'objet d'une diffusion ultérieure que sous la même version du
+Contrat ou une version postérieure.
+
+
+ Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE
+
+13.1 Le Contrat est régi par la loi française. Les Parties conviennent
+de tenter de régler à l'amiable les différends ou litiges qui
+viendraient à se produire par suite ou à l'occasion du Contrat.
+
+13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter
+de leur survenance et sauf situation relevant d'une procédure d'urgence,
+les différends ou litiges seront portés par la Partie la plus diligente
+devant les Tribunaux compétents de Paris.
+
+
+Version 1.0 du 2006-09-05.
+
Index: branches/semaphore/trunk/LICENSE.txt
===================================================================
--- branches/semaphore/trunk/LICENSE.txt (revision 115)
+++ branches/semaphore/trunk/LICENSE.txt (revision 115)
@@ -0,0 +1,561 @@
+
+UTC/CNRS Heudiasyc Flair framework is distributed under the CECILL-C
+License, Version 1.0.
+
+Copyright (c) UTC/CNRS Heudiasyc. All rights reserved.
+
+
+
+CeCILL-C FREE SOFTWARE LICENSE AGREEMENT
+
+
+ Notice
+
+This Agreement is a Free Software license agreement that is the result
+of discussions between its authors in order to ensure compliance with
+the two main principles guiding its drafting:
+
+ * firstly, compliance with the principles governing the distribution
+ of Free Software: access to source code, broad rights granted to
+ users,
+ * secondly, the election of a governing law, French law, with which
+ it is conformant, both as regards the law of torts and
+ intellectual property law, and the protection that it offers to
+ both authors and holders of the economic rights over software.
+
+The authors of the CeCILL-C (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
+license are:
+
+Commissariat à l'Energie Atomique - CEA, a public scientific, technical
+and industrial research establishment, having its principal place of
+business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
+
+Centre National de la Recherche Scientifique - CNRS, a public scientific
+and technological establishment, having its principal place of business
+at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, a public scientific and technological establishment, having its
+principal place of business at Domaine de Voluceau, Rocquencourt, BP
+105, 78153 Le Chesnay cedex, France.
+
+
+ Preamble
+
+The purpose of this Free Software license agreement is to grant users
+the right to modify and re-use the software governed by this license.
+
+The exercising of this right is conditional upon the obligation to make
+available to the community the modifications made to the source code of
+the software so as to contribute to its evolution.
+
+In consideration of access to the source code and the rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty and the software's author, the holder of the
+economic rights, and the successive licensors only have limited liability.
+
+In this respect, the risks associated with loading, using, modifying
+and/or developing or reproducing the software by the user are brought to
+the user's attention, given its Free Software status, which may make it
+complicated to use, with the result that its use is reserved for
+developers and experienced professionals having in-depth computer
+knowledge. Users are therefore encouraged to load and test the
+suitability of the software as regards their requirements in conditions
+enabling the security of their systems and/or data to be ensured and,
+more generally, to use and operate it in the same conditions of
+security. This Agreement may be freely reproduced and published,
+provided it is not altered, and that no provisions are either added or
+removed herefrom.
+
+This Agreement may apply to any or all software for which the holder of
+the economic rights decides to submit the use thereof to its provisions.
+
+
+ Article 1 - DEFINITIONS
+
+For the purpose of this Agreement, when the following expressions
+commence with a capital letter, they shall have the following meaning:
+
+Agreement: means this license agreement, and its possible subsequent
+versions and annexes.
+
+Software: means the software in its Object Code and/or Source Code form
+and, where applicable, its documentation, "as is" when the Licensee
+accepts the Agreement.
+
+Initial Software: means the Software in its Source Code and possibly its
+Object Code form and, where applicable, its documentation, "as is" when
+it is first distributed under the terms and conditions of the Agreement.
+
+Modified Software: means the Software modified by at least one
+Integrated Contribution.
+
+Source Code: means all the Software's instructions and program lines to
+which access is required so as to modify the Software.
+
+Object Code: means the binary files originating from the compilation of
+the Source Code.
+
+Holder: means the holder(s) of the economic rights over the Initial
+Software.
+
+Licensee: means the Software user(s) having accepted the Agreement.
+
+Contributor: means a Licensee having made at least one Integrated
+Contribution.
+
+Licensor: means the Holder, or any other individual or legal entity, who
+distributes the Software under the Agreement.
+
+Integrated Contribution: means any or all modifications, corrections,
+translations, adaptations and/or new functions integrated into the
+Source Code by any or all Contributors.
+
+Related Module: means a set of sources files including their
+documentation that, without modification to the Source Code, enables
+supplementary functions or services in addition to those offered by the
+Software.
+
+Derivative Software: means any combination of the Software, modified or
+not, and of a Related Module.
+
+Parties: mean both the Licensee and the Licensor.
+
+These expressions may be used both in singular and plural form.
+
+
+ Article 2 - PURPOSE
+
+The purpose of the Agreement is the grant by the Licensor to the
+Licensee of a non-exclusive, transferable and worldwide license for the
+Software as set forth in Article 5 hereinafter for the whole term of the
+protection granted by the rights over said Software.
+
+
+ Article 3 - ACCEPTANCE
+
+3.1 The Licensee shall be deemed as having accepted the terms and
+conditions of this Agreement upon the occurrence of the first of the
+following events:
+
+ * (i) loading the Software by any or all means, notably, by
+ downloading from a remote server, or by loading from a physical
+ medium;
+ * (ii) the first time the Licensee exercises any of the rights
+ granted hereunder.
+
+3.2 One copy of the Agreement, containing a notice relating to the
+characteristics of the Software, to the limited warranty, and to the
+fact that its use is restricted to experienced users has been provided
+to the Licensee prior to its acceptance as set forth in Article 3.1
+hereinabove, and the Licensee hereby acknowledges that it has read and
+understood it.
+
+
+ Article 4 - EFFECTIVE DATE AND TERM
+
+
+ 4.1 EFFECTIVE DATE
+
+The Agreement shall become effective on the date when it is accepted by
+the Licensee as set forth in Article 3.1.
+
+
+ 4.2 TERM
+
+The Agreement shall remain in force for the entire legal term of
+protection of the economic rights over the Software.
+
+
+ Article 5 - SCOPE OF RIGHTS GRANTED
+
+The Licensor hereby grants to the Licensee, who accepts, the following
+rights over the Software for any or all use, and for the term of the
+Agreement, on the basis of the terms and conditions set forth hereinafter.
+
+Besides, if the Licensor owns or comes to own one or more patents
+protecting all or part of the functions of the Software or of its
+components, the Licensor undertakes not to enforce the rights granted by
+these patents against successive Licensees using, exploiting or
+modifying the Software. If these patents are transferred, the Licensor
+undertakes to have the transferees subscribe to the obligations set
+forth in this paragraph.
+
+
+ 5.1 RIGHT OF USE
+
+The Licensee is authorized to use the Software, without any limitation
+as to its fields of application, with it being hereinafter specified
+that this comprises:
+
+ 1. permanent or temporary reproduction of all or part of the Software
+ by any or all means and in any or all form.
+
+ 2. loading, displaying, running, or storing the Software on any or
+ all medium.
+
+ 3. entitlement to observe, study or test its operation so as to
+ determine the ideas and principles behind any or all constituent
+ elements of said Software. This shall apply when the Licensee
+ carries out any or all loading, displaying, running, transmission
+ or storage operation as regards the Software, that it is entitled
+ to carry out hereunder.
+
+
+ 5.2 RIGHT OF MODIFICATION
+
+The right of modification includes the right to translate, adapt,
+arrange, or make any or all modifications to the Software, and the right
+to reproduce the resulting software. It includes, in particular, the
+right to create a Derivative Software.
+
+The Licensee is authorized to make any or all modification to the
+Software provided that it includes an explicit notice that it is the
+author of said modification and indicates the date of the creation thereof.
+
+
+ 5.3 RIGHT OF DISTRIBUTION
+
+In particular, the right of distribution includes the right to publish,
+transmit and communicate the Software to the general public on any or
+all medium, and by any or all means, and the right to market, either in
+consideration of a fee, or free of charge, one or more copies of the
+Software by any means.
+
+The Licensee is further authorized to distribute copies of the modified
+or unmodified Software to third parties according to the terms and
+conditions set forth hereinafter.
+
+
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
+
+The Licensee is authorized to distribute true copies of the Software in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Software is
+redistributed, the Licensee allows effective access to the full Source
+Code of the Software at a minimum during the entire period of its
+distribution of the Software, it being understood that the additional
+cost of acquiring the Source Code shall not exceed the cost of
+transferring the data.
+
+
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
+
+When the Licensee makes an Integrated Contribution to the Software, the
+terms and conditions for the distribution of the resulting Modified
+Software become subject to all the provisions of this Agreement.
+
+The Licensee is authorized to distribute the Modified Software, in
+source code or object code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the object code of the Modified
+Software is redistributed, the Licensee allows effective access to the
+full source code of the Modified Software at a minimum during the entire
+period of its distribution of the Modified Software, it being understood
+that the additional cost of acquiring the source code shall not exceed
+the cost of transferring the data.
+
+
+ 5.3.3 DISTRIBUTION OF DERIVATIVE SOFTWARE
+
+When the Licensee creates Derivative Software, this Derivative Software
+may be distributed under a license agreement other than this Agreement,
+subject to compliance with the requirement to include a notice
+concerning the rights over the Software as defined in Article 6.4.
+In the event the creation of the Derivative Software required modification
+of the Source Code, the Licensee undertakes that:
+
+ 1. the resulting Modified Software will be governed by this Agreement,
+ 2. the Integrated Contributions in the resulting Modified Software
+ will be clearly identified and documented,
+ 3. the Licensee will allow effective access to the source code of the
+ Modified Software, at a minimum during the entire period of
+ distribution of the Derivative Software, such that such
+ modifications may be carried over in a subsequent version of the
+ Software; it being understood that the additional cost of
+ purchasing the source code of the Modified Software shall not
+ exceed the cost of transferring the data.
+
+
+ 5.3.4 COMPATIBILITY WITH THE CeCILL LICENSE
+
+When a Modified Software contains an Integrated Contribution subject to
+the CeCILL license agreement, or when a Derivative Software contains a
+Related Module subject to the CeCILL license agreement, the provisions
+set forth in the third item of Article 6.4 are optional.
+
+
+ Article 6 - INTELLECTUAL PROPERTY
+
+
+ 6.1 OVER THE INITIAL SOFTWARE
+
+The Holder owns the economic rights over the Initial Software. Any or
+all use of the Initial Software is subject to compliance with the terms
+and conditions under which the Holder has elected to distribute its work
+and no one shall be entitled to modify the terms and conditions for the
+distribution of said Initial Software.
+
+The Holder undertakes that the Initial Software will remain ruled at
+least by this Agreement, for the duration set forth in Article 4.2.
+
+
+ 6.2 OVER THE INTEGRATED CONTRIBUTIONS
+
+The Licensee who develops an Integrated Contribution is the owner of the
+intellectual property rights over this Contribution as defined by
+applicable law.
+
+
+ 6.3 OVER THE RELATED MODULES
+
+The Licensee who develops a Related Module is the owner of the
+intellectual property rights over this Related Module as defined by
+applicable law and is free to choose the type of agreement that shall
+govern its distribution under the conditions defined in Article 5.3.3.
+
+
+ 6.4 NOTICE OF RIGHTS
+
+The Licensee expressly undertakes:
+
+ 1. not to remove, or modify, in any manner, the intellectual property
+ notices attached to the Software;
+
+ 2. to reproduce said notices, in an identical manner, in the copies
+ of the Software modified or not;
+
+ 3. to ensure that use of the Software, its intellectual property
+ notices and the fact that it is governed by the Agreement is
+ indicated in a text that is easily accessible, specifically from
+ the interface of any Derivative Software.
+
+The Licensee undertakes not to directly or indirectly infringe the
+intellectual property rights of the Holder and/or Contributors on the
+Software and to take, where applicable, vis-à-vis its staff, any and all
+measures required to ensure respect of said intellectual property rights
+of the Holder and/or Contributors.
+
+
+ Article 7 - RELATED SERVICES
+
+7.1 Under no circumstances shall the Agreement oblige the Licensor to
+provide technical assistance or maintenance services for the Software.
+
+However, the Licensor is entitled to offer this type of services. The
+terms and conditions of such technical assistance, and/or such
+maintenance, shall be set forth in a separate instrument. Only the
+Licensor offering said maintenance and/or technical assistance services
+shall incur liability therefor.
+
+7.2 Similarly, any Licensor is entitled to offer to its licensees, under
+its sole responsibility, a warranty, that shall only be binding upon
+itself, for the redistribution of the Software and/or the Modified
+Software, under terms and conditions that it is free to decide. Said
+warranty, and the financial terms and conditions of its application,
+shall be subject of a separate instrument executed between the Licensor
+and the Licensee.
+
+
+ Article 8 - LIABILITY
+
+8.1 Subject to the provisions of Article 8.2, the Licensee shall be
+entitled to claim compensation for any direct loss it may have suffered
+from the Software as a result of a fault on the part of the relevant
+Licensor, subject to providing evidence thereof.
+
+8.2 The Licensor's liability is limited to the commitments made under
+this Agreement and shall not be incurred as a result of in particular:
+(i) loss due the Licensee's total or partial failure to fulfill its
+obligations, (ii) direct or consequential loss that is suffered by the
+Licensee due to the use or performance of the Software, and (iii) more
+generally, any consequential loss. In particular the Parties expressly
+agree that any or all pecuniary or business loss (i.e. loss of data,
+loss of profits, operating loss, loss of customers or orders,
+opportunity cost, any disturbance to business activities) or any or all
+legal proceedings instituted against the Licensee by a third party,
+shall constitute consequential loss and shall not provide entitlement to
+any or all compensation from the Licensor.
+
+
+ Article 9 - WARRANTY
+
+9.1 The Licensee acknowledges that the scientific and technical
+state-of-the-art when the Software was distributed did not enable all
+possible uses to be tested and verified, nor for the presence of
+possible defects to be detected. In this respect, the Licensee's
+attention has been drawn to the risks associated with loading, using,
+modifying and/or developing and reproducing the Software which are
+reserved for experienced users.
+
+The Licensee shall be responsible for verifying, by any or all means,
+the suitability of the product for its requirements, its good working
+order, and for ensuring that it shall not cause damage to either persons
+or properties.
+
+9.2 The Licensor hereby represents, in good faith, that it is entitled
+to grant all the rights over the Software (including in particular the
+rights set forth in Article 5).
+
+9.3 The Licensee acknowledges that the Software is supplied "as is" by
+the Licensor without any other express or tacit warranty, other than
+that provided for in Article 9.2 and, in particular, without any warranty
+as to its commercial value, its secured, safe, innovative or relevant
+nature.
+
+Specifically, the Licensor does not warrant that the Software is free
+from any error, that it will operate without interruption, that it will
+be compatible with the Licensee's own equipment and software
+configuration, nor that it will meet the Licensee's requirements.
+
+9.4 The Licensor does not either expressly or tacitly warrant that the
+Software does not infringe any third party intellectual property right
+relating to a patent, software or any other property right. Therefore,
+the Licensor disclaims any and all liability towards the Licensee
+arising out of any or all proceedings for infringement that may be
+instituted in respect of the use, modification and redistribution of the
+Software. Nevertheless, should such proceedings be instituted against
+the Licensee, the Licensor shall provide it with technical and legal
+assistance for its defense. Such technical and legal assistance shall be
+decided on a case-by-case basis between the relevant Licensor and the
+Licensee pursuant to a memorandum of understanding. The Licensor
+disclaims any and all liability as regards the Licensee's use of the
+name of the Software. No warranty is given as regards the existence of
+prior rights over the name of the Software or as regards the existence
+of a trademark.
+
+
+ Article 10 - TERMINATION
+
+10.1 In the event of a breach by the Licensee of its obligations
+hereunder, the Licensor may automatically terminate this Agreement
+thirty (30) days after notice has been sent to the Licensee and has
+remained ineffective.
+
+10.2 A Licensee whose Agreement is terminated shall no longer be
+authorized to use, modify or distribute the Software. However, any
+licenses that it may have granted prior to termination of the Agreement
+shall remain valid subject to their having been granted in compliance
+with the terms and conditions hereof.
+
+
+ Article 11 - MISCELLANEOUS
+
+
+ 11.1 EXCUSABLE EVENTS
+
+Neither Party shall be liable for any or all delay, or failure to
+perform the Agreement, that may be attributable to an event of force
+majeure, an act of God or an outside cause, such as defective
+functioning or interruptions of the electricity or telecommunications
+networks, network paralysis following a virus attack, intervention by
+government authorities, natural disasters, water damage, earthquakes,
+fire, explosions, strikes and labor unrest, war, etc.
+
+11.2 Any failure by either Party, on one or more occasions, to invoke
+one or more of the provisions hereof, shall under no circumstances be
+interpreted as being a waiver by the interested Party of its right to
+invoke said provision(s) subsequently.
+
+11.3 The Agreement cancels and replaces any or all previous agreements,
+whether written or oral, between the Parties and having the same
+purpose, and constitutes the entirety of the agreement between said
+Parties concerning said purpose. No supplement or modification to the
+terms and conditions hereof shall be effective as between the Parties
+unless it is made in writing and signed by their duly authorized
+representatives.
+
+11.4 In the event that one or more of the provisions hereof were to
+conflict with a current or future applicable act or legislative text,
+said act or legislative text shall prevail, and the Parties shall make
+the necessary amendments so as to comply with said act or legislative
+text. All other provisions shall remain effective. Similarly, invalidity
+of a provision of the Agreement, for any reason whatsoever, shall not
+cause the Agreement as a whole to be invalid.
+
+
+ 11.5 LANGUAGE
+
+The Agreement is drafted in both French and English and both versions
+are deemed authentic.
+
+
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
+
+12.1 Any person is authorized to duplicate and distribute copies of this
+Agreement.
+
+12.2 So as to ensure coherence, the wording of this Agreement is
+protected and may only be modified by the authors of the License, who
+reserve the right to periodically publish updates or new versions of the
+Agreement, each with a separate number. These subsequent versions may
+address new issues encountered by Free Software.
+
+12.3 Any Software distributed under a given version of the Agreement may
+only be subsequently distributed under the same version of the Agreement
+or a subsequent version.
+
+
+ Article 13 - GOVERNING LAW AND JURISDICTION
+
+13.1 The Agreement is governed by French law. The Parties agree to
+endeavor to seek an amicable solution to any disagreements or disputes
+that may arise during the performance of the Agreement.
+
+13.2 Failing an amicable solution within two (2) months as from their
+occurrence, and unless emergency proceedings are necessary, the
+disagreements or disputes shall be referred to the Paris Courts having
+jurisdiction, by the more diligent Party.
+
+
+Version 1.0 dated 2006-09-05.
+
+
+LICENSE
+
+1. By using and/or opening any packaging enclosing this
+software, expanding any compressed file containing this
+software or by utilizing this software, you agree to be
+bound by the terms of this license agreement.
+
+2. THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. No oral or written advice given
+by Licensor or by an authorized representative of Licensor
+shall create a warranty.
+
+3. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL
+THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, INCLUDING BUT NOT LIMITED TO PERSONAL INJURY, OR
+ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
+WHATSOEVER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS
+OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER
+COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO
+YOUR USE OR INABILITY TO USE THE SOFTWARE, HOWEVER CAUSED,
+REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR
+OTHERWISE) AND EVEN IF LICENSOR HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+4. THIS SOFTWARE IS NOT INTENDED FOR USE IN ANY APPLICATION
+IN WHICH THE FAILURE OF THE SOFTWARE COULD LEAD TO DEATH,
+PERSONAL INJURY OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE.
+
+5. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
+WARRANTIES, LIABILITY OR LIMITATIONS ON APPLICABLE STATUTORY
+RIGHTS OF A CONSUMER, SO THE ABOVE EXCLUSIONS AND
+LIMITATIONS MAY NOT APPLY TO YOU. IF SUCH EXCLUSIONS FROM
+LIABILITY APPLY TO YOU, DO NOT USE THIS SOFTWARE.
Index: branches/semaphore/trunk/ReleaseNotes
===================================================================
--- branches/semaphore/trunk/ReleaseNotes (revision 115)
+++ branches/semaphore/trunk/ReleaseNotes (revision 115)
@@ -0,0 +1,15 @@
+* Actual Version:
+
+-----------------------------------------------------------
+* Tag 0.0.2:
+
+- src/SensorActuator: quaternion support for 3dmgx3
+- tool/FlairGCS: added rx rate display
+- demos/SimpleFleet: new demo, 2 UAVs coordination
+- src/FlairSimulator: added fixed camera
+
+-----------------------------------------------------------
+* Tag 0.0.1:
+
+-original commit
+
Index: branches/semaphore/trunk/Version
===================================================================
--- branches/semaphore/trunk/Version (revision 115)
+++ branches/semaphore/trunk/Version (revision 115)
@@ -0,0 +1,1 @@
+flair-src 0.0.2
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/CMakeLists.txt (revision 115)
@@ -0,0 +1,31 @@
+PROJECT(CircleFollower_simulator)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_SIMULATOR TRUE)
+SET(FLAIR_USE_SIMULATOR_GL TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_arm/bin/reglages.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_arm/bin/reglages.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_arm/bin/reglages.xml (revision 115)
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x4.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -a 127.0.0.1 -p 9000 -x setup_x4.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_i686/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -a 127.0.0.1 -p 9000 -x setup_x8.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x4.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -p 9000 -a 127.0.0.1 -x setup_x8.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: branches/semaphore/trunk/demos/CircleFollower/simulator/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/simulator/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/simulator/src/main.cpp (revision 115)
@@ -0,0 +1,133 @@
+// created: 2012/04/18
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 6599
+//
+// version: $Id: $
+//
+// purpose: main simulateur
+//
+//
+/*********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#ifdef GL
+#include
+#include
+#include
+#include
+#endif
+
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::simulator;
+using namespace flair::sensor;
+
+int port;
+int opti_time;
+string xml_file;
+string media_path;
+string scene_file;
+string type;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv) {
+ try {
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg xmlArg("x","xml","xml file",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg portArg("p","port","ground station port",true,9002,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","ground station address",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg typeArg("t","type","uav type, x4 or x8",true,"x4","string");
+ cmd.add( typeArg );
+
+ ValueArg optiArg("o","opti","optitrack time ms",false,0,"int");
+ cmd.add( optiArg );
+
+#ifdef GL
+ ValueArg mediaArg("m","media","path to media files",true,"./","string");
+ cmd.add( mediaArg );
+
+ ValueArg sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
+ cmd.add( sceneArg );
+#endif
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ port=portArg.getValue();
+ xml_file = xmlArg.getValue();
+ opti_time = optiArg.getValue();
+ type = typeArg.getValue();
+ name=nameArg.getValue();
+ address=addressArg.getValue();
+#ifdef GL
+ media_path=mediaArg.getValue();
+ scene_file=sceneArg.getValue();
+#endif
+
+ } catch (ArgException &e) {
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
+
+int main(int argc, char* argv[]) {
+ Simulator *simu;
+ Model *drone;
+ SimuImu* imu;
+#ifdef GL
+ SimuUsGL* us_gl;
+
+ Camera *cam_av,*cam_bas;
+ Parser *gui;
+ Man *man;
+#endif
+ parseOptions(argc,argv);
+
+ simu= new Simulator("simulator",opti_time,90);
+ simu->SetupConnection(address,port);
+ simu->SetupUserInterface(xml_file);
+
+#ifdef GL
+ gui=new Parser(simu,960,480,640,480,media_path,scene_file);
+#endif
+
+ if(type=="x4") {
+ drone=new X4(simu,name,0);
+ } else {
+ drone=new X8(simu,name,0);
+ }
+
+ imu=new SimuImu(drone,"imu",0);
+
+#ifdef GL
+ us_gl=new SimuUsGL(drone,"us",0);
+ cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);
+ cam_av=new SimuCameraGL(drone,"front camera",320,240,640,240,1);
+
+ man=new Man(simu,"target");
+#endif
+
+ simu->RunSimu();
+
+ delete simu;
+
+ return 0;
+}
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/CMakeLists.txt (revision 115)
@@ -0,0 +1,34 @@
+PROJECT(CircleFollower)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/CircleFollower.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.sh (revision 115)
@@ -0,0 +1,1 @@
+./CircleFollower_nrt -a 192.168.147.193 -p 9000 -l /tmp -x CircleFollower_ardrone2.xml -n Drone_0 -t ardrone2
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_ardrone2.xml (revision 115)
@@ -0,0 +1,357 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.sh (revision 115)
@@ -0,0 +1,1 @@
+./CircleFollower_rt -a 192.168.6.121 -p 9000 -l /tmp -x CircleFollower_hdsx8.xml -n x8_0 -t hds_x8
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_arm/bin/CircleFollower_hdsx8.xml (revision 115)
@@ -0,0 +1,478 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x4.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x4.xml -t x4_simu
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x8.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_i686/bin/x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x8.xml -t x8_simu
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x4.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x4.xml -t x4_simu
Index: branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x8.sh
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/build_x86_64/bin/x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu
Index: branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.cpp (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.cpp (revision 115)
@@ -0,0 +1,269 @@
+// created: 2011/05/01
+// filename: CircleFollower.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo cercle avec optitrack
+//
+//
+/*********************************************************************/
+
+#include "CircleFollower.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::sensor;
+using namespace flair::filter;
+using namespace flair::meta;
+
+CircleFollower::CircleFollower(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
+ uav->SetupVRPNAutoIP(uav->ObjectName());
+
+ startCircle=new PushButton(GetButtonsLayout()->NewRow(),"start_circle");
+ stopCircle=new PushButton(GetButtonsLayout()->LastRowLastCol(),"stop_circle");
+
+ if(uav->GetVrpnClient()->UseXbee()==true) {
+ targetVrpn=new MetaVrpnObject(uav->GetVrpnClient(),"target",1);
+ } else {
+ targetVrpn=new MetaVrpnObject(uav->GetVrpnClient(),"target");
+ }
+
+ getFrameworkManager()->AddDeviceToLog(targetVrpn);
+
+ circle=new TrajectoryGenerator2DCircle(uav->GetVrpnClient()->GetLayout()->NewRow(),"circle");
+ uav->GetVrpnObject()->xPlot()->AddCurve(circle->Matrix()->Element(0,0),DataPlot::Blue);
+ uav->GetVrpnObject()->yPlot()->AddCurve(circle->Matrix()->Element(0,1),DataPlot::Blue);
+ uav->GetVrpnObject()->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),DataPlot::Blue);
+ uav->GetVrpnObject()->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),DataPlot::Blue);
+ uav->GetVrpnObject()->XyPlot()->AddCurve(circle->Matrix()->Element(0,1),circle->Matrix()->Element(0,0),DataPlot::Blue,"circle");
+
+ uX=new Pid(setupLawTab->At(1,0),"u_x");
+ uX->UseDefaultPlot(graphLawTab->NewRow());
+ uY=new Pid(setupLawTab->At(1,1),"u_y");
+ uY->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+ customReferenceOrientation= new AhrsData(this,"reference");
+ uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+ AddDataToControlLawLog(customReferenceOrientation);
+
+ customOrientation=new AhrsData(this,"orientation");
+}
+
+CircleFollower::~CircleFollower() {
+}
+
+const AhrsData *CircleFollower::GetOrientation(void) const {
+ //get yaw from vrpn
+ Euler vrpnEuler;
+ GetUav()->GetVrpnObject()->GetEuler(vrpnEuler);
+
+ //get roll, pitch and w from imu
+ Quaternion ahrsQuaternion;
+ Vector3D ahrsAngularSpeed;
+ GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed);
+
+ Euler ahrsEuler=ahrsQuaternion.ToEuler();
+ ahrsEuler.yaw=vrpnEuler.yaw;
+ Quaternion mixQuaternion=ahrsEuler.ToQuaternion();
+
+ customOrientation->SetQuaternionAndAngularRates(mixQuaternion,ahrsAngularSpeed);
+
+ return customOrientation;
+}
+
+void CircleFollower::AltitudeValues(float &z,float &dz) {
+ Vector3D uav_pos,uav_vel;
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+ //z and dz must be in uav's frame
+ z=-uav_pos.z;
+ dz=-uav_vel.z;
+}
+
+AhrsData *CircleFollower::GetReferenceOrientation(void) {
+ Vector2D pos_err, vel_err; // in Uav coordinate system
+ float yaw_ref;
+ Euler refAngles;
+
+ PositionValues(pos_err, vel_err, yaw_ref);
+
+ refAngles.yaw=yaw_ref;
+
+ uX->SetValues(pos_err.x, vel_err.x);
+ uX->Update(GetTime());
+ refAngles.pitch=uX->Output();
+
+ uY->SetValues(pos_err.y, vel_err.y);
+ uY->Update(GetTime());
+ refAngles.roll=-uY->Output();
+
+ customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
+
+ return customReferenceOrientation;
+}
+
+void CircleFollower::PositionValues(Vector2D &pos_error,Vector2D &vel_error,float &yaw_ref) {
+ Vector3D uav_pos,uav_vel; // in VRPN coordinate system
+ Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+
+ uav_pos.To2Dxy(uav_2Dpos);
+ uav_vel.To2Dxy(uav_2Dvel);
+
+ if (behaviourMode==BehaviourMode_t::PositionHold) {
+ pos_error=uav_2Dpos-posHold;
+ vel_error=uav_2Dvel;
+ yaw_ref=yawHold;
+ } else { //Circle
+ Vector3D target_pos;
+ Vector2D circle_pos,circle_vel;
+ Vector2D target_2Dpos;
+
+ targetVrpn->GetPosition(target_pos);
+ target_pos.To2Dxy(target_2Dpos);
+ circle->SetCenter(target_2Dpos);
+
+ //circle reference
+ circle->Update(GetTime());
+ circle->GetPosition(circle_pos);
+ circle->GetSpeed(circle_vel);
+
+ //error in optitrack frame
+ pos_error=uav_2Dpos-circle_pos;
+ vel_error=uav_2Dvel-circle_vel;
+ yaw_ref=atan2(target_pos.y-uav_pos.y,target_pos.x-uav_pos.x);
+ }
+
+ //error in uav frame
+ Quaternion currentQuaternion=GetCurrentQuaternion();
+ Euler currentAngles;//in vrpn frame
+ currentQuaternion.ToEuler(currentAngles);
+ pos_error.Rotate(-currentAngles.yaw);
+ vel_error.Rotate(-currentAngles.yaw);
+}
+
+void CircleFollower::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+ switch(event) {
+ case Event_t::TakingOff:
+ behaviourMode=BehaviourMode_t::Default;
+ vrpnLost=false;
+ break;
+ case Event_t::EnteringControlLoop:
+ if ((behaviourMode==BehaviourMode_t::Circle) && (!circle->IsRunning())) {
+ VrpnPositionHold();
+ }
+ break;
+ case Event_t::EnteringFailSafeMode:
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ }
+}
+
+void CircleFollower::ExtraSecurityCheck(void) {
+ if ((!vrpnLost) && ((behaviourMode==BehaviourMode_t::Circle) || (behaviourMode==BehaviourMode_t::PositionHold))) {
+ if (!targetVrpn->IsTracked(500)) {
+ Thread::Err("VRPN, target lost\n");
+ vrpnLost=true;
+ EnterFailSafeMode();
+ Land();
+ }
+ if (!GetUav()->GetVrpnObject()->IsTracked(500)) {
+ Thread::Err("VRPN, uav lost\n");
+ vrpnLost=true;
+ EnterFailSafeMode();
+ Land();
+ }
+ }
+}
+
+void CircleFollower::ExtraCheckPushButton(void) {
+ if(startCircle->Clicked() && (behaviourMode!=BehaviourMode_t::Circle)) {
+ StartCircle();
+ }
+ if(stopCircle->Clicked() && (behaviourMode==BehaviourMode_t::Circle)) {
+ StopCircle();
+ }
+}
+
+void CircleFollower::ExtraCheckJoystick(void) {
+ //R1 and Circle
+ if(GetJoystick()->IsButtonPressed(9) && GetJoystick()->IsButtonPressed(4) && (behaviourMode!=BehaviourMode_t::Circle)) {
+ StartCircle();
+ }
+
+ //R1 and Cross
+ if(GetJoystick()->IsButtonPressed(9) && GetJoystick()->IsButtonPressed(5) && (behaviourMode==BehaviourMode_t::Circle)) {
+ StopCircle();
+ }
+}
+
+void CircleFollower::StartCircle(void) {
+ if (SetOrientationMode(OrientationMode_t::Custom)) {
+ Thread::Info("CircleFollower: start circle\n");
+ } else {
+ Thread::Warn("CircleFollower: could not start circle\n");
+ return;
+ }
+ Vector3D uav_pos,target_pos;
+ Vector2D uav_2Dpos,target_2Dpos;
+
+ targetVrpn->GetPosition(target_pos);
+ target_pos.To2Dxy(target_2Dpos);
+ circle->SetCenter(target_2Dpos);
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ uav_pos.To2Dxy(uav_2Dpos);
+ circle->StartTraj(uav_2Dpos);
+
+ uX->Reset();
+ uY->Reset();
+ behaviourMode=BehaviourMode_t::Circle;
+}
+
+void CircleFollower::StopCircle(void) {
+ circle->FinishTraj();
+ //GetJoystick()->Rumble(0x70);
+ Thread::Info("CircleFollower: finishing circle\n");
+}
+
+void CircleFollower::VrpnPositionHold(void) {
+ Euler vrpn_euler;
+ Vector3D vrpn_pos;
+
+ GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+ yawHold=vrpn_euler.yaw;
+
+ GetUav()->GetVrpnObject()->GetPosition(vrpn_pos);
+ vrpn_pos.To2Dxy(posHold);
+
+ uX->Reset();
+ uY->Reset();
+ behaviourMode=BehaviourMode_t::PositionHold;
+ SetOrientationMode(OrientationMode_t::Custom);
+ Thread::Info("CircleFollower: holding position\n");
+}
Index: branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.h
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.h (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/src/CircleFollower.h (revision 115)
@@ -0,0 +1,72 @@
+// created: 2011/05/01
+// filename: CircleFollower.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo cercle avec optitrack
+//
+//
+/*********************************************************************/
+
+#ifndef CIRCLEFOLLOWER_H
+#define CIRCLEFOLLOWER_H
+
+#include
+
+namespace flair {
+ namespace gui {
+ class PushButton;
+ }
+ namespace filter {
+ class TrajectoryGenerator2DCircle;
+ }
+ namespace meta {
+ class MetaVrpnObject;
+ }
+ namespace sensor {
+ class TargetController;
+ }
+}
+
+class CircleFollower : public flair::meta::UavStateMachine {
+ public:
+ CircleFollower(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+ ~CircleFollower();
+
+ private:
+ enum class BehaviourMode_t {
+ Default,
+ PositionHold,
+ Circle
+ };
+
+ BehaviourMode_t behaviourMode;
+ bool vrpnLost;
+
+ void VrpnPositionHold(void);//flight mode
+ void StartCircle(void);
+ void StopCircle(void);
+ void ExtraSecurityCheck(void);
+ void ExtraCheckPushButton(void);
+ void ExtraCheckJoystick(void);
+ const flair::core::AhrsData *GetOrientation(void) const;
+ void AltitudeValues(float &z,float &dz);
+ void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
+ flair::core::AhrsData *GetReferenceOrientation(void);
+ void SignalEvent(Event_t event);
+
+ flair::filter::Pid *uX, *uY;
+
+ flair::core::Vector2D posHold;
+ float yawHold;
+
+ flair::gui::PushButton *startCircle,*stopCircle;
+ flair::meta::MetaVrpnObject *targetVrpn;
+ flair::filter::TrajectoryGenerator2DCircle *circle;
+ flair::core::AhrsData *customReferenceOrientation,*customOrientation;
+};
+
+#endif // CIRCLEFOLLOWER_H
Index: branches/semaphore/trunk/demos/CircleFollower/uav/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/CircleFollower/uav/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/CircleFollower/uav/src/main.cpp (revision 115)
@@ -0,0 +1,97 @@
+// created: 2011/05/01
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: exemple de code uav
+//
+//
+/*********************************************************************/
+
+#include "CircleFollower.h"
+#include
+#include
+#include
+#include
+#include
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+
+int main(int argc, char* argv[]) {
+ parseOptions(argc,argv);
+
+ FrameworkManager *manager;
+ manager= new FrameworkManager(name);
+ manager->SetupConnection(address,port);
+ manager->SetupUserInterface(xml_file);
+ manager->SetupLogger(log_path);
+
+ Uav* drone=CreateUav(manager,name,uav_type);
+ TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
+ CircleFollower* demo=new CircleFollower(drone,controller);
+
+ demo->Start();
+ demo->Join();
+
+ delete manager;
+}
+
+void parseOptions(int argc, char** argv) {
+ try {
+
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, x4_simu, x8_simu or x4_simux (with x the number of the simulated uav)",true,"hds_x4","string");
+ cmd.add( typeArg );
+
+ ValueArg xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+ cmd.add( logsArg );
+
+ ValueArg portArg("p","port","port pour station sol",true,9000,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","addresse station sol",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+ cmd.add( ds3portArg );
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ log_path = logsArg.getValue();
+ port=portArg.getValue();
+ ds3port=ds3portArg.getValue();
+ xml_file = xmlArg.getValue();
+ name=nameArg.getValue();
+ uav_type=typeArg.getValue();
+ address=addressArg.getValue();
+
+ } catch (ArgException &e) { // catch any exceptions
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/Gps/simulator/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/CMakeLists.txt (revision 115)
@@ -0,0 +1,32 @@
+PROJECT(Gps_simulator)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_SIMULATOR TRUE)
+SET(FLAIR_USE_SIMULATOR_GL TRUE)
+SET(FLAIR_USE_GPS TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/Gps/simulator/build
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/Gps/simulator/build_arm/bin/reglages.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_arm/bin/reglages.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_arm/bin/reglages.xml (revision 115)
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x4.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -a 127.0.0.1 -p 9000 -x setup_x4.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_i686/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -a 127.0.0.1 -p 9000 -x setup_x8.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x4.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./Gps_simulator_rt
+else
+ EXEC=./Gps_simulator_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -p 9000 -a 127.0.0.1 -x setup_x4.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_simulator_rt
+else
+ EXEC=./CircleFollower_simulator_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -p 9000 -a 127.0.0.1 -x setup_x8.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: branches/semaphore/trunk/demos/Gps/simulator/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/Gps/simulator/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Gps/simulator/src/main.cpp (revision 115)
@@ -0,0 +1,136 @@
+// created: 2012/04/18
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 6599
+//
+// version: $Id: $
+//
+// purpose: main simulateur
+//
+//
+/*********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#ifdef GL
+#include
+#include
+#include
+#include
+#endif
+
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::simulator;
+using namespace flair::sensor;
+
+int port;
+int opti_time;
+string xml_file;
+string media_path;
+string scene_file;
+string type;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv) {
+ try {
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg xmlArg("x","xml","xml file",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg portArg("p","port","ground station port",true,9002,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","ground station address",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg typeArg("t","type","uav type, x4 or x8",true,"x4","string");
+ cmd.add( typeArg );
+
+ ValueArg optiArg("o","opti","optitrack time ms",false,0,"int");
+ cmd.add( optiArg );
+
+#ifdef GL
+ ValueArg mediaArg("m","media","path to media files",true,"./","string");
+ cmd.add( mediaArg );
+
+ ValueArg sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
+ cmd.add( sceneArg );
+#endif
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ port=portArg.getValue();
+ xml_file = xmlArg.getValue();
+ opti_time = optiArg.getValue();
+ type = typeArg.getValue();
+ name=nameArg.getValue();
+ address=addressArg.getValue();
+#ifdef GL
+ media_path=mediaArg.getValue();
+ scene_file=sceneArg.getValue();
+#endif
+
+ } catch (ArgException &e) {
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
+
+int main(int argc, char* argv[]) {
+ Simulator *simu;
+ Model *drone;
+ SimuImu *imu;
+ SimuGps *gps;
+#ifdef GL
+ SimuUsGL *us_gl;
+
+ Camera *cam_av,*cam_bas;
+ Parser *gui;
+ Man *man;
+#endif
+ parseOptions(argc,argv);
+
+ simu= new Simulator("simulator",opti_time,0);
+ simu->SetupConnection(address,port);
+ simu->SetupUserInterface(xml_file);
+
+#ifdef GL
+ gui=new Parser(simu,960,480,640,480,media_path,scene_file);
+#endif
+
+ if(type=="x4") {
+ drone=new X4(simu,name,0);
+ } else {
+ drone=new X8(simu,name,0);
+ }
+
+ imu=new SimuImu(drone,"imu",90);
+
+#ifdef GL
+ us_gl=new SimuUsGL(drone,"us",0);
+ cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);
+ cam_av=new SimuCameraGL(drone,"front camera",320,240,640,240,1);
+
+ man=new Man(simu,"target");
+#endif
+ gps=new SimuGps(drone,"gps",0);
+
+ simu->RunSimu();
+
+ delete simu;
+
+ return 0;
+}
+
Index: branches/semaphore/trunk/demos/Gps/uav/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/CMakeLists.txt (revision 115)
@@ -0,0 +1,36 @@
+PROJECT(DemoGps)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+SET(FLAIR_USE_GPS TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/DemoGps.cpp
+)
+
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/Gps/uav/build
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.sh (revision 115)
@@ -0,0 +1,1 @@
+./CircleFollower_nrt -a 192.168.147.193 -p 9000 -l /tmp -x CircleFollower_ardrone2.xml -n Drone_0 -t ardrone2
Index: branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_ardrone2.xml (revision 115)
@@ -0,0 +1,357 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.sh (revision 115)
@@ -0,0 +1,1 @@
+./CircleFollower_rt -a 192.168.6.121 -p 9000 -l /tmp -x CircleFollower_hdsx8.xml -n x8_0 -t hds_x8
Index: branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_arm/bin/CircleFollower_hdsx8.xml (revision 115)
@@ -0,0 +1,478 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x4.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x4.xml -t x4_simu
Index: branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x8.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_i686/bin/x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x8.xml -t x8_simu
Index: branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x4.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./DemoGps_rt
+else
+ EXEC=./DemoGps_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l /tmp -x setup_x4.xml -t x4_simu
Index: branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x8.sh
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/build_x86_64/bin/x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./CircleFollower_rt
+else
+ EXEC=./CircleFollower_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu
Index: branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.cpp
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.cpp (revision 115)
@@ -0,0 +1,219 @@
+// created: 2016/07/01
+// filename: DemoGps.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo GPS
+//
+//
+/*********************************************************************/
+
+#include "DemoGps.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::sensor;
+using namespace flair::filter;
+using namespace flair::meta;
+
+DemoGps::DemoGps(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
+
+ startCircle=new PushButton(GetButtonsLayout()->NewRow(),"start_circle");
+ stopCircle=new PushButton(GetButtonsLayout()->LastRowLastCol(),"stop_circle");
+
+ //RTDM_SerialPort *serialport=new RTDM_SerialPort(getFrameworkManager(),"gps_serial","rtser2");
+ //gps=new Mb800(getFrameworkManager(),"gps",serialport,(NmeaGps::NMEAFlags_t)(NmeaGps::GGA|NmeaGps::VTG),40);
+ gps=new SimuGps(getFrameworkManager(),"gps",(NmeaGps::NMEAFlags_t)(NmeaGps::GGA|NmeaGps::VTG),0,40);
+ gps->UseDefaultPlot();
+ getFrameworkManager()->AddDeviceToLog(gps);
+ //gps->Start();
+
+ circle=new TrajectoryGenerator2DCircle(gps->GetLayout()->NewRow(),"circle");
+ //todo: add graphs in gps plot
+ /*
+ uav->GetVrpnObject()->xPlot()->AddCurve(circle->Matrix()->Element(0,0),DataPlot::Blue);
+ uav->GetVrpnObject()->yPlot()->AddCurve(circle->Matrix()->Element(0,1),DataPlot::Blue);
+ uav->GetVrpnObject()->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),DataPlot::Blue);
+ uav->GetVrpnObject()->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),DataPlot::Blue);
+ uav->GetVrpnObject()->XyPlot()->AddCurve(circle->Matrix()->Element(0,1),circle->Matrix()->Element(0,0),DataPlot::Blue,"circle");*/
+
+ uX=new Pid(setupLawTab->At(1,0),"u_x");
+ uX->UseDefaultPlot(graphLawTab->NewRow());
+ uY=new Pid(setupLawTab->At(1,1),"u_y");
+ uY->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+ customReferenceOrientation= new AhrsData(this,"reference");
+ uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+ AddDataToControlLawLog(customReferenceOrientation);
+
+ customOrientation=new AhrsData(this,"orientation");
+}
+
+DemoGps::~DemoGps() {
+}
+
+AhrsData *DemoGps::GetReferenceOrientation(void) {
+ Vector2D pos_err, vel_err; // in Uav coordinate system
+ float yaw_ref;
+ Euler refAngles;
+
+ PositionValues(pos_err, vel_err, yaw_ref);
+
+ refAngles.yaw=yaw_ref;
+
+ uX->SetValues(pos_err.x, vel_err.x);
+ uX->Update(GetTime());
+ refAngles.pitch=uX->Output();
+
+ uY->SetValues(pos_err.y, vel_err.y);
+ uY->Update(GetTime());
+ refAngles.roll=-uY->Output();
+
+ customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
+
+ return customReferenceOrientation;
+}
+
+void DemoGps::PositionValues(Vector2D &pos_error,Vector2D &vel_error,float &yaw_ref) {
+ Vector3D uav_pos,uav_vel;
+ Vector2D uav_2Dpos,uav_2Dvel;
+
+//TODO GPS position and circle center
+ // GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ //GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+
+ uav_pos.To2Dxy(uav_2Dpos);
+ uav_vel.To2Dxy(uav_2Dvel);
+
+ if (behaviourMode==BehaviourMode_t::PositionHold) {
+ pos_error=uav_2Dpos-posHold;
+ vel_error=uav_2Dvel;
+ yaw_ref=yawHold;
+ } else { //Circle
+ Vector2D circle_pos,circle_vel;
+ Vector2D target_2Dpos;
+
+ circle->SetCenter(target_2Dpos);
+
+ //circle reference
+ circle->Update(GetTime());
+ circle->GetPosition(circle_pos);
+ circle->GetSpeed(circle_vel);
+
+ //error in optitrack frame
+ pos_error=uav_2Dpos-circle_pos;
+ vel_error=uav_2Dvel-circle_vel;
+ yaw_ref=atan2(target_2Dpos.y-uav_pos.y,target_2Dpos.x-uav_pos.x);
+ }
+
+ //error in uav frame
+ Quaternion currentQuaternion=GetCurrentQuaternion();
+ Euler currentAngles;//in vrpn frame
+ currentQuaternion.ToEuler(currentAngles);
+ pos_error.Rotate(-currentAngles.yaw);
+ vel_error.Rotate(-currentAngles.yaw);
+}
+
+void DemoGps::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+ switch(event) {
+ case Event_t::TakingOff:
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ case Event_t::EnteringControlLoop:
+ if ((behaviourMode==BehaviourMode_t::Circle) && (!circle->IsRunning())) {
+ GpsPositionHold();
+ }
+ break;
+ case Event_t::EnteringFailSafeMode:
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ }
+}
+
+void DemoGps::ExtraSecurityCheck(void) {
+
+}
+
+void DemoGps::ExtraCheckPushButton(void) {
+ if(startCircle->Clicked() && (behaviourMode!=BehaviourMode_t::Circle)) {
+ StartCircle();
+ }
+ if(stopCircle->Clicked() && (behaviourMode==BehaviourMode_t::Circle)) {
+ StopCircle();
+ }
+}
+
+void DemoGps::ExtraCheckJoystick(void) {
+ //R1 and Circle
+ if(GetJoystick()->IsButtonPressed(9) && GetJoystick()->IsButtonPressed(4) && (behaviourMode!=BehaviourMode_t::Circle)) {
+ StartCircle();
+ }
+
+ //R1 and Cross
+ if(GetJoystick()->IsButtonPressed(9) && GetJoystick()->IsButtonPressed(5) && (behaviourMode==BehaviourMode_t::Circle)) {
+ StopCircle();
+ }
+}
+
+void DemoGps::StartCircle(void) {
+ if (SetOrientationMode(OrientationMode_t::Custom)) {
+ Thread::Info("DemoGps: start circle\n");
+ } else {
+ Thread::Warn("DemoGps: could not start circle\n");
+ return;
+ }
+ Vector3D uav_pos;
+ Vector2D uav_2Dpos,target_2Dpos;
+
+ circle->SetCenter(target_2Dpos);
+
+ //todo get uav and circle pos by gps
+ uav_pos.To2Dxy(uav_2Dpos);
+ circle->StartTraj(uav_2Dpos);
+
+ uX->Reset();
+ uY->Reset();
+ behaviourMode=BehaviourMode_t::Circle;
+}
+
+void DemoGps::StopCircle(void) {
+ circle->FinishTraj();
+ //GetJoystick()->Rumble(0x70);
+ Thread::Info("DemoGps: finishing circle\n");
+}
+
+void DemoGps::GpsPositionHold(void) {
+
+
+//tood set yawHold and posHold
+
+
+ uX->Reset();
+ uY->Reset();
+ behaviourMode=BehaviourMode_t::PositionHold;
+ SetOrientationMode(OrientationMode_t::Custom);
+ Thread::Info("DemoGps: holding position\n");
+}
Index: branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.h
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.h (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/src/DemoGps.h (revision 115)
@@ -0,0 +1,69 @@
+// created: 2016/07/01
+// filename: DemoGps.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo GPS
+//
+//
+/*********************************************************************/
+
+#ifndef DEMOGPS_H
+#define DEMOGPS_H
+
+#include
+
+namespace flair {
+ namespace gui {
+ class PushButton;
+ }
+ namespace filter {
+ class TrajectoryGenerator2DCircle;
+ }
+ namespace sensor {
+ class TargetController;
+ class Mb800;
+ class SimuGps;
+ }
+}
+
+class DemoGps : public flair::meta::UavStateMachine {
+ public:
+ DemoGps(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+ ~DemoGps();
+
+ private:
+ enum class BehaviourMode_t {
+ Default,
+ PositionHold,
+ Circle
+ };
+
+ BehaviourMode_t behaviourMode;
+
+ void GpsPositionHold(void);
+ void StartCircle(void);
+ void StopCircle(void);
+ void ExtraSecurityCheck(void);
+ void ExtraCheckPushButton(void);
+ void ExtraCheckJoystick(void);
+ void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
+ flair::core::AhrsData *GetReferenceOrientation(void);
+ void SignalEvent(Event_t event);
+
+ flair::filter::Pid *uX, *uY;
+
+ flair::core::Vector2D posHold;
+ float yawHold;
+
+ flair::gui::PushButton *startCircle,*stopCircle;
+ flair::filter::TrajectoryGenerator2DCircle *circle;
+ flair::core::AhrsData *customReferenceOrientation,*customOrientation;
+ //flair::sensor::Mb800 *gps;
+ flair::sensor::SimuGps *gps;
+};
+
+#endif // DEMOGPS_H
Index: branches/semaphore/trunk/demos/Gps/uav/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/Gps/uav/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Gps/uav/src/main.cpp (revision 115)
@@ -0,0 +1,97 @@
+// created: 2011/05/01
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: exemple de code uav
+//
+//
+/*********************************************************************/
+
+#include "DemoGps.h"
+#include
+#include
+#include
+#include
+#include
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+
+int main(int argc, char* argv[]) {
+ parseOptions(argc,argv);
+
+ FrameworkManager *manager;
+ manager= new FrameworkManager(name);
+ manager->SetupConnection(address,port);
+ manager->SetupUserInterface(xml_file);
+ manager->SetupLogger(log_path);
+
+ Uav* drone=CreateUav(manager,name,uav_type);
+ TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
+ DemoGps* demo=new DemoGps(drone,controller);
+
+ demo->Start();
+ demo->Join();
+
+ delete manager;
+}
+
+void parseOptions(int argc, char** argv) {
+ try {
+
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, x4_simu, x8_simu or x4_simux (with x the number of the simulated uav)",true,"hds_x4","string");
+ cmd.add( typeArg );
+
+ ValueArg xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+ cmd.add( logsArg );
+
+ ValueArg portArg("p","port","port pour station sol",true,9000,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","addresse station sol",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+ cmd.add( ds3portArg );
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ log_path = logsArg.getValue();
+ port=portArg.getValue();
+ ds3port=ds3portArg.getValue();
+ xml_file = xmlArg.getValue();
+ name=nameArg.getValue();
+ uav_type=typeArg.getValue();
+ address=addressArg.getValue();
+
+ } catch (ArgException &e) { // catch any exceptions
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/HelloWorld/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/HelloWorld/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/HelloWorld/CMakeLists.txt (revision 115)
@@ -0,0 +1,14 @@
+PROJECT(HelloWorld)
+cmake_minimum_required(VERSION 2.8)
+
+ADD_EXECUTABLE(${PROJECT_NAME}
+ src/main.c
+)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+
+add_custom_target(
+ delivery
+ COMMAND make
+ COMMAND scp bin/${PROJECT_NAME} root@192.168.6.1:/home/root/
+)
Index: branches/semaphore/trunk/demos/HelloWorld/src/main.c
===================================================================
--- branches/semaphore/trunk/demos/HelloWorld/src/main.c (revision 115)
+++ branches/semaphore/trunk/demos/HelloWorld/src/main.c (revision 115)
@@ -0,0 +1,7 @@
+#include
+
+int main (int argc, char **argv) {
+ printf("Hello world !\n");
+ return 0;
+}
+
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/CMakeLists.txt (revision 115)
@@ -0,0 +1,31 @@
+PROJECT(simulator_pid)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_SIMULATOR TRUE)
+SET(FLAIR_USE_SIMULATOR_GL TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x4.sh
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $IGEP_ROOT/uav_dev/bin/noarch/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./simulator_pid_rt
+else
+ EXEC=./simulator_pid_nrt
+fi
+
+$EXEC -n x4_0 -t x4 -a 127.0.0.1 -p 9000 -x setup_x4.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $IGEP_ROOT/uav_dev/bin/noarch/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./simulator_pid_rt
+else
+ EXEC=./simulator_pid_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -a 127.0.0.1 -p 9000 -x setup_x8.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/PidStandalone/simulator/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/simulator/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/simulator/src/main.cpp (revision 115)
@@ -0,0 +1,134 @@
+// created: 2012/04/18
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 6599
+//
+// version: $Id: $
+//
+// purpose: main simulateur
+//
+//
+/*********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#ifdef GL
+#include
+#include
+#include
+#endif
+
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::simulator;
+using namespace flair::sensor;
+
+int port;
+int opti_time;
+string xml_file;
+string media_path;
+string scene_file;
+string type;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv)
+{
+ try
+ {
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg xmlArg("x","xml","xml file",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg portArg("p","port","ground station port",true,9002,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","ground station address",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg typeArg("t","type","uav type, x4 or x8",true,"x4","string");
+ cmd.add( typeArg );
+
+
+ ValueArg optiArg("o","opti","optitrack time ms",false,0,"int");
+ cmd.add( optiArg );
+
+#ifdef GL
+ ValueArg mediaArg("m","media","path to media files",true,"./","string");
+ cmd.add( mediaArg );
+
+ ValueArg sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
+ cmd.add( sceneArg );
+#endif
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ port=portArg.getValue();
+ xml_file = xmlArg.getValue();
+ opti_time = optiArg.getValue();
+ type = typeArg.getValue();
+ name=nameArg.getValue();
+ address=addressArg.getValue();
+#ifdef GL
+ media_path=mediaArg.getValue();
+ scene_file=sceneArg.getValue();
+#endif
+
+ } catch (ArgException &e) // catch any exceptions
+ { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+}
+
+
+int main(int argc, char* argv[])
+{
+ Simulator *simu;
+ Model *drone;
+ SimuImu* imu;
+#ifdef GL
+ SimuUsGL* us_gl;
+
+ SimuCameraGL *cam_bas;
+ Parser *gui;
+#endif
+ parseOptions(argc,argv);
+
+ simu= new Simulator("simulator",opti_time,90);
+ simu->SetupConnection(address,port);
+ simu->SetupUserInterface(xml_file);
+
+#ifdef GL
+ gui=new Parser(simu,960,480,640,480,media_path,scene_file);
+#endif
+
+ if(type=="x4")
+ {
+ drone=new X4(simu,name,0);
+ }
+ else
+ {
+ drone=new X8(simu,name,0);
+ }
+ imu=new SimuImu(drone,"imu",0);
+
+#ifdef GL
+ us_gl=new SimuUsGL(drone,"us",0);
+ cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);
+#endif
+
+ simu->RunSimu();
+
+ delete simu;
+
+ return 0;
+}
+
Index: branches/semaphore/trunk/demos/PidStandalone/uav/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/CMakeLists.txt (revision 115)
@@ -0,0 +1,34 @@
+PROJECT(demo_pid)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/PidUav.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/demo_pid_parrot.sh
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/demo_pid_parrot.sh (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/demo_pid_parrot.sh (revision 115)
@@ -0,0 +1,1 @@
+./demo_pid_nrt -a 192.168.147.192 -p 9000 -l /tmp -x reglages_parrot.xml -n Drone_0 -t ardrone2
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/reglages_parrot.xml
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/reglages_parrot.xml (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_arm/bin/reglages_parrot.xml (revision 115)
@@ -0,0 +1,267 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x4.xml
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x4.xml (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x4.xml (revision 115)
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x4.sh
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x4.sh (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x4.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $IGEP_ROOT/uav_dev/bin/noarch/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./demo_pid_rt
+else
+ EXEC=./demo_pid_nrt
+fi
+
+$EXEC -n x4_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x4.xml -t x4_simu $*
Index: branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x8.sh
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/build_x86_64/bin/x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $IGEP_ROOT/uav_dev/bin/noarch/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./demo_pid_rt
+else
+ EXEC=./demo_pid_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu
Index: branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.cpp
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.cpp (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.cpp (revision 115)
@@ -0,0 +1,131 @@
+// created: 2016/06/01
+// filename: PidUav.cpp
+//
+// author: Gildas Bayard
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: Uav class showing the incidence of pid parameters choice
+//
+//
+/*********************************************************************/
+
+#include "PidUav.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::sensor;
+using namespace flair::gui;
+using namespace flair::filter;
+using namespace flair::meta;
+
+/*
+** ===================================================================
+** constructor and destructor
+**
+** ===================================================================
+*/
+PidUav::PidUav(Uav *uav, TargetController *controller)
+ : behaviourMode(BehaviourMode_t::Default),
+ UavStateMachine(uav, controller) {
+ my_uRoll = new Pid(setupLawTab->At(1, 1), "custom uRoll");
+ my_uRoll->UseDefaultPlot(graphLawTab->LastRowLastCol());
+ my_uPitch = new Pid(setupLawTab->At(1, 0), "custom uPitch");
+ my_uPitch->UseDefaultPlot(graphLawTab->NewRow());
+}
+
+void PidUav::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+ switch (event) {
+ case Event_t::TakingOff:
+ // always take off in default mode
+ behaviourMode = BehaviourMode_t::Default;
+ break;
+ case Event_t::EnteringFailSafeMode:
+ // return to default mode
+ Thread::Info("Entering failSafe mode\n");
+ behaviourMode = BehaviourMode_t::Default;
+ break;
+ }
+}
+
+bool PidUav::StartCustomMode() {
+ // ask UavStateMachine to enter in custom torques
+ if (SetTorqueMode(TorqueMode_t::Custom)) {
+ Thread::Info("CustomTorques: start\n");
+ my_uPitch->Reset();
+ my_uRoll->Reset();
+ return true;
+ } else {
+ Thread::Warn("CustomTorques: could not start\n");
+ return false;
+ }
+}
+
+void PidUav::StartOscillatingMode() {
+ if (behaviourMode == BehaviourMode_t::Default) {
+ if (!StartCustomMode())
+ return;
+ }
+ behaviourMode = BehaviourMode_t::Oscillating;
+ Thread::Info("Entering oscillating mode\n");
+ // remove the 'D' effect with a strong 'P'
+}
+
+void PidUav::ExtraCheckJoystick(void) {
+ static bool wasOscillatingModeButtonPressed = false;
+ // controller button R1 enters optical flow mode
+ if (GetJoystick()->IsButtonPressed(9)) { // R1
+ if (!wasOscillatingModeButtonPressed) {
+ wasOscillatingModeButtonPressed = true;
+ if (behaviourMode != BehaviourMode_t::Oscillating)
+ StartOscillatingMode();
+ }
+ } else {
+ wasOscillatingModeButtonPressed = false;
+ }
+}
+
+void PidUav::ComputeCustomTorques(Euler &torques) {
+ ComputeDefaultTorques(torques);
+ // overload default torques calculation for pitch and roll
+ const AhrsData *refOrientation = GetDefaultReferenceOrientation();
+ Quaternion refQuaternion;
+ Vector3D refAngularRates;
+ refOrientation->GetQuaternionAndAngularRates(refQuaternion, refAngularRates);
+ Euler refAngles = refQuaternion.ToEuler();
+
+ const AhrsData *currentOrientation = GetDefaultOrientation();
+ Quaternion currentQuaternion;
+ Vector3D currentAngularRates;
+ currentOrientation->GetQuaternionAndAngularRates(currentQuaternion,
+ currentAngularRates);
+ Euler currentAngles = currentQuaternion.ToEuler();
+
+ my_uRoll->SetValues(currentAngles.roll - refAngles.roll,
+ currentAngularRates.x);
+ my_uRoll->Update(GetTime());
+ torques.roll = my_uRoll->Output();
+
+ my_uPitch->SetValues(currentAngles.pitch - refAngles.pitch,
+ currentAngularRates.y);
+ my_uPitch->Update(GetTime());
+ torques.pitch = my_uPitch->Output();
+}
+
+PidUav::~PidUav() {}
Index: branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.h
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.h (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/src/PidUav.h (revision 115)
@@ -0,0 +1,54 @@
+// created: 2016/06/01
+// filename: PidUav.h
+//
+// author: Gildas Bayard
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: Uav class showing the incidence of pid parameters choice
+//
+//
+/*********************************************************************/
+
+#ifndef PID_UAV_H
+#define PID_UAV_H
+
+#include
+
+namespace flair {
+ namespace core {
+ class cvmatrix;
+ }
+ namespace gui {
+ class GroupBox;
+ class DoubleSpinBox;
+ }
+ namespace filter {
+ class Pid;
+ }
+ namespace sensor {
+ class TargetController;
+ }
+}
+
+class PidUav : public flair::meta::UavStateMachine {
+public:
+ PidUav(flair::meta::Uav *uav,
+ flair::sensor::TargetController *controller);
+ ~PidUav();
+
+protected:
+ void SignalEvent(Event_t event);
+ void ExtraCheckJoystick(void);
+
+private:
+ void ComputeCustomTorques(flair::core::Euler &torques);
+ bool StartCustomMode();
+ void StartOscillatingMode();
+ flair::filter::Pid *my_uPitch, *my_uRoll;
+ enum class BehaviourMode_t { Default, Oscillating };
+ BehaviourMode_t behaviourMode;
+};
+
+#endif // PID_UAV_H
Index: branches/semaphore/trunk/demos/PidStandalone/uav/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/PidStandalone/uav/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/PidStandalone/uav/src/main.cpp (revision 115)
@@ -0,0 +1,121 @@
+// created: 2016/06/01
+// filename: main.cpp
+//
+// author: Gildas Bayard
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: exemple de code x4
+//
+//
+/*********************************************************************/
+
+#include "PidUav.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string dsp_file;
+string log_path;
+bool headless;
+int port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char **argv);
+
+int main(int argc, char *argv[]) {
+ parseOptions(argc, argv);
+
+ FrameworkManager *manager;
+ manager = new FrameworkManager(name);
+ if (!headless) {
+ manager->SetupConnection(address, port);
+ }
+ manager->SetupUserInterface(xml_file);
+ manager->SetupLogger(log_path);
+
+ Uav *drone = CreateUav(manager, name, uav_type);
+ TargetEthController *controller =
+ new TargetEthController(manager, "Dualshock3", 20000);
+ // EmulatedController *controller=new EmulatedController(manager,"Emulated
+ // Controller");
+ // controller->AddStep(10000,"Waiting for AHRS
+ // stabilization",0,0.,0.,0.,0.);
+ // controller->AddStep(500,"Takeoff",(uint16_t)EmulatedController::ButtonType::start,0.,0.,0.,0.);
+ // controller->AddStep(3000,"Waiting for flight
+ // stabilization",0,0.,0.,0.,0.);
+ /* controller->AddStep(2000,"fly left",0,-0.3,0.,0.,0.);
+ controller->AddStep(1000,"fly right",0,0.3,0.,0.,0.);*/
+ // controller->AddStep(500,"Land",(uint16_t)EmulatedController::ButtonType::start,0.,0.,0.,0.);
+ // controller->AddStep(3000,"Waiting for landing",0,0.,0.,0.,0.);
+ // controller->AddStep(500,"Stop",(uint16_t)EmulatedController::ButtonType::select,0.,0.,0.,0.);
+ PidUav *app = new PidUav(drone, controller);
+
+ app->Start();
+ app->Join();
+
+ delete manager;
+}
+
+void parseOptions(int argc, char **argv) {
+ try {
+
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n", "name", "uav name", true, "x4", "string");
+ cmd.add(nameArg);
+
+ ValueArg typeArg(
+ "t", "type", "uav type: ardrone2, hds_x4, hds_x8, hds_xufo, hds_simu "
+ "or hds_simux (with x the number of the simulated uav)",
+ true, "hds_x4", "string");
+ cmd.add(typeArg);
+
+ ValueArg xmlArg("x", "xml", "fichier xml", true, "./reglages.xml",
+ "string");
+ cmd.add(xmlArg);
+
+ ValueArg logsArg("l", "logs", "repertoire des logs", true,
+ "/media/ram", "string");
+ cmd.add(logsArg);
+
+ ValueArg portArg("p", "port", "port pour station sol", true, 9000,
+ "int");
+ cmd.add(portArg);
+
+ ValueArg addressArg("a", "address", "addresse station sol", true,
+ "127.0.0.1", "string");
+ cmd.add(addressArg);
+
+ SwitchArg headlessArg("e", "headless", "headless mode", false);
+ cmd.add(headlessArg);
+
+ cmd.parse(argc, argv);
+
+ // Get the value parsed by each arg.
+ uav_type = typeArg.getValue();
+ log_path = logsArg.getValue();
+ port = portArg.getValue();
+ xml_file = xmlArg.getValue();
+ name = nameArg.getValue();
+ address = addressArg.getValue();
+ headless = headlessArg.getValue();
+
+ } catch (ArgException &e) // catch any exceptions
+ {
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/CMakeLists.txt (revision 115)
@@ -0,0 +1,31 @@
+PROJECT(SimpleFleet_simulator)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_SIMULATOR TRUE)
+SET(FLAIR_USE_SIMULATOR_GL TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/build
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/build (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/build_i686/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./simulator_optitrack_rt
+else
+ EXEC=./simulator_optitrack_nrt
+fi
+
+$EXEC -n x8_0 -t x8 -p 9000 -x setup_x8.xml -o 10 -m $IGEP_ROOT/uav_dev/media -s $IGEP_ROOT/uav_dev/media/optitrack_b122.xml
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/simulator_x8.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/build_x86_64/bin/simulator_x8.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./SimpleFleet_simulator_rt
+else
+ EXEC=./SimpleFleet_simulator_nrt
+fi
+
+$EXEC -n x8 -a 127.0.0.1 -p 9000 -x setup_x8.xml -o 10 -m $FLAIR_ROOT/flair-bin/models -s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml
Index: branches/semaphore/trunk/demos/SimpleFleet/simulator/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/simulator/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/simulator/src/main.cpp (revision 115)
@@ -0,0 +1,113 @@
+// created: 2012/04/18
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 6599
+//
+// version: $Id: $
+//
+// purpose: main simulateur
+//
+//
+/*********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#ifdef GL
+#include
+#include
+#include
+#endif
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::simulator;
+using namespace flair::sensor;
+
+int port;
+int opti_time;
+string xml_file;
+string media_path;
+string scene_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv)
+{
+ try
+ {
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg xmlArg("x","xml","xml file",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg portArg("p","port","ground station port",true,9002,"int");
+ cmd.add( portArg );
+
+ ValueArg optiArg("o","opti","optitrack time ms",false,0,"int");
+ cmd.add( optiArg );
+#ifdef GL
+ ValueArg mediaArg("m","media","path to media files",true,"./","string");
+ cmd.add( mediaArg );
+
+ ValueArg sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
+ cmd.add( sceneArg );
+#endif
+ ValueArg addressArg("a","address","ground station address",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ port=portArg.getValue();
+ address=addressArg.getValue();
+ xml_file = xmlArg.getValue();
+ opti_time = optiArg.getValue();
+ name=nameArg.getValue();
+#ifdef GL
+ media_path=mediaArg.getValue();
+ scene_file=sceneArg.getValue();
+#endif
+
+
+ } catch (ArgException &e) // catch any exceptions
+ { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+}
+
+
+int main(int argc, char* argv[])
+{
+ Simulator *simu;
+
+ parseOptions(argc,argv);
+
+ simu= new Simulator("simulator",opti_time,90);
+ simu->SetupConnection(address,port);
+ simu->SetupUserInterface(xml_file);
+#ifdef GL
+ Parser *gui=new Parser(simu,640,480,640,480,media_path,scene_file);
+#endif
+ for(int i=0; i<2;i++)
+ {
+ stringstream s;
+ s << name.c_str() << "_" << i;
+ Model *drone=new X8(simu,s.str(),i);
+#ifdef GL
+ SimuUsGL *us_gl=new SimuUsGL(drone,"us",i);
+#endif
+ SimuImu *imu=new SimuImu(drone,"imu",i);
+ }
+
+ simu->RunSimu();
+
+ delete simu;
+
+ return 0;
+}
+
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/CMakeLists.txt (revision 115)
@@ -0,0 +1,34 @@
+PROJECT(SimpleFleet)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/SimpleFleet.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet.sh (revision 115)
@@ -0,0 +1,1 @@
+./SimpleFleet_nrt -a 192.168.147.193 -p 9000 -l /tmp -x SimpleFleet_ardrone2.xml -n Drone_0 -t ardrone2 -b 192.168.147.255
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet_ardrone2.xml
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet_ardrone2.xml (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_arm/bin/SimpleFleet_ardrone2.xml (revision 115)
@@ -0,0 +1,357 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_0.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_0.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_0.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./SimpleFleet_rt
+else
+ EXEC=./SimpleFleet_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu0 -b 127.255.255.255:20010
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_1.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_1.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_i686/bin/x8_1.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./SimpleFleet_rt
+else
+ EXEC=./SimpleFleet_nrt
+fi
+
+$EXEC -n x8_1 -a 127.0.0.1 -p 9001 -l ./ -x setup_x8.xml -t x8_simu1 -b 127.255.255.255:20010 -d 20020
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml (revision 115)
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_0.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_0.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_0.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./SimpleFleet_rt
+else
+ EXEC=./SimpleFleet_nrt
+fi
+
+$EXEC -n x8_0 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu0 -b 127.255.255.255:20010
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_1.sh
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_1.sh (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/build_x86_64/bin/x8_1.sh (revision 115)
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./SimpleFleet_rt
+else
+ EXEC=./SimpleFleet_nrt
+fi
+
+$EXEC -n x8_1 -a 127.0.0.1 -p 9000 -l ./ -x setup_x8.xml -t x8_simu1 -b 127.255.255.255:20010 -d 21000
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp (revision 115)
@@ -0,0 +1,357 @@
+// created: 2015/11/05
+// filename: SimpleFleet.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo fleet
+//
+//
+/*********************************************************************/
+
+#include "SimpleFleet.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define PI ((float)3.14159265358979323846)
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::sensor;
+using namespace flair::filter;
+using namespace flair::meta;
+
+
+SimpleFleet::SimpleFleet(flair::meta::Uav* uav,string broadcast,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
+ uav->SetupVRPNAutoIP(uav->ObjectName());
+
+ circle=new TrajectoryGenerator2DCircle(uav->GetVrpnClient()->GetLayout()->NewRow(),"circle");
+ uav->GetVrpnObject()->xPlot()->AddCurve(circle->Matrix()->Element(0,0),0,0,255);
+ uav->GetVrpnObject()->yPlot()->AddCurve(circle->Matrix()->Element(0,1),0,0,255);
+ uav->GetVrpnObject()->VxPlot()->AddCurve(circle->Matrix()->Element(1,0),0,0,255);
+ uav->GetVrpnObject()->VyPlot()->AddCurve(circle->Matrix()->Element(1,1),0,0,255);
+
+ xCircleCenter=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"x circle center"," m",-5,5,0.1,1,0);
+ yCircleCenter=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"y circle center"," m",-5,5,0.1,1,0);
+ yDisplacement=new DoubleSpinBox(uav->GetVrpnClient()->GetLayout()->NewRow(),"y displacement"," m",0,2,0.1,1,0);
+
+ //parent->AddDeviceToLog(Uz());
+
+ u_x=new Pid(setupLawTab->At(1,0),"u_x");
+ u_x->UseDefaultPlot(graphLawTab->NewRow());
+ u_y=new Pid(setupLawTab->At(1,1),"u_y");
+ u_y->UseDefaultPlot(graphLawTab->LastRowLastCol());
+
+ message=new Socket(uav,"Message",broadcast,true);
+
+ customReferenceOrientation= new AhrsData(this,"reference");
+ uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+ AddDataToControlLawLog(customReferenceOrientation);
+
+ customOrientation=new AhrsData(this,"orientation");
+/*
+ //check init conditions
+ Vector3D uav_pos;
+ Euler vrpn_euler;
+ GetVrpnObject()->GetPosition(uav_pos);
+ GetVrpnObject()->GetEuler(vrpn_euler);
+
+ if(name=="x8_0") {
+ //x8_0 should be on the left, with 0 yaw
+ if(uav_pos.y>yCircleCenter->Value() || vrpn_euler.yaw>20 || vrpn_euler.yaw<-20) Thread::Err("wrong init position\n");
+ }
+ if(name=="x8_1") {
+ //x8_1 should be on the right, with 180 yaw
+ if(uav_pos.yValue() || (vrpn_euler.yaw<160 && vrpn_euler.yaw>-160)) Thread::Err("wrong init position %f %f\n",yCircleCenter->Value(),vrpn_euler.yaw);
+ }
+ */
+}
+
+SimpleFleet::~SimpleFleet() {
+}
+
+const AhrsData *SimpleFleet::GetOrientation(void) const {
+ //get yaw from vrpn
+ Euler vrpnEuler;
+ GetUav()->GetVrpnObject()->GetEuler(vrpnEuler);
+
+ //get roll, pitch and w from imu
+ Quaternion ahrsQuaternion;
+ Vector3D ahrsAngularSpeed;
+ GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed);
+
+ Euler ahrsEuler=ahrsQuaternion.ToEuler();
+ ahrsEuler.yaw=vrpnEuler.yaw;
+ Quaternion mixQuaternion=ahrsEuler.ToQuaternion();
+
+ customOrientation->SetQuaternionAndAngularRates(mixQuaternion,ahrsAngularSpeed);
+
+ return customOrientation;
+}
+
+void SimpleFleet::AltitudeValues(float &z,float &dz) const {
+ Vector3D uav_pos,uav_vel;
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+ //z and dz must be in uav's frame
+ z=-uav_pos.z;
+ dz=-uav_vel.z;
+}
+
+const AhrsData *SimpleFleet::GetReferenceOrientation(void) {
+ Vector2D pos_err, vel_err; // in uav coordinate system
+ float yaw_ref;
+ Euler refAngles;
+
+ PositionValues(pos_err, vel_err, yaw_ref);
+
+ refAngles.yaw=yaw_ref;
+
+ u_x->SetValues(pos_err.x, vel_err.x);
+ u_x->Update(GetTime());
+ refAngles.pitch=u_x->Output();
+
+ u_y->SetValues(pos_err.y, vel_err.y);
+ u_y->Update(GetTime());
+ refAngles.roll=-u_y->Output();
+
+ customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
+
+ return customReferenceOrientation;
+}
+
+void SimpleFleet::PositionValues(Vector2D &pos_error,Vector2D &vel_error,float &yaw_ref) {
+ Vector3D uav_pos,uav_vel; // in VRPN coordinate system
+ Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
+ Euler vrpn_euler; // in VRPN coordinate system
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ GetUav()->GetVrpnObject()->GetSpeed(uav_vel);
+ GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+
+ uav_pos.To2Dxy(uav_2Dpos);
+ uav_vel.To2Dxy(uav_2Dvel);
+
+ if (behaviourMode==BehaviourMode_t::PositionHold1 || behaviourMode==BehaviourMode_t::PositionHold2
+ || behaviourMode==BehaviourMode_t::PositionHold3 || behaviourMode==BehaviourMode_t::PositionHold4) {
+ pos_error=uav_2Dpos-pos_hold;
+ vel_error=uav_2Dvel;
+ yaw_ref=yaw_hold;
+ } else { //Circle
+ Vector2D circle_pos,circle_vel;
+ Vector2D target_2Dpos;
+
+ //circle center
+ target_2Dpos.x=xCircleCenter->Value();
+ target_2Dpos.y=yCircleCenter->Value();
+ circle->SetCenter(target_2Dpos);
+
+ //circle reference
+ circle->Update(GetTime());
+ circle->GetPosition(circle_pos);
+ circle->GetSpeed(circle_vel);
+
+ //error in optitrack frame
+ pos_error=uav_2Dpos-circle_pos;
+ vel_error=uav_2Dvel-circle_vel;
+ yaw_ref=PI/2+atan2(uav_pos.y-target_2Dpos.y,uav_pos.x-target_2Dpos.x);
+ }
+ //error in uav frame
+ Quaternion currentQuaternion=GetCurrentQuaternion();
+ Euler currentAngles;//in vrpn frame
+ currentQuaternion.ToEuler(currentAngles);
+ pos_error.Rotate(-currentAngles.yaw);
+ vel_error.Rotate(-currentAngles.yaw);
+}
+
+void SimpleFleet::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+
+ switch(event) {
+ case Event_t::EmergencyStop:
+ message->SendMessage("EmergencyStop");
+ break;
+ case Event_t::TakingOff:
+ //behaviourMode=BehaviourMode_t::Default;
+ message->SendMessage("TakeOff");
+ VrpnPositionHold();
+ behaviourMode=BehaviourMode_t::PositionHold1;
+ break;
+ case Event_t::StartLanding:
+ VrpnPositionHold();
+ behaviourMode=BehaviourMode_t::PositionHold4;
+ message->SendMessage("Landing");
+ break;
+ case Event_t::EnteringControlLoop:
+ CheckMessages();
+ if ((behaviourMode==BehaviourMode_t::Circle1) && (!circle->IsRunning())) {
+ VrpnPositionHold();
+ behaviourMode=BehaviourMode_t::PositionHold2;
+ if(pos_hold.y<0) {
+ pos_hold.y-=yDisplacement->Value();
+ } else {
+ pos_hold.y+=yDisplacement->Value();
+ }
+ posWait=GetTime();
+ Printf("Circle1 -> PositionHold2\n");
+ }
+ if (behaviourMode==BehaviourMode_t::PositionHold2 && GetTime()>(posWait+3*(Time)1000000000)) {
+ behaviourMode=BehaviourMode_t::PositionHold3;
+ if(pos_hold.y<0) {
+ pos_hold.y+=yDisplacement->Value();
+ } else {
+ pos_hold.y-=yDisplacement->Value();
+ }
+ posWait=GetTime();
+ Printf("PositionHold2 -> PositionHold3\n");
+ }
+ if (behaviourMode==BehaviourMode_t::PositionHold3 && GetTime()>(posWait+3*(Time)1000000000)) {
+ behaviourMode=BehaviourMode_t::Circle2;
+ StartCircle();
+ Printf("PositionHold3 -> Circle2\n");
+ }
+ if ((behaviourMode==BehaviourMode_t::Circle2) && (!circle->IsRunning())) {
+ Printf("Circle2 -> Land\n");
+ behaviourMode=BehaviourMode_t::PositionHold4;
+ Land();
+ }
+
+ break;
+ case Event_t::EnteringFailSafeMode:
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ case Event_t::ZTrajectoryFinished:
+ Printf("PositionHold1 -> Circle1\n");
+ StartCircle();
+ behaviourMode=BehaviourMode_t::Circle1;
+ break;
+ }
+}
+
+void SimpleFleet::CheckMessages(void) {
+ char msg[64];
+ char src[64];
+ size_t src_size=sizeof(src);
+ while(message->RecvMessage(msg,sizeof(msg),TIME_NONBLOCK,src,&src_size)>0) {
+ //printf("%s %s\n",GetUav()->ObjectName().c_str(),src);
+ if(strcmp(src,GetUav()->ObjectName().c_str())!=0) {
+ /*
+ if(strcmp(msg,"StopMotors")==0 && orientation_state!=OrientationState_t::Stopped)
+ {
+ joy->FlashLed(DualShock3::led1,10,10);
+ joy->Rumble(0x70);
+ GetBldc()->SetEnabled(false);
+ GetUavMultiplex()->UnlockUserInterface();
+ altitude_state=AltitudeState_t::Stopped;
+ orientation_state=OrientationState_t::Stopped;
+ GetAhrs()->UnlockUserInterface();
+ }
+*/
+ if(strcmp(msg,"TakeOff")==0) {
+ Printf("TakeOff fleet\n");
+ TakeOff();
+ }
+ if(strcmp(msg,"Landing")==0) {
+ Printf("Landing fleet\n");
+ Land();
+ }
+ if(strcmp(msg,"EmergencyStop")==0) {
+ Printf("EmergencyStop fleet\n");
+ EmergencyStop();
+ }
+ }
+ }
+}
+
+void SimpleFleet::ExtraSecurityCheck(void) {
+ if (!vrpnLost && behaviourMode!=BehaviourMode_t::Default) {
+ if (!GetUav()->GetVrpnObject()->IsTracked(500)) {
+ Thread::Err("Optitrack, uav lost\n");
+ vrpnLost=true;
+ EnterFailSafeMode();
+ Land();
+ }
+ }
+}
+
+void SimpleFleet::ExtraCheckJoystick(void) {
+
+}
+
+void SimpleFleet::StartCircle(void) {
+ if (SetOrientationMode(OrientationMode_t::Custom)) {
+ Thread::Info("Demo flotte: start circle\n");
+ } else {
+ Thread::Warn("Demo flotte: could not start circle\n");
+ return;
+ }
+ Vector3D uav_pos;
+ Vector2D uav_2Dpos,target_2Dpos;
+
+ //circle center
+ target_2Dpos.x=xCircleCenter->Value();
+ target_2Dpos.y=yCircleCenter->Value();
+ circle->SetCenter(target_2Dpos);
+
+ GetUav()->GetVrpnObject()->GetPosition(uav_pos);
+ uav_pos.To2Dxy(uav_2Dpos);
+ circle->StartTraj(uav_2Dpos,1);
+
+ u_x->Reset();
+ u_y->Reset();
+}
+
+void SimpleFleet::StopCircle(void) {
+ circle->FinishTraj();
+ //joy->Rumble(0x70);
+ Thread::Info("Demo flotte: finishing circle\n");
+}
+
+void SimpleFleet::VrpnPositionHold(void) {
+ Euler vrpn_euler;
+ Vector3D vrpn_pos;
+
+ if (SetOrientationMode(OrientationMode_t::Custom)) {
+ Thread::Info("Demo flotte: holding position\n");
+ } else {
+ Thread::Info("Demo flotte: could not hold position\n");
+ //return;
+ }
+
+ GetUav()->GetVrpnObject()->GetEuler(vrpn_euler);
+ yaw_hold=vrpn_euler.yaw;
+
+ GetUav()->GetVrpnObject()->GetPosition(vrpn_pos);
+ vrpn_pos.To2Dxy(pos_hold);
+
+ u_x->Reset();
+ u_y->Reset();
+}
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.h
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.h (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/src/SimpleFleet.h (revision 115)
@@ -0,0 +1,79 @@
+// created: 2015/11/05
+// filename: SimpleFleet.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: demo fleet
+//
+//
+/*********************************************************************/
+
+#ifndef SIMPLEFLEET_H
+#define SIMPLEFLEET_H
+
+#include
+
+namespace flair {
+ namespace core {
+ class FrameworkManager;
+ class Socket;
+ class AhrsData;
+ }
+ namespace filter {
+ class TrajectoryGenerator2DCircle;
+ }
+ namespace gui {
+ class DoubleSpinBox;
+ }
+}
+
+
+class SimpleFleet : public flair::meta::UavStateMachine {
+ public:
+ SimpleFleet(flair::meta::Uav* uav,std::string broadcast,flair::sensor::TargetController *controller);
+ ~SimpleFleet();
+
+ private:
+ enum class BehaviourMode_t {
+ Default,
+ PositionHold1,
+ Circle1,
+ PositionHold2,
+ PositionHold3,
+ Circle2,
+ PositionHold4,
+ };
+
+// BehaviourMode_t orientation_state;
+ BehaviourMode_t behaviourMode;
+ bool vrpnLost;
+
+ void VrpnPositionHold(void);//flight mode
+ void StartCircle(void);
+ void StopCircle(void);
+ void ExtraTakeOff(void);
+ void ExtraSecurityCheck(void);
+ void ExtraCheckJoystick(void);
+ const flair::core::AhrsData *GetOrientation(void) const;
+ void AltitudeValues(float &z,float &dz) const;
+ void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
+ const flair::core::AhrsData *GetReferenceOrientation(void);
+ void SignalEvent(Event_t event);
+ void CheckMessages(void);
+
+ flair::filter::Pid *u_x, *u_y;
+
+ flair::core::Vector2D pos_hold;
+ float yaw_hold;
+ flair::core::Socket *message;
+ flair::core::Time posWait;
+
+ flair::filter::TrajectoryGenerator2DCircle *circle;
+ flair::gui::DoubleSpinBox *xCircleCenter,*yCircleCenter,*yDisplacement;
+ flair::core::AhrsData *customReferenceOrientation,*customOrientation;
+};
+
+#endif // SIMPLEFLEET_H
Index: branches/semaphore/trunk/demos/SimpleFleet/uav/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/SimpleFleet/uav/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/SimpleFleet/uav/src/main.cpp (revision 115)
@@ -0,0 +1,103 @@
+// created: 2011/05/01
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: exemple de code uav
+//
+//
+/*********************************************************************/
+
+#include "SimpleFleet.h"
+#include
+#include
+#include
+#include
+#include
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string broadcast;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+
+int main(int argc, char* argv[]) {
+ parseOptions(argc,argv);
+
+ FrameworkManager *manager;
+ manager= new FrameworkManager(name);
+ manager->SetupLogger(log_path);
+ manager->SetupConnection(address,port);
+ manager->SetupUserInterface(xml_file);
+
+ Uav* drone=CreateUav(manager,name,uav_type);
+ TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
+ SimpleFleet* demo=new SimpleFleet(drone,broadcast,controller);
+
+ demo->Start();
+ demo->Join();
+
+ delete manager;
+}
+
+
+void parseOptions(int argc, char** argv) {
+ try {
+
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, x4_simu, x8_simu or x4_simux (with x the number of the simulated uav)",true,"hds_x4","string");
+ cmd.add( typeArg );
+
+ ValueArg xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+ cmd.add( logsArg );
+
+ ValueArg portArg("p","port","port pour station sol",true,9000,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","addresse station sol",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+ cmd.add( ds3portArg );
+
+ ValueArg broadcastArg("b","broadcast","broadcast ip address and port,",true,"127.255.255.255:20001","string");
+ cmd.add( broadcastArg );
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ log_path = logsArg.getValue();
+ port=portArg.getValue();
+ ds3port=ds3portArg.getValue();
+ xml_file = xmlArg.getValue();
+ name=nameArg.getValue();
+ broadcast=broadcastArg.getValue();
+ uav_type=typeArg.getValue();
+ address=addressArg.getValue();
+
+ } catch (ArgException &e) { // catch any exceptions
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/Sinus/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/Sinus/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/CMakeLists.txt (revision 115)
@@ -0,0 +1,37 @@
+PROJECT(Sinus)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/Loop.cpp
+ ${CMAKE_SOURCE_DIR}/src/Sinus.cpp
+ ${CMAKE_SOURCE_DIR}/src/MeanFilter.cpp
+)
+
+LINK_DIRECTORIES (
+ ${FLAIR_LIBRARY_DIR}
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/Sinus/build
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build (revision 115)
@@ -0,0 +1,1 @@
+link build_x86_64
Index: branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.sh
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.sh (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.sh (revision 115)
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./Sinus_rt
+else
+ EXEC=./Sinus_nrt
+fi
+
+$EXEC -a ${1}
+
Index: branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.xml
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.xml (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_arm/bin/Sinus.xml (revision 115)
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.sh
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.sh (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.sh (revision 115)
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./Sinus_rt
+else
+ EXEC=./Sinus_nrt
+fi
+
+$EXEC
+
Index: branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.xml
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.xml (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_i686/bin/Sinus.xml (revision 115)
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.sh
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.sh (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.sh (revision 115)
@@ -0,0 +1,12 @@
+#! /bin/bash
+
+. $FLAIR_ROOT/flair-dev/scripts/ubuntu_cgroup_hack.sh
+
+if [ -f /proc/xenomai/version ];then
+ EXEC=./Sinus_rt
+else
+ EXEC=./Sinus_nrt
+fi
+
+$EXEC
+
Index: branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.xml
===================================================================
--- branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.xml (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/build_x86_64/bin/Sinus.xml (revision 115)
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: branches/semaphore/trunk/demos/Sinus/src/Loop.cpp
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/Loop.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/Loop.cpp (revision 115)
@@ -0,0 +1,112 @@
+// created: 2013/06/26
+// filename: Loop.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+//
+//
+/*********************************************************************/
+
+// include header of the class
+#include "Loop.h"
+// include only header of class declared in Loop.h (forward declaration)
+#include "Sinus.h"
+#include "MeanFilter.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::filter;
+using namespace flair::sensor;
+
+Loop::Loop(FrameworkManager *parent, string name, int priority)
+ : Thread(parent, name, priority) {
+ Tab *mainTab = new Tab(parent->GetTabWidget(), ObjectName());
+ killButton = new PushButton(mainTab->NewRow(), "kill");
+ startLogButton = new PushButton(mainTab->NewRow(), "start_log");
+ stopLogButton = new PushButton(mainTab->LastRowLastCol(), "stop_log");
+ period = new SpinBox(mainTab->NewRow(), "period thread:", " ms", 10, 1000, 1);
+
+ sinus = new Sinus(parent, "sinus");
+ sinus->UseDefaultPlot();
+
+ // 1st order law pass filter on raw signal, its parent is the sinus
+ firstLowPass = new LowPassFilter(sinus, sinus->GetSetupLayout()->NewRow(),
+ "1st order lawpass filter");
+ sinus->GetPlot()->AddCurve(
+ firstLowPass->Matrix()->Element(0),
+ DataPlot::Blue); // add output of the filter to signal's graph
+
+ // 3rd order law pass filter on raw signal, its parent is the sinus
+ thirdLowPass = new ButterworthLowPass(
+ sinus, sinus->GetSetupLayout()->NewRow(), "3rd order lawpass filter", 3);
+ sinus->GetPlot()->AddCurve(
+ thirdLowPass->Matrix()->Element(0),
+ DataPlot::Yellow); // add output of the filter to signal's graph
+
+ // mean filter on raw signal, its parent is the sinus
+ mean =
+ new MeanFilter(sinus, sinus->GetSetupLayout()->NewRow(), "Mean filter");
+ sinus->GetPlot()->AddCurve(
+ mean->GetMatrix()->Element(0),
+ DataPlot::Green); // add output of the filter to signal's graph
+
+ // mean filter on 1st order law pass filter, its parent is the 1st order law
+ // pass filter
+ meanOnfirstLowPass =
+ new MeanFilter(firstLowPass, sinus->GetSetupLayout()->NewRow(),
+ "Mean filter on 1st order lawpass filter");
+ sinus->GetPlot()->AddCurve(
+ meanOnfirstLowPass->GetMatrix()->Element(0),
+ DataPlot::Black); // add output of the filter to signal's graph
+
+ // set ojects to be logged
+ // as the law pass filters and the mean filters have the sinus as parent, they
+ // are automatically logged
+ parent->AddDeviceToLog(sinus);
+}
+
+Loop::~Loop() {}
+
+// main loop of the Thread
+void Loop::Run(void) {
+ // warn if changing from primary to secondary mode when in real time
+ WarnUponSwitches(true);
+
+ sinus->Start();
+
+ SetPeriodMS(period->Value());
+
+ while (1) {
+ WaitPeriod();
+
+ if (period->ValueChanged())
+ SetPeriodMS(period->Value());
+
+ if (killButton->Clicked())
+ break;
+ if (startLogButton->Clicked())
+ getFrameworkManager()->StartLog();
+ if (stopLogButton->Clicked())
+ getFrameworkManager()->StopLog();
+
+ // nothing more to do
+ // this is a very simple example
+
+ // normaly, we should use results of filters to calculate a control law
+ }
+
+ WarnUponSwitches(false);
+}
Index: branches/semaphore/trunk/demos/Sinus/src/Loop.h
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/Loop.h (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/Loop.h (revision 115)
@@ -0,0 +1,68 @@
+// created: 2013/06/26
+// filename: Loop.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+//
+//
+/*********************************************************************/
+
+#ifndef LOOP_H
+#define LOOP_H
+
+// necessary include, as Thread is a base of our class
+#include
+
+// forward declaration for other classes
+namespace flair {
+namespace core {
+class FrameworkManager;
+}
+namespace gui {
+class PushButton;
+class SpinBox;
+}
+namespace sensor {
+class Sinus;
+}
+namespace filter {
+class LowPassFilter;
+class ButterworthLowPass;
+class MeanFilter;
+}
+}
+
+class Loop : public flair::core::Thread {
+public:
+ /*!
+ * \brief Constructor
+ *
+ * Builds main loop
+ *
+ * \param parent the FrameworkManager to use
+ * \param name object name
+ * \param priority Thread priority, 51 by default (1:mini, 99:maxi)
+ */
+ Loop(flair::core::FrameworkManager *parent, std::string name,
+ int priority = 51);
+
+ /*!
+ * \brief Destructor
+ */
+ ~Loop();
+
+private:
+ void Run(void);
+
+ flair::sensor::Sinus *sinus;
+ flair::filter::LowPassFilter *firstLowPass;
+ flair::filter::ButterworthLowPass *thirdLowPass;
+ flair::filter::MeanFilter *mean, *meanOnfirstLowPass;
+ flair::gui::PushButton *startLogButton, *stopLogButton, *killButton;
+ flair::gui::SpinBox *period;
+};
+
+#endif // LOOP_H
Index: branches/semaphore/trunk/demos/Sinus/src/MeanFilter.cpp
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/MeanFilter.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/MeanFilter.cpp (revision 115)
@@ -0,0 +1,86 @@
+// created: 2013/06/27
+// filename: MeanFilter.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: object computing a mean filter
+//
+//
+/*********************************************************************/
+
+#include "MeanFilter.h"
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace filter {
+
+MeanFilter::MeanFilter(const IODevice *parent, const LayoutPosition *position,
+ string name)
+ : IODevice(parent, name) {
+ // interface initialisation
+ groupBox = new GroupBox(position, name);
+ numberOfElements = new SpinBox(groupBox->NewRow(), "numberOfElements:", 1,
+ MAX_NUMBER_OF_ELEMENTS,
+ 1); // saturated to MAX_NUMBER_OF_ELEMENTS
+
+ // init storage
+ for (int i = 0; i < MAX_NUMBER_OF_ELEMENTS; i++)
+ previousValues[i] = 0;
+
+ // 1*1 output matrix
+ cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+ desc->SetElementName(0, 0,
+ "mean filter"); // name will be used for graphs and logs
+ output = new cvmatrix(this, desc, floatType, name);
+
+ AddDataToLog(output);
+}
+
+MeanFilter::~MeanFilter() {}
+
+cvmatrix *MeanFilter::GetMatrix() const { return output; }
+
+float MeanFilter::GetValue(void) const { return output->Value(0, 0); }
+
+// UpdateFrom, where we implement the filter
+// this method is automatically called when the parent IODevice calls
+// ProcessUpdate
+// in our case it is the sinus or the 1st orde law pass filter
+//(see in Sinus::Run the call to ProcessUpdate)
+void MeanFilter::UpdateFrom(const io_data *data) {
+
+ float result = 0;
+ // get input argument in a cvmatrix
+ cvmatrix *input = (cvmatrix *)data;
+
+ // simple (and not efficent!) implementation of the filter
+ previousValues[numberOfElements->Value() - 1] = input->Value(0, 0);
+ for (int i = 0; i < numberOfElements->Value(); i++)
+ result += previousValues[i];
+ for (int i = 1; i < numberOfElements->Value(); i++)
+ previousValues[i - 1] = previousValues[i];
+
+ // put the result in output matrix
+ output->SetValue(0, 0, result / numberOfElements->Value());
+ // put corresponding time
+ output->SetDataTime(data->DataTime());
+
+ // ProcessUpdate is very important
+ // we must call it after updating the output matrix
+ // it allows:
+ // -to save value in the logs
+ // -to automatically call the next filter UpdateFrom method
+ ProcessUpdate(output);
+}
+} // end namespace filter
+} // end namespace flair
Index: branches/semaphore/trunk/demos/Sinus/src/MeanFilter.h
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/MeanFilter.h (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/MeanFilter.h (revision 115)
@@ -0,0 +1,93 @@
+// created: 2013/06/27
+// filename: MeanFilter.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: object computing a mean filter
+//
+//
+/*********************************************************************/
+
+#ifndef MEANFILTER_H
+#define MEANFILTER_H
+
+// we fix the max number of elements to compute the mean
+// this is a simple example, it should be dynamical
+#define MAX_NUMBER_OF_ELEMENTS 200
+
+// necessary include, as IODevice is a base of our class
+#include
+
+// forward declaration for other classes
+namespace flair {
+namespace core {
+class cvmatrix;
+}
+namespace gui {
+class LayoutPosition;
+class GroupBox;
+class SpinBox;
+}
+}
+
+// MeanFilter is a class computing a mean
+// based on a parametrizable number of elements
+// it derives on IODevice as it as an input and an output
+// it is a filter, we extend the namespace
+namespace flair {
+namespace filter {
+class MeanFilter : public core::IODevice {
+
+public:
+ /*!
+ * \brief Constructor
+ *
+ * Builds a mean filter. \n
+ * After calling this function, position will be deleted as it is no longer
+ *usefull. \n
+ *
+ * \param parent IODevice to use as parent
+ * \param position where to place settings
+ * \param name name of the object
+ */
+ MeanFilter(const core::IODevice *parent, const gui::LayoutPosition *position,
+ std::string name);
+
+ /*!
+ * \brief Destructor
+ */
+ ~MeanFilter();
+
+ /*!
+ * \brief Output matrix
+ *
+ * allows to access output matrix, to get signal value or to put it in a graph.
+ *\n
+ *
+ * \return pointer to the output matrix
+ */
+ core::cvmatrix *GetMatrix(void) const;
+
+ /*!
+ * \brief Value
+ *
+ * this method is equivalent to GetMatrix()->Value(0,0)
+ *
+ * \return actual mean value
+ */
+ float GetValue(void) const;
+
+private:
+ // UpdateFrom method from base class IODevice
+ void UpdateFrom(const core::io_data *data);
+ gui::GroupBox *groupBox;
+ gui::SpinBox *numberOfElements;
+ core::cvmatrix *output;
+ float previousValues[MAX_NUMBER_OF_ELEMENTS]; // previous values storage
+};
+} // end namespace filter
+} // end namespace flair
+#endif // MEANFILTER_H
Index: branches/semaphore/trunk/demos/Sinus/src/Sinus.cpp
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/Sinus.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/Sinus.cpp (revision 115)
@@ -0,0 +1,136 @@
+// created: 2013/06/26
+// filename: Sinus.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: class generating a sinus signal
+//
+//
+/*********************************************************************/
+
+#include "Sinus.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define PI ((float)3.14159265358979323846)
+
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+
+namespace flair {
+namespace sensor {
+
+Sinus::Sinus(const FrameworkManager *parent, string name, int priority)
+ : IODevice(parent, name), Thread(parent, name, priority) {
+
+ plot = NULL;
+
+ // 1*1 output matrix
+ cvmatrix_descriptor *desc = new cvmatrix_descriptor(1, 1);
+ desc->SetElementName(0, 0, "value"); // name will be used for graphs and logs
+ output = new cvmatrix((IODevice *)this, desc, floatType, name);
+ output->SetValue(0, 0, 0);
+
+ AddDataToLog(output);
+
+ // interface initialisation
+ mainTab = new Tab(parent->GetTabWidget(), name);
+ tabWidget = new TabWidget(mainTab->NewRow(), name);
+
+ Tab *settingsTab = new Tab(tabWidget, "Settings");
+ GroupBox *sinusGroupBox = new GroupBox(settingsTab->NewRow(), name);
+ frequency = new DoubleSpinBox(sinusGroupBox->NewRow(), "frequence:", " Hz", 0,
+ 100, 1);
+ amplitude = new DoubleSpinBox(sinusGroupBox->LastRowLastCol(), "amplitude:",
+ 0, 10, 1);
+ offset =
+ new DoubleSpinBox(sinusGroupBox->LastRowLastCol(), "offset:", 0, 10, 1);
+ period =
+ new SpinBox(settingsTab->NewRow(), "period thread:", " ms", 1, 1000, 1);
+
+ setupLayout = new GridLayout(
+ settingsTab->NewRow(),
+ "setup"); // layout sui servira à placer des filtres par exemple
+}
+
+Sinus::~Sinus() {
+
+ SafeStop();
+ Join();
+
+ // main_tab has the FrameworkManager as parent; it will be destroyed when
+ // FrameworkManager is destroyed
+ // it is cleaner to delete it manually, because main_tab is unnecessary when
+ // Sinus is deleted
+ delete mainTab;
+}
+
+void Sinus::UseDefaultPlot(void) {
+ Tab *plotTab = new Tab(tabWidget, "Graph");
+ plot = new DataPlot1D(plotTab->NewRow(), "Sinus", -10, 10);
+ plot->AddCurve(output->Element(0), DataPlot::Red);
+}
+
+GridLayout *Sinus::GetSetupLayout(void) const { return setupLayout; }
+
+DataPlot1D *Sinus::GetPlot(void) const {
+ if (plot == NULL)
+ Printf("Sinus::Plot, plot not yet defined, call UseDefaultPlot first\n");
+ return plot;
+}
+
+cvmatrix *Sinus::GetMatrix(void) const { return output; }
+
+float Sinus::GetValue(void) const { return output->Value(0, 0); }
+
+// main function, where we compute the signal
+void Sinus::Run(void) {
+
+ SetPeriodMS(period->Value());
+
+ // warn if changing from primary to secondary mode when in real time
+ WarnUponSwitches(true);
+
+ Time initTime = GetTime();
+
+ while (!ToBeStopped()) {
+ WaitPeriod();
+
+ if (period->ValueChanged() == true)
+ SetPeriodMS(period->Value());
+
+ // compute sinus
+ Time actualTime = GetTime();
+ float value =
+ offset->Value() +
+ amplitude->Value() *
+ sinf(2 * PI * frequency->Value() * (actualTime - initTime) /
+ 1000000000.); // les temps sont en nanosecondes
+
+ // put the result in output matrix
+ output->SetValue(0, 0, value);
+ // put corresponding time
+ output->SetDataTime(actualTime);
+
+ // ProcessUpdate is very important
+ // we must call it after updating the output matrix
+ // it allows:
+ // -to save value in the logs
+ // -to automatically call the next filter UpdateFrom method
+ ProcessUpdate(output);
+ }
+}
+} // end namespace sensor
+} // end namespace flair
Index: branches/semaphore/trunk/demos/Sinus/src/Sinus.h
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/Sinus.h (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/Sinus.h (revision 115)
@@ -0,0 +1,125 @@
+// created: 2013/06/26
+// filename: Sinus.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: class generating a sinus signal
+//
+//
+/*********************************************************************/
+
+#ifndef SINUS_H
+#define SINUS_H
+
+// necessary includes, as IODevice and Thread are bases of our class
+#include
+#include
+
+// forward declaration for other classes
+namespace flair {
+namespace core {
+class FrameworkManager;
+class cvmatrix;
+}
+namespace gui {
+class Tab;
+class TabWidget;
+class GridLayout;
+class DoubleSpinBox;
+class SpinBox;
+class DataPlot1D;
+}
+}
+
+// sinus is a class generating a sinus signal
+// in this example, it emulates a sensonr, so we extend the namespace sensor
+// it derives frome
+// IODevice: as it has an ouput
+// Thread: is it a thread
+namespace flair {
+namespace sensor {
+class Sinus : public core::IODevice, public core::Thread {
+public:
+ /*!
+ * \brief Constructor
+ *
+ * Builds a sinus generator
+ *
+ * \param parent the FrameworkManager to use
+ * \param name object name
+ * \param priority Thread priority, 50 by default (1:mini, 99:maxi)
+ */
+ Sinus(const core::FrameworkManager *parent, std::string name,
+ int priority = 50);
+
+ /*!
+ * \brief Destructor
+ */
+ ~Sinus();
+
+ /*!
+ * \brief Output matrix
+ *
+ * allows to access output matrix, to get signal value or to put it in a graph.
+ *\n
+ *
+ * \return un pointeur vers la matrice de sortie
+ */
+ core::cvmatrix *GetMatrix(void) const;
+
+ /*!
+ * \brief Value
+ *
+ * this method is equivalent to GetMatrix()->Value(0,0)
+ *
+ * \return actual signal value
+ */
+ float GetValue(void) const;
+
+ /*!
+ * \brief Use defautl plot
+ *
+ * this method put a graph in a specific tab
+ *
+ */
+ void UseDefaultPlot(void);
+
+ /*!
+ * \brief SetupLayout
+ *
+ * this method allows to add other widgets in the sinus tab.
+ *
+ * \return the GridLayout
+ */
+ gui::GridLayout *GetSetupLayout(void) const;
+
+ /*!
+ * \brief Plot
+ *
+ * this method allows to add other curves in the graph
+ *
+ * \return the DataPlot1D
+ */
+ gui::DataPlot1D *GetPlot(void) const;
+
+private:
+ // UpdateFrom method from base class IODevice
+ // sinus is like a sensor, so it does not have input; we define an empty
+ // method
+ void UpdateFrom(const core::io_data *data){};
+ void Run(void);
+
+ core::cvmatrix *output;
+ gui::Tab *mainTab;
+ gui::TabWidget *tabWidget;
+ gui::DataPlot1D *plot;
+ gui::DoubleSpinBox *frequency, *amplitude, *offset;
+ gui::SpinBox *period;
+ gui::GridLayout *setupLayout;
+};
+} // end namespace sensor
+} // end namespace flair
+#endif // SINUS_H
Index: branches/semaphore/trunk/demos/Sinus/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/Sinus/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Sinus/src/main.cpp (revision 115)
@@ -0,0 +1,97 @@
+// created: 2013/06/26
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+//
+//
+/*********************************************************************/
+
+#include "Loop.h"
+#include
+#include
+#include
+
+// we use namespace std, to avoid writing for examlpe std::string
+using namespace std;
+// idem for TCLAP
+using namespace TCLAP;
+// idem for flair
+using namespace flair::core;
+
+// global variables for the command line arguments
+string logPath; // path for logs
+string address; // address for FlairGCS
+int port; // port for FlairGCS
+string xmlFile; // setup xml file
+string name; // name
+
+void parseOptions(int argc, char **argv);
+
+int main(int argc, char *argv[]) {
+ // get command line arguments (name,port,xml_file,log_path)
+ parseOptions(argc, argv);
+
+ // creation of FrameworkManager
+ FrameworkManager *manager;
+ manager = new FrameworkManager(name);
+ manager->SetupConnection(address, port);
+ manager->SetupUserInterface(xmlFile);
+ manager->SetupLogger(logPath);
+
+ // creation of the
+ Loop *example = new Loop(manager, "Loop");
+
+ // start loop
+ example->Start();
+
+ // wait for loop ends (with kill button)
+ example->Join();
+
+ delete manager;
+}
+
+void parseOptions(int argc, char **argv) {
+ try {
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ // name of the FrameworkManager, Sinus by default
+ ValueArg nameArg("n", "name", "program name", false, "Sinus",
+ "string");
+ cmd.add(nameArg);
+
+ // setup xml file, ./Sinus.xml by default
+ ValueArg xmlArg("x", "xml", "xml file", false, "./Sinus.xml",
+ "string");
+ cmd.add(xmlArg);
+
+ // log path, ./ by defaults
+ ValueArg logArg("l", "log", "log path", false, "/tmp", "string");
+ cmd.add(logArg);
+
+ // address for FlairGCS
+ ValueArg addressArg("a", "address",
+ "address for FlairGCS station sol", false,
+ "127.0.0.1", "string");
+ cmd.add(addressArg);
+
+ // port for FlairGCS, 9000 by default
+ ValueArg portArg("p", "port", "port for FlairGCS", false, 9000, "int");
+ cmd.add(portArg);
+
+ cmd.parse(argc, argv);
+
+ // Get the value parsed by each arg.
+ logPath = logArg.getValue();
+ port = portArg.getValue();
+ xmlFile = xmlArg.getValue();
+ name = nameArg.getValue();
+ address = addressArg.getValue();
+
+ } catch (ArgException &e) { // catch any exceptions
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/CMakeLists.txt (revision 115)
@@ -0,0 +1,34 @@
+PROJECT(CustomReferenceAngles)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/MyApp.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/README
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/README (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/README (revision 115)
@@ -0,0 +1,8 @@
+CustomReferenceAngles
+
+This is a minimal skeleton to use the UavStateMachine class.
+It shows how to set custom reference angles, and use the default control laws.
+
+The custom reference angle mode is activated by clicking on the "start CustomReferenceAngles" button on ground station, or with R1 button on the Dualshock 3.
+The custom reference angle mode is deactivated by clicking on the "stop CustomReferenceAngles" button on ground station, or with X button on the Dualshock 3.
+
Index: branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp (revision 115)
@@ -0,0 +1,108 @@
+// created: 2015/10/27
+// filename: MyApp.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: skeleton to use UavStateMachine with custom reference angles only
+//
+//
+/*********************************************************************/
+
+//include files, add yours
+#include "MyApp.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+//namespaces, add others if necessary (filter, sensor, actuator)
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+MyApp::MyApp(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
+ start_CustomAngles=new PushButton(GetButtonsLayout()->NewRow(),"start CustomReferenceAngles");
+ stop_CustomAngles=new PushButton(GetButtonsLayout()->NewRow(),"stop CustomReferenceAngles");
+
+ customReferenceOrientation= new AhrsData(this,"reference");
+ uav->GetAhrs()->AddPlot(customReferenceOrientation,DataPlot::Yellow);
+ AddDataToControlLawLog(customReferenceOrientation);
+}
+
+MyApp::~MyApp() {
+}
+
+//this method is called by UavStateMachine::Run (main loop) when OrientationMode is Custom
+AhrsData *MyApp::GetReferenceOrientation(void) {
+ //compute the reference angles (for example depending on a position error)
+ //reference angular speed is set to 0
+
+ Euler refAngles;
+ //refAngles.roll=;
+ //refAngles.pitch=;
+ //refAngles.yaw=;
+
+ customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
+
+ return customReferenceOrientation;
+}
+
+void MyApp::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+ switch(event) {
+ case Event_t::TakingOff:
+ //always take off in default mode
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ case Event_t::EnteringFailSafeMode:
+ //return to default mode
+ Thread::Info("CustomReferenceAngles: stop\n");
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ }
+}
+
+void MyApp::ExtraCheckPushButton(void) {
+ if(start_CustomAngles->Clicked() && (behaviourMode!=BehaviourMode_t::CustomReferenceAngles)) {
+ StartCustomAngles();
+ }
+
+ if(stop_CustomAngles->Clicked() && (behaviourMode==BehaviourMode_t::CustomReferenceAngles)) {
+ StopCustomAngles();
+ }
+}
+
+void MyApp::ExtraCheckJoystick(void) {
+ //R1
+ if(GetJoystick()->IsButtonPressed(9) && (behaviourMode!=BehaviourMode_t::CustomReferenceAngles)) {
+ StartCustomAngles();
+ }
+
+ //stop is not managed here, it is done in UavStateMachine with cross button
+ //pushing cross button will enter fail safe mode and signal the EnteringFailSafeMode event
+}
+
+void MyApp::StartCustomAngles(void) {
+ //ask UavStateMachine to enter in custom orientation mode
+ if (SetOrientationMode(OrientationMode_t::Custom)) {
+ Thread::Info("CustomReferenceAngles: start\n");
+ } else {
+ Thread::Warn("CustomReferenceAngles: could not start\n");
+ return;
+ }
+
+ behaviourMode=BehaviourMode_t::CustomReferenceAngles;
+}
+
+void MyApp::StopCustomAngles(void) {
+ //just ask to enter fail safe mode
+ EnterFailSafeMode();
+}
Index: branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.h (revision 115)
@@ -0,0 +1,55 @@
+// created: 2015/10/27
+// filename: MyApp.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: skeleton to use UavStateMachine with custom reference angles only
+//
+//
+/*********************************************************************/
+
+#ifndef MYAPP_H
+#define MYAPP_H
+
+#include
+
+namespace flair {
+ namespace core {
+ class AhrsData;
+ }
+ namespace gui {
+ class PushButton;
+ }
+ namespace sensor {
+ class TargetController;
+ }
+}
+
+class MyApp : public flair::meta::UavStateMachine {
+ public:
+ MyApp(flair::meta::Uav* uav,flair::sensor::TargetController *controller);
+ ~MyApp();
+
+ private:
+ enum class BehaviourMode_t {
+ Default,
+ CustomReferenceAngles
+ };
+
+ BehaviourMode_t behaviourMode;
+
+ void StartCustomAngles(void);
+ void StopCustomAngles(void);
+ void ExtraCheckPushButton(void);
+ void ExtraCheckJoystick(void);
+ flair::core::AhrsData *GetReferenceOrientation(void);
+ void SignalEvent(Event_t event);
+
+ flair::gui::PushButton *start_CustomAngles,*stop_CustomAngles;
+ flair::core::AhrsData *customReferenceOrientation;
+};
+
+#endif // MYAPP_H
Index: branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomReferenceAngles/src/main.cpp (revision 115)
@@ -0,0 +1,96 @@
+// created: 2015/10/27
+// filename: main.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: exemple de code uav
+//
+//
+/*********************************************************************/
+
+#include "MyApp.h"
+#include
+#include
+#include
+#include
+#include
+
+using namespace TCLAP;
+using namespace std;
+using namespace flair::core;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+string uav_type;
+string log_path;
+int port;
+int ds3port;
+string xml_file;
+string name;
+string address;
+
+void parseOptions(int argc, char** argv);
+
+int main(int argc, char* argv[]) {
+ parseOptions(argc,argv);
+
+ FrameworkManager *manager;
+ manager= new FrameworkManager(name);
+ manager->SetupConnection(address,port);
+ manager->SetupUserInterface(xml_file);
+ manager->SetupLogger(log_path);
+
+ Uav* drone=CreateUav(manager,name,uav_type);
+ TargetEthController *controller=new TargetEthController(manager,"Dualshock3",ds3port);
+ MyApp* app=new MyApp(drone,controller);
+
+ app->Start();
+ app->Join();
+
+ delete manager;
+}
+
+void parseOptions(int argc, char** argv) {
+ try {
+
+ CmdLine cmd("Command description message", ' ', "0.1");
+
+ ValueArg nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
+ cmd.add( nameArg );
+
+ ValueArg typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, x4_simu, x8_simu or x4_simux (with x the number of the simulated uav)",true,"hds_x4","string");
+ cmd.add( typeArg );
+
+ ValueArg xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
+ cmd.add( xmlArg );
+
+ ValueArg logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
+ cmd.add( logsArg );
+
+ ValueArg portArg("p","port","port pour station sol",true,9000,"int");
+ cmd.add( portArg );
+
+ ValueArg addressArg("a","address","addresse station sol",true,"127.0.0.1","string");
+ cmd.add( addressArg );
+
+ ValueArg ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
+ cmd.add( ds3portArg );
+
+ cmd.parse( argc, argv );
+
+ // Get the value parsed by each arg.
+ log_path = logsArg.getValue();
+ port=portArg.getValue();
+ ds3port=ds3portArg.getValue();
+ xml_file = xmlArg.getValue();
+ name=nameArg.getValue();
+ uav_type=typeArg.getValue();
+ address=addressArg.getValue();
+
+ } catch (ArgException &e) { // catch any exceptions
+ cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+ }
+}
Index: branches/semaphore/trunk/demos/Skeletons/CustomTorques/CMakeLists.txt
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomTorques/CMakeLists.txt (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomTorques/CMakeLists.txt (revision 115)
@@ -0,0 +1,34 @@
+PROJECT(CustomTorques)
+cmake_minimum_required(VERSION 2.8)
+
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+SET(FLAIR_USE_FILTER TRUE)
+SET(FLAIR_USE_SENSOR_ACTUATOR TRUE)
+SET(FLAIR_USE_META TRUE)
+SET(FLAIR_USE_VRPN TRUE)
+
+include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
+include(${FLAIR_USE_FILE})
+
+SET(SRC_FILES
+ ${CMAKE_SOURCE_DIR}/src/main.cpp
+ ${CMAKE_SOURCE_DIR}/src/MyApp.cpp
+)
+
+INCLUDE_DIRECTORIES(
+ ${FLAIR_INCLUDE_DIR}
+)
+
+#real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_rt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+
+#non real time executable
+ADD_EXECUTABLE(${PROJECT_NAME}_nrt
+ ${SRC_FILES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
Index: branches/semaphore/trunk/demos/Skeletons/CustomTorques/README
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomTorques/README (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomTorques/README (revision 115)
@@ -0,0 +1,8 @@
+CustomTorques
+
+This is a minimal skeleton to use the UavStateMachine class.
+It shows how to set custom torques, to use our own control laws.
+
+The custom torque mode is activated by clicking on the "start CustomTorques" button on ground station, or with R1 button on the Dualshock 3.
+The custom torque mode is deactivated by clicking on the "stop CustomTorques" button on ground station, or with X button on the Dualshock 3.
+
Index: branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.cpp (revision 115)
@@ -0,0 +1,95 @@
+// created: 2015/10/29
+// filename: Uav.cpp
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: skeleton to use UavStateMachine with custom torques only
+//
+//
+/*********************************************************************/
+
+//include files, add yours
+#include "MyApp.h"
+#include
+#include
+#include
+#include
+
+//namespaces, add others if necessary (filter, sensor, actuator)
+using namespace std;
+using namespace flair::core;
+using namespace flair::gui;
+using namespace flair::meta;
+using namespace flair::sensor;
+
+MyApp::MyApp(Uav* uav,TargetController *controller): UavStateMachine(uav,controller), behaviourMode(BehaviourMode_t::Default) {
+ start_CustomTorques=new PushButton(GetButtonsLayout()->NewRow(),"start CustomTorques");
+ stop_CustomTorques=new PushButton(GetButtonsLayout()->NewRow(),"stop CustomTorques");
+}
+
+MyApp::~MyApp() {
+}
+
+//this method is called by UavStateMachine::Run (main loop) when TorqueMode is Custom
+void MyApp::ComputeCustomTorques(Euler &torques) {
+ //compute the torques, with your own control laws
+
+ //torques.roll=;
+ //torques.pitch=;
+ //torques.yaw=;
+}
+
+void MyApp::SignalEvent(Event_t event) {
+ UavStateMachine::SignalEvent(event);
+ switch(event) {
+ case Event_t::TakingOff:
+ //always take off in default mode
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ case Event_t::EnteringFailSafeMode:
+ //return to default mode
+ Thread::Info("CustomTorques: stop\n");
+ behaviourMode=BehaviourMode_t::Default;
+ break;
+ }
+}
+
+void MyApp::ExtraCheckPushButton(void) {
+ if(start_CustomTorques->Clicked() && (behaviourMode!=BehaviourMode_t::CustomTorques)) {
+ StartCustomTorques();
+ }
+
+ if(stop_CustomTorques->Clicked() && (behaviourMode==BehaviourMode_t::CustomTorques)) {
+ StopCustomTorques();
+ }
+}
+
+void MyApp::ExtraCheckJoystick(void) {
+ //R1
+ if(GetJoystick()->IsButtonPressed(9) && (behaviourMode!=BehaviourMode_t::CustomTorques)) {
+ StartCustomTorques();
+ }
+
+ //stop is not managed here, it is done in UavStateMachine with cross button
+ //pushing cross button will enter fail safe mode and signal the EnteringFailSafeMode event
+}
+
+void MyApp::StartCustomTorques(void) {
+ //ask UavStateMachine to enter in custom torques
+ if (SetTorqueMode(TorqueMode_t::Custom)) {
+ Thread::Info("CustomTorques: start\n");
+ } else {
+ Thread::Warn("CustomTorques: could not start\n");
+ return;
+ }
+
+ behaviourMode=BehaviourMode_t::CustomTorques;
+}
+
+void MyApp::StopCustomTorques(void) {
+ //just ask to enter fail safe mode
+ EnterFailSafeMode();
+}
Index: branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.h
===================================================================
--- branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.h (revision 115)
+++ branches/semaphore/trunk/demos/Skeletons/CustomTorques/src/MyApp.h (revision 115)
@@ -0,0 +1,51 @@
+// created: 2015/10/29
+// filename: MyApp.h
+//
+// author: Guillaume Sanahuja
+// Copyright Heudiasyc UMR UTC/CNRS 7253
+//
+// version: $Id: $
+//
+// purpose: skeleton to use UavStateMachine with custom torques only
+//
+//
+/*********************************************************************/
+
+#ifndef MYAPP_H
+#define MYAPP_H
+
+#include