arbdrone 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+ gem 'eventmachine', :git => 'git@github.com:eventmachine/eventmachine.git'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ ARbDrone
2
+ Copyright (C) 2011 by Ben Klang <bklang@mojolingo.com>
3
+ API specification Copyright (C) 2007-2011 Parrot SA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,262 @@
1
+ Parrot AR.Drone Development License v2.1
2
+
3
+ Added by Martin Lefebure 27 days ago
4
+
5
+ Dear Developers,
6
+
7
+ You can find the full terms of the license here.
8
+
9
+ You may use, copy, modify the PARROT AR.Drone SDK and APIs or any portion of it, and thus form a work based on Parrot SDK and APIs, and copy and redistribute in source code and binary forms, with or without modification, provided that you comply with following conditions:
10
+
11
+ Redistribution in source code, with or without modification, must retain Parrot copyright notice and disclaimer and the license to develop and use in a text file named "Parrot License".
12
+ Redistribution in binary form must reproduce Parrot copyright notice and disclaimer in the product documentation or legal notice.
13
+ The name of Parrot may not be used to endorse or promote products derived from the APIs without specific prior written permission.
14
+ Best Regards
15
+ The AR.Drone Developer Team
16
+
17
+ Copyright (C) 2007-2011, PARROT SA, all rights reserved.
18
+
19
+ DISCLAIMER
20
+ The APIs is provided by PARROT and contributors "AS IS" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall PARROT and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.†
21
+
22
+ IMPORTANT: INSTRUCTION TO USE AND TO APPLY THE TERMS OF THE LICENSE TO ANY NEW PROGRAM
23
+
24
+ READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING
25
+ † †
26
+
27
+ Copyright (C) 2007-2011, PARROT SA, all rights reserved.
28
+
29
+
30
+ You may use, copy, modify the PARROT AR.Drone SDK and APIs or any portion of it, and thus form a work based on Parrot SDK and APIs, and copy and redistribute in source code and binary forms, with or without modification, provided that you comply with following conditions:
31
+
32
+ * Redistribution in source code, with or without modification, must retain Parrot copyright notice, the following disclaimer and the license to develop and use in a text file named ìParrot Licenseî.
33
+
34
+ * Redistribution in binary form must reproduce Parrot copyright notice, the following disclaimer in the product documentation or legal notice.
35
+
36
+ * The name of Parrot may not be used to endorse or promote products derived from the APIs without specific prior written permission.
37
+
38
+
39
+ DISCLAIMER
40
+ The APIs is provided by PARROT and contributors "AS IS" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall PARROT and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.†
41
+
42
+
43
+ DEVELOPMENT LICENSE OF THE PARROT AR.DRONE SDK and APIs V2.0
44
+ (Creation of games for the Parrot AR.DRONE)
45
+
46
+
47
+
48
+
49
+ Article 1: Purpose†
50
+ The purpose of the present Development License is to define the terms and conditions under which the Developer is authorized to use the source codes of the PARROT SDK and APIs to create under its own responsibility a Game for the AR.Drone and to market it for free or against payment.
51
+
52
+ Article 2: Definitions
53
+ The terms defined hereunder, used in singular or plural, shall have the following meaning:
54
+
55
+ - ´PARROT SDK and†APIs†ª: means the AR.Drone software development kit and AR.Drone APIs and associated documentation, allowing to pilot the PARROT AR.Drone, from a mobile phone, a console game, a computer or any other electronic device, and which source codes are provided for free to the Developer;
56
+ - ´†Developer†ª means a physical person, of age, having the capacity to accept the terms of the present License or a person, representing a company and having all powers to that effect to bind the company;
57
+ - ìPARROT AR.Droneî or ìPARROT AR.Droneî or ´†PARROT†Droneª means the augmented reality drone developed by PARROT, without pilot, remote-controlled by a mobile phone, a console game, a computer or any other electronic device;
58
+ - ´†Interoperability†ª: means the ability of an application to exchange information with the Parrot AR.Drone or any itís accessories;
59
+ - ì Game for AR.Droneî†: means a software or a video game, created by the Developer†from the PARROT SDK and†APIs† or any modified version, and which functionalities shall exclusively be dedicated to the use of the PARROT AR.Drone for entertaining, game, leisure or training purpose or any other purpose compatible with the terms of the present license;
60
+ - ´†License†ª means the present license of development and use of the APIís;
61
+ - ´ User Accountª means the information relating to the identification of a Developer, such as first name, surname, email address, login, password, company, title;
62
+ - ´†User†ª: means any physical person using the PARROT Drone or a Game for AR.Drone.
63
+
64
+ ARTICLE 3 ñ Identification
65
+ 3.1 The downloading of the APIís is subject to the Identification of the Developer by filling in the online registration form and accept the terms of the License by clicking the acceptance box on https://projects.ardrone.org .
66
+ 3.2 The Developer commits to provide accurate information and to update the information, if necessary.
67
+
68
+ 3.4 The User Account is personal and confidential; it cannot be assigned to a third party.
69
+
70
+ 3.5 The Developer commits to inform PARROT immediately of any disclosure, non authorized use by a third party of the login and/or password of its User Account. In such case, PARROT shall be entitled to invalid the login and the password.
71
+
72
+
73
+ ARTICLE 4†ñ Conditions of Use
74
+ Notwithstanding the limitation and restrictions mentioned in article 5, PARROT grants to the Developer, who accepts, a personal, non-assignable, non-exclusive, worldwide, free license of development of the PARROT SDK and†APIs authorizing the Developer to:
75
+ * reproduce, without number limitation, the APIís on any device under its responsibility, and necessary to create the Game for AR.Drone;
76
+ * translate, adapt, arrange, modify the APIís †in order to create a Game for AR.Drone in the software and hardware environment chosen by the Developer;
77
+ * to market, for free or against fees, copies of the Game for AR.Drone created ;
78
+ * to grant licenses of the Game for AR.Drone to the Users of the PARROT Drone.
79
+
80
+
81
+ ARTICLE 5 ñ Restrictions to the license
82
+ 5.1 The License of development and use of the APIís is subject to the acceptance and to the respect by the Developer†without any reserves of all restrictions and limitations listed hereafter:
83
+
84
+ Consequently, PARROT expressly forbids the Developer:
85
+ i. To do reverse engineering, decompile or attempt to extract the Source Codes of the PARROT Drone; under special legal conditions, necessary information for interoperability purpose might be requested from PARROT ;
86
+ ii. To destroy, or alter any warning and copyrights notices;
87
+ iii. To use the PARROT SDK and†APIs to develop an application other than a Game for AR.Drone. The Game for AR.Drone shall have for sole purpose to be used by a User for entertaining, game, leisure or training. The creation of applications for the use of the PARROT AR.Drone for professional use or use such as but not limited to military, and, without limitation, security, watching, spying, defence, cartography, is strictly forbidden.
88
+ iv. To use the PARROT SDK and†APIs or to create a Game for AR.Drone breaching the terms of:
89
+ (1) The License;
90
+ (2) Third party rights;
91
+ (3) Applicable laws and regulations;
92
+ (4) Any instruction provided by PARROT.
93
+
94
+ 5.2 Therefore, and without limitation, the Developer commits when using the APIís or when creating a Game for AR.Drone:
95
+ a) not to infringe any applicable laws and regulation which the Developer shall determine whatever the country where he intends to develop and/or market the Game for AR.Drone†;
96
+ b) not to reproduce, represent, put contents which infringe copyrights, patents, trademarks, design, model, know-how, commercial secret and any intellectual property rights belonging to PARROT or to third parties†;
97
+ c) not to falsify or remove copyrights, trademarks notices of any other proprietary rights of PARROT figuring in the Application;
98
+ d) not to display a Game for AR.Drone which falsely or implied would suggest an endorsement or any approbation from PARROT ;
99
+ e) not to collect or treat, or store, with the Game for AR.Drone, personal data from third, especially User of the Game for AR.Drone without having previously asked for their consent. Shall the Game for AR.Drone store personal data, it should be in compliance with the applicable law
100
+
101
+ 5.3 PARROT is sole judge of the compliance of the Game for AR.Drone with the terms and conditions of the present License.
102
+
103
+ 5.5 PARROT reserves the right to correct or modify the PARROT SDK and†APIs during the License duration.
104
+
105
+ ARTICLE 6 ñ Duration of the License
106
+
107
+ The License of the PARROT SDK and†APIs is granted for the duration of the intellectual property rights of the Game for AR.Drone. It enters into force upon acceptance by the Developers by clicking the acceptance box or using a modified release of the PARROT SDK and†APIs.
108
+
109
+
110
+ ARTICLE 7 ñ Termination of the License
111
+
112
+ 7.1.†Termination of the License†
113
+ 7.1.1 PARROT reserves the right to terminate the present License, without notice, in following cases:
114
+
115
+ i. The Developer† has created a Game for AR.Drone in violation of the present License terms, any applicable law and regulation or PARROT has objective reasons to believe that the Game for AR.Drone is infringing the License or any applicable law and regulation ;
116
+ ii. The Developer†has created a Game for AR.Drone in violation of PARROTís intellectual property rights or PARROT has objective reasons to believe that the Game for AR.Drone is infringing itís rights†;†
117
+ iii. The Developer† has created a Game for AR.Drone in violation of a third partyís intellectual property rights or PARROT has objective reasons to believe that the Game for AR.Drone is infringing a third partyís rights†;†
118
+ iv. The Developer†has created a Game for AR.Drone containing bugs, viruses, worms, defects, Trojan horses, or any items of a destructive nature or PARROT has objective reasons to believe that the Game for AR.Drone contains of this item;
119
+
120
+ 7.1.2 Termination of the License shall be notified by email to any user breaching the terms of the License.
121
+
122
+ 7.1.3 In case of closing of a User Account or termination of the License, for whatever reason, articles which by their nature shall survive shall continue to be applicable, in particular articles 11.RIGHTS OF PARROT; 12.EXCLUSION OF WARRANTIES; 13.LIMITATION OF RESPONSIBILITY; 14.INDEMNITY; 15.GENERALS TERMS.
123
+
124
+ ARTICLE 8 ñ Specific Development
125
+
126
+ Upon request of a video game editor, PARROT may perform specific development of the PARROT SDK and†APIs, in order to enable the creation of a Game for AR.Drone for commercial purpose by such editor. The development services provide by PARROT shall be subject to a separate agreement between PARROT and the editor. PARROT and the editor shall share the revenues gained from the sale of games created thanks to the specific development for an amount to be determined by agreement between the parties.
127
+
128
+
129
+ ARTICLE 9 ñ Upgrade of the APIís†
130
+ 9.1 Due to technological innovations and for quality and/ or security reasons, the Developer acknowledges and agrees that PARROT may at any time modify the APIís, namely by adjunction, removal, improvement of functionalities, or that PARROT may temporarily or definitely suspend the access to the APIís, at its sole discretion and without notice. PARROT warrants ñ as far as possible and with no result obligation, the ascendant compatibility of the APIís.
131
+
132
+ 9.2 PARROT shall notify any modification by publication on https://projects.ardrone.org, or per email, or by any other appropriate mean in PARROT judgment. From the notification, the use of the APIís by the Developer†to create new Game for AR.Drone shall be deemed as the acceptance by the Developer of the modified License of the PARROT SDK and†APIs.
133
+
134
+
135
+ ARTICLE 10 ñ License granted to Parrot by the Developper
136
+ 10.1 The Developer is owner of all copyrights and other intellectual property rights on the Game for AR.Drone that he creates. If the Developer is posting his Game for AR.Drone on https://projects.ardrone.org , he grants PARROT a perpetual, irrevocable, worldwide, free and non-exclusive license to reproduce, represent, adapt, arrange , modify, translate, publish, operate and display the Game for AR.Drone†by any means of communication, numerical, analogical, electronic..to the public and namely by any network(internet, intranet), wireless or not, by mobile phone, email, by satellite, par optical fibre, par television and on any media.
137
+
138
+ 10.2 This license shall be granted in order to allow PARROT to display, promote, and distribute the PARROT SDK and†APIs and/or the PARROT AR.Drone.
139
+
140
+ 10.3 This license includes the right for PARROT to make the Game for AR.Drone†available ñ totally or partially ñ to any Users of the AR.DRONE PARROT or to any person with who PARROT is in relationship, and to use the Game for AR.Drone for information or advertisement purpose.
141
+
142
+ 10.4 The Developer agrees that PARROT for technical or for improvement purpose, may (a) transmit or communicate the Game for AR.Drone on public network others than internet (wireless or not, namely mobile telephony) and various media (graphic, magnetic, optical, numerical, analogical); and (b) make any modification necessary to adapt and make the Game for AR.Drone compliant to technical specifications so to make it interoperable with networks or devices.
143
+
144
+ 10.5 The Developer warrants PARROT that he has the rights to grant the license.
145
+
146
+
147
+ ARTICLE 11: Parrot Rights
148
+ 11.1 Intellectual and industrial property rights.
149
+ PARROT is and remains the owner of all rights and interests on the PARROT SDK and†APIs and on the PARROT AR.Drone, including without limitation all rights of intellectual and industrial property (copyrights, database rights, patents, trademark, design and model, semi-conductor topography) and/or any rights on the know-how, schemes, plans, algorythme, technologies, ideas, concepts.
150
+
151
+ It is expressly specified that PARROT is owner of patents on the PARROT AR.Drone and that a right to use such patent is granted within the frame of the present License. No other rights on the patents are granted to the Developer who commits no to use the technologies issued from those patents for purpose not in the scope of the present License.
152
+
153
+
154
+
155
+
156
+
157
+
158
+ 11.2 Trademarks and logos.
159
+ 11.2.1 PARROT is owner of the intellectual property rights on its commercial trade name, trademarks, logos, domain names and any others brand features. PARROT grants the Developer†a non-exclusive, non assignable, non transferable, non sub-licensable, free license to use PARROT trademarks and logos for the sole purpose of mentioning that he uses the PARROT SDK and†APIs.
160
+
161
+ 11.2.2 When using PARROTís trademarks and logos, the Developer undertakes:
162
+ i. Not to display a trademark or a logo in any manner that implies a relationship or affiliation with, sponsorship, or endorsement by PARROT or that can be reasonably interpreted to suggest editorial content has been authored by, or represents the views or opinions of PARROT;
163
+ ii. Not to use PARROT brand features to disparage PARROT or its products;
164
+ iii. Not to display a trademark or a logo on its website if it contains or displays adult content or promotes illegal activities, gambling, or the sale of tobacco or alcohol to persons under eighteen (18) years of age;
165
+ iv. Not to display the PARROT trademark and logo as the most prominent element in any part of the Game for AR.Drone created by the Developer or its packaging;
166
+ v. Not to display the PARROT logo as the most prominent logo in the Game for AR.Drone ;
167
+ vi. Not to display PARROT trademark or logo in a manner that is misleading, defamatory, infringing, libelous, disparaging, obscene or otherwise objectionable to PARROT;
168
+ vii. Not to display a PARROT trademark or logo on a site that violates any law or regulation†;
169
+ viii. Not to remove, distort or alter any element of a PARROT brand feature (including squeezing, stretching, inverting, discoloring, etc.).
170
+
171
+ 11.3 The Developer undertakes during the term of the License and after its expiration, not to register or attempt to register any trademark, logo, domain name similar to or confusing with PARROT trademark or logo, in any manner (phonetic, intellectual, visual). PARROT reserves the right to sue for counterfeiting and unfair competition, any Developer who would not respect this commitment and use the trademarks and/or domain name PARROT AR.DRONE OU AR.DRONE in breach of the License.
172
+
173
+ 11.4 The Developer undertakes to immediately remedy to any breach notified by PARROT per email or any other mean concerning any infringement to PARROT intellectual property rights.
174
+
175
+ 11.5 The Developer, company or physical person, is owner, as applicable, on the intellectual property rights on his name, commercial name, trademarks, logos and any other brand features. He expressly grants PARROT a non exclusive, worldwide and free license to mention his name, commercial name, trademarks, logos, as applicable, to mention that he uses the PARROT SDK and†APIs and/or that he has created a Game for AR.Drone.
176
+
177
+
178
+ ARTICLE 12: DISCLAIMER
179
+ 12.1 THE PARROT SDK AND†APIs IS PROVIDED ´AS IS†ª. IN PARTICULAR, PARROT, ITíS SUBSIDIARIES, LICENSORS AND THEIR SUPPLIERS, DO NOT REPRESENT OR WARRANT THE DEVELOPER THAT:
180
+ 1. ITS USE OF THE APIís WILL MEET ITS REQUIREMENTS;
181
+ 2. ITS USE OF THE APIís WILL BE UNINTERRUPTED, TIMELY, SECURE OR FREE FROM ERROR OR WILL OFFER CONSTANT PERFORMANCE;
182
+ 3. THAT DEFECTS OR ERRORS WILL BE CORRECTED OR THAT THE APIís WILL BE UPGRADE, PARROT HAVING NO OBLIGATION TO PROVIDE CURATIVE OR EVOLUTIVE SUPPORT;
183
+ 4. THE APIís IS COMPLIANT TO ANY SPECIFICATIONS;
184
+ 5. ANY UPGRADE OF THE PARROT SDK AND†APIs WILL BE COMPATIBLE WITH PREVIOUS RELEASE.
185
+
186
+ 12.2 PARROT, ITS SUBSIDIARIES, LICENSORS AND THEIR SUPPLIERS, DO NOT REPRESENT OR WARRANT THE DEVELOPER THAT ITS USER ACCOUNT WILL BE AVAILABLE WITHOUT INTERRUPTION.
187
+
188
+ 12.3 NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY THE DEVELOPER FROM PARROT, ITS SUBSIDIARERIES, OR THROUGH THE APIís, SHALL BE CONSTRUED A WARRANTY PROVIDED BY PARROT.
189
+
190
+ 12.4 PARROT, ITíS SUBSIDIARIES, ITS LICENSORS DO NOT WARRANT, ANY RESULT, EXPRESS OR IMPLIED, OF ANY NATURE (TECHNICAL, COMMERCIAL, FINANCIAL OR OTHER) FROM THE USE OF THE APPLICATION.
191
+
192
+ 12.5 PARROT DECLARES THAT TO THE BEST OF ITS KNOWLEDGE THE PARROT SDK AND†APIs DOES NOT INFRINGE ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHTS.
193
+
194
+
195
+ ARTICLE 13: LIMITATION OF RESPONSABILITY
196
+ 13.1 THE PROVISION EXCLUSING OR LIMITING PARROTíS LIABILITY SHALL ONLY BE APPLICABLE IN COUNTRIES WHERE SUCH PROVISIONS ARE LEGAL. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR CERTAIN TYPES OF LOSS OR DAMAGES. ACCORDINGLY, PARROTíS LIABILITY WILL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW.
197
+
198
+
199
+
200
+
201
+ 13.2 THE DEVELOPER EXPRESSLY ACKNOWLEDGES AND AGREES THAT THE USE HE DOES OF ITS USER ACCOUNT, THE APIís, THE GAME FOR AR.DRONE THAT HE CREATES, ARE AT ITS SOLE RISK AND RESPONSABILITY. IN PARTICULAR, THE DEVELOPER SHALL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO ITS COMPUTER SYSTEM OR OTHER DEVICE, LOSS OF DATA, OR ANY OTHER DAMAGE OR INJURY THAT RESULTS FROM THE DOWNLOAD OR USE OF THE APIís.
202
+
203
+ 13.3 THE DEVELOPER EXPRESSLY ACKNOWLEDGES AND AGREES THAT HE SHALL BE SOLELY RESPONSIBLE FOR ALL COSTS, EXPENSES INCURRING FOR THE USE OF ITEMS MENTIONED ABOVE AS WELL AS ANY DEVELOPMENT AND PRODUCTION COSTS ASSOCIATED TO THE GAME OF AR.DRONE THAT HE IS CREATING.
204
+
205
+ 13.4 PARROT, ITS SUPPLIERS, LICENSORS, AFFILIATES, ARE NOT RESPONSIBLE FOR ANY DIRECTS OR INDIRECTS, MATERIALS OR IMMATERIALS, CONSECUTIVES OR NON CONSECUTIVES DAMAGES, INCLUDING, BUT NOT BE LIMITED TO, ANY LOSS OF PROFIT (WHETHER INCURRED DIRECTLY OR INDIRECTLY), ANY LOSS OF GOODWILL OR BUSINESS REPUTATION, ANY LOSS OF DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR OTHER INTANGIBLE LOSS, THAT DEVELOPER OR A THIRD PARTY MAY INCURR FROM:
206
+
207
+ 1- THE USE BY THE DEVELOPER OF ITS USER ACCOUNT, THE PARROT SDK AND†APIs, THE GAME FOR AR.DRONE THAT HE CREATES;
208
+ 2- THE MARKETING OF THE GAME FOR AR.DRONE FOR FREE OR AGAINST FEES;
209
+ 3- THE MODIFICATION OF THE APIís BY PARROT;
210
+ 4- THE CLOSING OF THE USER ACCOUNT, THE MODIFICATION OR THE EXPIRATION OR TERMINATION OF THE LICENSE;
211
+ 5- ANY NON ACCURATE OR NON UPDATED INFORMATION PROVIDED BY PARROT,
212
+
213
+ ARTICLE 15: Indemnification
214
+ The Developer warrants and hereby agrees to indemnify, defend and hold PARROT harmless from and against any claim or liability arising out of: (a) the use of the APIís in breach of the License and/or any instruction provided by PARROT; (b) the Game for AR.Drone; (c) any use by Users of the Game for AR.Drone; (d) any claim that the Game for AR.Drone breaches laws or infringes third party rights; consequently, assume all costs and damages to which PARROT could be condemned by a jurisdiction on such a basis. The Developer shall cooperate as fully as reasonably required in the defence of any claim and PARROT reserves the right, at its own expense, to assume the exclusive defence and control of any matter subject to indemnification by the Developer. And if necessary, to seek equitable relief, including but not limited to preliminary injunction and injunction, in addition to all other remedies.
215
+
216
+ ARTICLE 16: Hyperlinks
217
+ 16.1. The https://project.ardrone.org ardrone.org website may include hyperlinks to other web sites or content or resources provided by third parties and companies. PARROT has no control or authority over any web sites, resources, third parties. The Developer acknowledges and agrees that PARROT is not responsible for the availability of any such external sites or resources, and does not endorse any advertising, products or other materials on or available from such web sites or resources.
218
+
219
+ 16.2. The Developer acknowledges and agrees that PARROT is not liable for any loss or damage that may be incurred by the Developer as a result of the availability of those external sites or resources, or as a result of any reliance placed by you on the completeness, accuracy or existence of any advertising, products, or other materials on, or available from, such web sites or resources.
220
+
221
+
222
+ ARTICLE 17: Language and interpretation
223
+ 17.1 The English version of the License shall prevail over any translation, which might only be provided for convenience purpose. Therefore any translation might be provided only for convenience purpose.
224
+
225
+ 17.2 If there is any contradiction between the English language version of the License and a translation of the License, the English language version will take precedence.
226
+
227
+ 17.3 Titles are provided for convenience purpose only; the content of an article shall have precedence on the title.
228
+
229
+ ARTICLE 18: General provisions
230
+ 18.1 The License constitutes the entire legal agreement between Parrot and the Developer and completely replace and supersede any prior agreements between PARROT and the Developer.
231
+
232
+ 18.2 The waiver by PARROT to prevail itself from a provision of the License shall not be construed as a waiver to prevail itself of any right obligation under the License in the future.
233
+
234
+ 18.3 If any court of law having jurisdiction rules that any provision of this License is invalid, then that provision will be removed from the License without affecting the rest of the License. The remaining provisions of the License will continue to be valid and enforceable.
235
+
236
+ 18.4 Any notice sent by PARROT to the Developer or exchange between the Parties will be validly delivered per email at the address provided by the Developer in its User Account and at legal@ardrone.org for PARROT.
237
+
238
+
239
+ ARTICLE 19: Applicable law and jurisdiction
240
+ The License is governed by French Law, without regard to its conflict of Laws provisions. Any dispute arising out of its interpretation, execution or termination shall be submitted to the exclusive jurisdiction of the relevant court of Paris, even for urgency proceedings or plurality of defendants. Notwithstanding this, PARROT shall be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction
241
+
242
+
243
+ ARTICLE 20 - Privacy
244
+ 20.1 All information about our privacy policy are provided on www.parrot.com . This policy explains how PARROT treats any personal data which are disclosed to her and protect your privacy.
245
+
246
+ 20.2 The Developer†agrees that PARROT may use its personal data in compliance with its privacy policy.
247
+
248
+
249
+ ARTICLE 21†ñ Acceptance of the license
250
+ By clicking the acceptance box, downloading or using the PARROT SDK and†APIs or an adapted or modified release of the PARROT SDK and†APIs, the Developer or any user accepts without reserve all terms and conditions of the License concluded between him and PARROT SA ñ registered under N∞ 394†149†496 and located 174 quai de Jemmapes FRANCE - which he commits to respect.
251
+
252
+
253
+
254
+ Last update: June 2011
255
+ Document revision V2.1
256
+
257
+
258
+
259
+
260
+ 1
261
+
262
+ PARROT SA ñ Capital 1†961†863,21 Ä - RCS B 394†149†496 ñ 174 QUAI DE JEMMAPES 75010 FRANCE
@@ -0,0 +1,13 @@
1
+ ARbDrone
2
+ ========
3
+
4
+ Ruby Library for the Parrot AR.Drone
5
+ ------------------------------------
6
+
7
+ ARbDrone is a native Ruby implementation of the protocols necessary to control
8
+ the [Parrot AR.Drone](http://ardrone.parrot.com/).
9
+
10
+ This library is brand new and will take some time to mature. Current work
11
+ is focused around the flight control commands and navdata. Video support
12
+ is not likely to appear for some time.
13
+
@@ -0,0 +1,14 @@
1
+ # -*- ruby -*-
2
+ ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin spec).join(File::PATH_SEPARATOR)}"
3
+
4
+ require 'rubygems'
5
+ require 'bundler/gem_tasks'
6
+ require 'bundler/setup'
7
+
8
+ task :default => :spec
9
+ task :gem => :build
10
+
11
+ require 'rspec/core/rake_task'
12
+ RSpec::Core::RakeTask.new
13
+
14
+
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "arbdrone/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "arbdrone"
7
+ s.version = ARbDrone::Version::STRING
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ben Klang"]
10
+ s.email = "ben@alkaloid.net"
11
+ s.homepage = "https://github.com/bklang/ARbDrone"
12
+ s.summary = "Ruby library for controlling the AR.Drone"
13
+ s.description = "Ruby library for controlling the AR.Drone"
14
+ s.date = Date.today.to_s
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # Runtime dependencies
22
+ s.add_runtime_dependency "bundler", [">= 1.0.10"]
23
+ s.add_runtime_dependency "eventmachine"
24
+ s.add_runtime_dependency "rake"
25
+ s.add_runtime_dependency "pry"
26
+ s.add_runtime_dependency "pcap"
27
+
28
+ # Development dependencies
29
+ s.add_development_dependency 'rspec', [">= 2.4.0"]
30
+ s.add_development_dependency 'flexmock'
31
+ s.add_development_dependency 'rake'
32
+ s.add_development_dependency 'simplecov'
33
+ s.add_development_dependency 'simplecov-rcov'
34
+ s.add_development_dependency 'ci_reporter'
35
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ require 'arbdrone'
3
+ require 'pry'
4
+
5
+ drone = ARbDrone.new :listen_ip => '192.168.1.2'
6
+ Thread.new do
7
+ begin
8
+ drone.run
9
+ rescue => e
10
+ puts "EM Exception: #{e.message}"
11
+ puts e.backtrace.join("\n")
12
+ end
13
+ end
14
+
15
+ drone.pry
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+ require 'arbdrone/nav_data.rb'
4
+ require 'pcap'
5
+
6
+ include ARbDrone::NavData
7
+ include Pcap
8
+
9
+ # TODO: Allow configuring a live network capture by specifying an interface
10
+ cap = Capture.open_offline ARGV[0]
11
+
12
+ # Dummy values
13
+ setup 0, 0
14
+
15
+ cap.each do |p|
16
+ if p.udp?
17
+ if p.ip_src.to_s == '192.168.1.1' && p.udp_sport == 5554
18
+ receive_data p.udp_data
19
+ end
20
+ if p.ip_dst.to_s == '192.168.1.1' && p.udp_dport == 5556
21
+ puts p.udp_data.gsub(/\r/, "\n") unless p.udp_data =~ /^AT\*REF=\d+,\d+\r$/
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,61 @@
1
+ require 'eventmachine'
2
+ require 'ipaddr'
3
+ require 'arbdrone/control'
4
+ require 'arbdrone/tcp_control'
5
+ require 'arbdrone/nav_data'
6
+
7
+ class ARbDrone
8
+ attr_accessor :control, :control_config, :navdata
9
+
10
+ def initialize(options = {})
11
+ @drone_ip = options.delete(:drone_ip) || '192.168.1.1'
12
+ @drone_firmware_port = options.delete(:drone_firmware_port) || 5551
13
+ @drone_navdata_port = options.delete(:drone_navdata_port) || 5554
14
+ @drone_video_port = options.delete(:drone_video_port) || 5555
15
+ @drone_control_port = options.delete(:drone_control_port) || 5556
16
+ @drone_raw_capture_port = options.delete(:drone_raw_capture_port) || 5557 # unused? tcp?
17
+ @drone_tcp_console_port = options.delete(:drone_tcp_console_port) || 5558 # unused?
18
+ @drone_tcp_control_port = options.delete(:drone_tcp_control_port) || 5559
19
+ @listen_ip = options.delete(:listen_ip) || '0.0.0.0'
20
+ end
21
+
22
+ def run
23
+ EventMachine.run do
24
+ @control = run_control
25
+ @control_config = run_control_config
26
+ @navdata = run_navdata
27
+ end
28
+ end
29
+
30
+ def run_control
31
+ connection = EventMachine.open_datagram_socket @listen_ip, @drone_control_port, Control
32
+ connection.setup @drone_ip, @drone_control_port
33
+
34
+ # Send messages every 20ms to ensure we stay connected to the Drone
35
+ @control_timer = EventMachine.add_periodic_timer 0.02 do
36
+ connection.send_queued_messages
37
+ end
38
+ connection
39
+ end
40
+
41
+ def run_control_config
42
+ connection = EventMachine.connect @drone_ip, @drone_tcp_control_port, TcpControl
43
+ connection.control_channel = @control
44
+ connection
45
+ end
46
+
47
+ def stop_control
48
+ @control.land
49
+ @control_timer.cancel
50
+ end
51
+
52
+ def run_navdata
53
+ # We have to bind the socket to 0.0.0.0 so we can receive multicast packets
54
+ connection = EventMachine.open_datagram_socket '0.0.0.0', @drone_navdata_port, NavData
55
+ connection.setup @drone_ip, @drone_navdata_port
56
+ ip = IPAddr.new('224.1.1.1').hton + IPAddr.new(@listen_ip).hton
57
+ connection.set_sock_opt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ip)
58
+ connection.send_initial_message
59
+ connection
60
+ end
61
+ end
@@ -0,0 +1,167 @@
1
+ require 'socket'
2
+ require 'thread'
3
+ require 'etc'
4
+
5
+ class ARbDrone
6
+ module Control
7
+
8
+ # With SDK version 1.5, only bits 8 and 9 are used in the
9
+ # control bit-field. Bits 18, 20, 22, 24 and 28 should be
10
+ # set to 1. Other bits should be set to 0.
11
+ REF_CONST = 290717696
12
+
13
+ CONTROL_MODES = {
14
+ :none => 0, # Doing nothing
15
+ :ardone_update => 1, # Deprecated - AR.Drone software update reception (update is done next run). After event completion, card should be powered off.
16
+ :pic_update => 2, # AR.Drone PIC software update reception (update is done next run)
17
+ :get_log => 3, # Send previous run's logs
18
+ :get_cfg => 4, # Send active configuration file to a client through the 'control' TCP socket
19
+ :ack => 5, # Reset command mask in NavData
20
+ :custom_cfg_get => 6, # Send list of custom configuration IDs
21
+ }
22
+
23
+ attr_accessor :seq
24
+
25
+ def setup(drone_ip, drone_control_port, options = {})
26
+ @drone_ip, @drone_control_port = drone_ip, drone_control_port
27
+ @send_queue = []
28
+ @send_mutex = Mutex.new
29
+
30
+ @application_id = options.delete(:application_id) || 'ARbDrone'
31
+ @user_id = options.delete(:user_id) || Etc.getlogin
32
+ @session_id = options.delete(:session_id) || "#{Socket.gethostname}:#{$$}"
33
+
34
+ # FIXME: Do we want to send these commands? These are not well documented.
35
+ # The following three lines are sent by the Linux example utility, ardrone_navigation
36
+ # as the first three messages sent to the drone at initialization.
37
+ #push format_cmd 'AT*PMODE', 2
38
+ #push format_cmd 'AT*MISC', '2,20,2000,3000'
39
+ #hover
40
+
41
+ # Inform the Drone who we are
42
+ config_ids @session_id, @user_id, @application_id
43
+
44
+ # Invalidate all other controller sessions
45
+ set_option 'custom:session_id', '-all'
46
+ end
47
+
48
+ def push(msg)
49
+ @send_queue << msg
50
+ end
51
+ alias :<< :push
52
+
53
+ def send_queued_messages
54
+ msg = ''
55
+ until (@send_queue.empty? || (msg.length + @send_queue.first.length) >= 1024) do
56
+ msg << @send_queue.shift
57
+ end
58
+ if msg.empty?
59
+ send_datagram state_msg, @drone_ip, @drone_control_port
60
+ else
61
+ # Send control input
62
+ @send_mutex.synchronize do
63
+ send_datagram(msg, @drone_ip, @drone_control_port) unless msg.empty?
64
+ end
65
+ end
66
+ end
67
+
68
+ def next_seq
69
+ @seq = @seq.nil? ? 1 : @seq + 1
70
+ end
71
+
72
+ def format_cmd(cmd, data = nil)
73
+ "#{cmd}=#{next_seq},#{data}\r"
74
+ end
75
+
76
+ def toggle_state
77
+ push format_cmd *ref(1<<8)
78
+ end
79
+
80
+ def takeoff
81
+ # Bit 9 is 1 for takeoff
82
+ @drone_state |= 1 << 9
83
+ end
84
+
85
+ def land
86
+ @drone_state = 0
87
+ end
88
+
89
+ def hover
90
+ # Set bit zero to zero to make the drone enter hovering mode
91
+ flags = 0
92
+ push format_cmd *pcmd(flags, 0, 0, 0, 0)
93
+ end
94
+
95
+ def steer(phi, theta, gaz, yaw)
96
+ # Set bit zero to one to make the drone process inputs
97
+ flags = 1 << 0
98
+ push format_cmd *pcmd(flags, phi, theta, gaz, yaw)
99
+ end
100
+
101
+ def reset_trim
102
+ push format_cmd 'AT*FTRIM'
103
+ end
104
+
105
+ def config_ids(sess_id, user_id, app_id)
106
+ push format_cmd 'AT*CONFIG_IDS', "#{sess_id},#{user_id},#{app_id}"
107
+ end
108
+
109
+ def set_option(name, value)
110
+ push format_cmd 'AT*CONFIG', "\"#{name}\",\"#{value}\""
111
+ end
112
+
113
+ def drone_control(mode, something = 0)
114
+ # FIXME: What is the purpose of the second argument?
115
+ push format_cmd 'AT*CTRL', "#{mode},#{something}"
116
+ end
117
+
118
+ def heartbeat
119
+ push format_cmd 'AT*COMWDG'
120
+ end
121
+
122
+ def blink(animation, frequency, duration)
123
+ push format_cmd 'AT*LED', "#{animation},#{float2int frequency},#{duration}"
124
+ end
125
+
126
+ def dance(animation, duration)
127
+ push format_cmd 'AT*ANIM', "#{animation},#{duration}"
128
+ end
129
+
130
+ def ref(input)
131
+ ['AT*REF', input |= REF_CONST]
132
+ end
133
+
134
+ # Used primarily to keep the control connection alive
135
+ # The drone expects a packet at least every 50ms or it
136
+ # triggers the watchdog. After 2 seconds the connection
137
+ # is considered lost.
138
+ def state_msg
139
+ format_cmd *ref(@drone_state)
140
+ end
141
+
142
+ def float2int(float)
143
+ [float.to_f].pack('e').unpack('l').first
144
+ end
145
+
146
+ def pcmd(flags, phi, theta, gaz, yaw)
147
+ values = [flags]
148
+
149
+ # Ensure the inputs do not exceed [-1.0, 1.0]
150
+ phi, theta, gaz, yaw = minmax -1.0, 1.0, phi, theta, gaz, yaw
151
+
152
+ # Convert the values to IEEE 754, then cast to a signed int
153
+ values += [phi, theta, gaz, yaw].map { |v|
154
+ float2int v
155
+ }
156
+ ['AT*PCMD', values.join(',')]
157
+ end
158
+
159
+ def shutdown!
160
+ @seq = nil
161
+ end
162
+
163
+ def minmax(min, max, *args)
164
+ args.map {|arg| arg < min ? min : arg > max ? max : arg }
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,122 @@
1
+ class ARbDrone
2
+ module NavData
3
+ attr_accessor :drone_state
4
+
5
+ TAGS = {
6
+ 0 => :demo,
7
+ 16 => :vision_detected,
8
+ 18 => :iphone_angles,
9
+ 0xFFFF => :checksum,
10
+ }
11
+
12
+ STATE = {
13
+ :flying => 1 << 0, # FLY MASK : (0) mykonos is landed, (1) mykonos is flying
14
+ :video => 1 << 1, # VIDEO MASK : (0) video disable, (1) video enable
15
+ :vision => 1 << 2, # VISION MASK : (0) vision disable, (1) vision enable
16
+ :control => 1 << 3, # CONTROL ALGO : (0) euler angles control, (1) angular speed control
17
+ :altitude => 1 << 4, # ALTITUDE CONTROL ALGO : (0) altitude control inactive (1) altitude control active
18
+ :user_feedback_start => 1 << 5, # USER feedback : Start button state
19
+ :command => 1 << 6, # Control command ACK : (0) None, (1) one received
20
+ :trim_command => 1 << 7, # Trim command ACK : (0) None, (1) one received
21
+ :trim_running => 1 << 8, # Trim running : (0) none, (1) running
22
+ :trim_result => 1 << 9, # Trim result : (0) failed, (1) succeeded
23
+ :navdata_demo => 1 << 10, # Navdata demo : (0) All navdata, (1) only navdata demo
24
+ :navdata_bootstrap => 1 << 11, # Navdata bootstrap : (0) options sent in all or demo mode, (1) no navdata options sent
25
+ :motors_brushed => 1 << 12, # Motors brushed : (0) brushless, (1) brushed
26
+ :com_lost => 1 << 13, # Communication Lost : (1) com problem, (0) Com is ok
27
+ :gyros_zero => 1 << 14, # Bit means that there's an hardware problem with gyrometers
28
+ :vbat_low => 1 << 15, # VBat low : (1) too low, (0) Ok
29
+ :vbat_high => 1 << 16, # VBat high (US mad) : (1) too high, (0) Ok
30
+ :timer_elapsed => 1 << 17, # Timer elapsed : (1) elapsed, (0) not elapsed
31
+ :not_enough_power => 1 << 18, # Power : (0) Ok, (1) not enough to fly
32
+ :angles_out_of_range => 1 << 19, # Angles : (0) Ok, (1) out of range
33
+ :wind => 1 << 20, # Wind : (0) Ok, (1) too much to fly
34
+ :ultrasound => 1 << 21, # Ultrasonic sensor : (0) Ok, (1) deaf
35
+ :cutout => 1 << 22, # Cutout system detection : (0) Not detected, (1) detected
36
+ :pic_version => 1 << 23, # PIC Version number OK : (0) a bad version number, (1) version number is OK
37
+ :atcodec_thread_on => 1 << 24, # ATCodec thread ON : (0) thread OFF (1) thread ON
38
+ :navdata_thread_on => 1 << 25, # Navdata thread ON : (0) thread OFF (1) thread ON
39
+ :video_thread_on => 1 << 26, # Video thread ON : (0) thread OFF (1) thread ON
40
+ :acq_thread_on => 1 << 27, # Acquisition thread ON : (0) thread OFF (1) thread ON
41
+ :ctrl_watchdog => 1 << 28, # CTRL watchdog : (1) delay in control execution (> 5ms), (0) control is well scheduled
42
+ :adc_watchdog => 1 << 29, # ADC Watchdog : (1) delay in uart2 dsr (> 5ms), (0) uart2 is good
43
+ :com_watchdog => 1 << 30, # Communication Watchdog : (1) com problem, (0) Com is ok
44
+ :emergency => 1 << 31, # Emergency landing : (0) no emergency, (1) emergency
45
+ }
46
+
47
+
48
+ def setup(drone_ip, drone_navdata_port)
49
+ @drone_ip, @drone_navdata_port = drone_ip, drone_navdata_port
50
+ @drone_state = 0
51
+ end
52
+
53
+ # Wake up the drone to start sending us navdata
54
+ def send_initial_message
55
+ send_datagram 1, @drone_ip, @drone_navdata_port
56
+ end
57
+
58
+ def receive_data(msg)
59
+ last_state = @drone_state
60
+
61
+ ptr = 0
62
+ @header, @drone_state, @seq, @vision_flag = msg[ptr,16].unpack('VVVV')
63
+ ptr += 16
64
+
65
+ compare_states last_state, @drone_state
66
+
67
+ options = []
68
+ while ptr < msg.length
69
+ option_id = msg[ptr,2].unpack('v').first
70
+ ptr += 2
71
+
72
+ length = msg[ptr,2].unpack('v').first
73
+ ptr += 2
74
+
75
+ # Length appears to be number of 16-bit ints
76
+ data = msg[ptr, length*2]
77
+ ptr += length*2
78
+
79
+ unless TAGS.keys.include?(option_id)
80
+ puts "Found invalid options id: 0x%x" % option_id.inspect
81
+ next
82
+ end
83
+
84
+ unless length > 0
85
+ puts "Found option with invalid 0 length"
86
+ break
87
+ end
88
+
89
+ #puts "Decoded option #{TAGS[option_id]} with value #{data.inspect}"
90
+ options.push :id => option_id, :length => length, :data => data
91
+ end
92
+ # Checksum is always the last option sent
93
+ checksum = options.last
94
+ # FIXME: Verify message checksum
95
+ end
96
+
97
+ def compare_states old_state, new_state
98
+ unless old_state == new_state
99
+ diff = old_state ^ new_state
100
+ changes = []
101
+ STATE.each {|k,v| changes << "#{k} is now #{new_state & STATE[k] > 0 ? 1 : 0}" if diff & STATE[k] > 0}
102
+ puts "-----------\n#{changes.join("\n")}\n-----------\n"
103
+ end
104
+ end
105
+
106
+ def in_bootstrap?
107
+ @drone_state & STATE[:navdata_bootstrap] > 0
108
+ end
109
+
110
+ def is_flying?
111
+ @drone_state & STATE[:flying] > 0
112
+ end
113
+
114
+ def communications_lost?
115
+ @drone_state & STATE[:com_lost] > 0
116
+ end
117
+
118
+ def altitute_limited?
119
+ @drone_state & STATE[:altitude] > 0
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,18 @@
1
+ class ARbDrone
2
+ module TcpControl
3
+ attr_accessor :control_channel
4
+ attr_reader :control_data
5
+
6
+ def post_init
7
+
8
+ end
9
+
10
+ def receive_data(msg)
11
+ # TODO: This data will require several packets until it is fully transmitted.
12
+ # Looking at packet captures it looks like the end is signalled by a period
13
+ # on a line by itself.
14
+ @control_data ||= ''
15
+ @control_data << msg
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ class ARbDrone
2
+ class Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ REV = 1
6
+
7
+ STRING = "#{MAJOR}.#{MINOR}.#{REV}"
8
+ end
9
+ end
@@ -0,0 +1,179 @@
1
+ require 'spec_helper'
2
+ require 'arbdrone/control'
3
+
4
+ class Drone
5
+ include ARbDrone::Control
6
+ end
7
+
8
+ describe ARbDrone::Control do
9
+ before :each do
10
+ @drone = Drone.new
11
+ end
12
+
13
+ after :each do
14
+ @drone = nil
15
+ end
16
+
17
+ describe '#next_seq' do
18
+ it 'should default the sequence number to 1' do
19
+ drone = Drone.new
20
+ drone.next_seq.should == 1
21
+ end
22
+
23
+ it 'should increment the sequence number on subsequent calls' do
24
+ drone = Drone.new
25
+ drone.next_seq.should == 1
26
+ seq = drone.next_seq
27
+ seq.should > 1
28
+ seq_again = drone.next_seq
29
+ seq_again.should > seq
30
+ end
31
+ end
32
+
33
+ describe '#format_cmd' do
34
+ before :each do
35
+ @drone.seq = nil
36
+ end
37
+
38
+ it 'should append a sequence number and newline after each statement' do
39
+ @drone.format_cmd('AT*FAKE').should == "AT*FAKE=1,\n"
40
+ end
41
+
42
+ it 'should format a data argument correctly' do
43
+ @drone.format_cmd('AT*FAKE', '"name","value"').should == "AT*FAKE=1,\"name\",\"value\"\n"
44
+ end
45
+
46
+ it 'should properly increment the sequence number' do
47
+ @drone.format_cmd('AT*FAKE', '"name","value"').should == "AT*FAKE=1,\"name\",\"value\"\n"
48
+ @drone.format_cmd('AT*FAKE', '1,2,3').should == "AT*FAKE=2,1,2,3\n"
49
+ @drone.format_cmd('AT*FAKE', '"name","value"').should == "AT*FAKE=3,\"name\",\"value\"\n"
50
+ end
51
+ end
52
+
53
+ describe '#ref' do
54
+ before :each do
55
+ @flags = 1 << 18
56
+ @flags |= 1 << 20
57
+ @flags |= 1 << 22
58
+ @flags |= 1 << 24
59
+ @flags |= 1 << 28
60
+
61
+ # Reset the sequence number on each iteration.
62
+ @drone.seq = nil
63
+ end
64
+
65
+ it 'should set the constant bits in the input' do
66
+ @drone.ref(0).should == ['AT*REF', @flags]
67
+ end
68
+
69
+ it 'should preserve input bits' do
70
+ input = 1 << 8
71
+ flags = @flags | input
72
+ @drone.ref(input).should == ['AT*REF', flags]
73
+ end
74
+
75
+ it 'should increment the sequence number on subsequent calls' do
76
+ @drone.ref(0).should == ['AT*REF', @flags]
77
+ @drone.ref(0).should == ['AT*REF', @flags]
78
+ @drone.ref(0).should == ['AT*REF', @flags]
79
+ end
80
+ end
81
+
82
+ describe "#pcmd" do
83
+ before :each do
84
+ # Reset the sequence number on each iteration.
85
+ @drone.seq = nil
86
+ end
87
+
88
+ it 'should format the arguments' do
89
+ @drone.pcmd(1, -0.9, -0.5, 0.2, 0.7).should == ['AT*PCMD', '1,-1083808154,-1090519040,1045220557,1060320051']
90
+ end
91
+
92
+ it 'should limit inputs that exceed the min/max' do
93
+ @drone.pcmd(1, -1.9, -1.5, 1.2, 1.7).should == ['AT*PCMD', '1,-1082130432,-1082130432,1065353216,1065353216']
94
+ end
95
+ end
96
+
97
+ describe '#minmax' do
98
+ it 'should appropriately cap minimum values' do
99
+ @drone.minmax(-1.0, 0, -1.5).should == [-1.0]
100
+ end
101
+
102
+ it 'should appropriately cap maximum values' do
103
+ @drone.minmax(0, 1.0, 1.5).should == [1.0]
104
+
105
+ end
106
+
107
+ it 'should preserve valid values' do
108
+ @drone.minmax(-1.0, 1.0, 0.5).should == [0.5]
109
+ end
110
+
111
+ it 'should process multiple values' do
112
+ @drone.minmax(-1.0, 1.0, -1.5, -0.5, 1.5).should == [-1.0, -0.5, 1.0]
113
+ end
114
+ end
115
+
116
+ describe '#takeoff' do
117
+ before :each do
118
+ # Reset the sequence number on each iteration.
119
+ @drone.seq = nil
120
+ end
121
+
122
+ it 'should generate the correct command' do
123
+ @drone.takeoff.should == "AT*REF=1,290718208\n"
124
+ end
125
+ end
126
+
127
+ describe '#land' do
128
+ before :each do
129
+ @drone.seq = nil
130
+ end
131
+
132
+ it 'should generate the correct command' do
133
+ @drone.land.should == "AT*REF=1,290717696\n"
134
+ end
135
+ end
136
+
137
+ describe '#steer' do
138
+ it 'should generate the correct command' do
139
+ flexmock(@drone).should_receive(:pcmd).once.with(1, 0.5, 0.2, -0.1, -0.3).and_return ['AT*PCMD', '1,0,0,0,0']
140
+ @drone.steer 0.5, 0.2, -0.1, -0.3
141
+ end
142
+ end
143
+
144
+ describe '#hover' do
145
+ it 'should generate the correct command' do
146
+ @drone.hover.should == "AT*PCMD=1,0,0,0,0,0\n"
147
+ end
148
+ end
149
+
150
+ describe '#reset_trim' do
151
+ it 'should generate the correct command' do
152
+ @drone.reset_trim.should == "AT*FTRIM=1,\n"
153
+ end
154
+ end
155
+
156
+ describe '#heartbeat' do
157
+ it 'should generate the correct command' do
158
+ @drone.heartbeat.should == "AT*COMWDG=1,\n"
159
+ end
160
+ end
161
+
162
+ describe '#blink' do
163
+ it 'should generate the correct command' do
164
+ @drone.blink(2,3,4).should == "AT*LED=1,2,3,4\n"
165
+ end
166
+ end
167
+
168
+ describe '#dance' do
169
+ it 'should generate the correct command' do
170
+ @drone.dance(2,3).should == "AT*ANIM=1,2,3\n"
171
+ end
172
+ end
173
+
174
+ describe '#set_option' do
175
+ it 'should enclose variable names and values in double-quotes' do
176
+ @drone.set_option('name', 'value').should == "AT*CONFIG=1,\"name\",\"value\"\n"
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,20 @@
1
+ Dir.chdir File.join(File.dirname(__FILE__), '..')
2
+ $:.push('.')
3
+ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $: << File.dirname(__FILE__)
5
+
6
+ %w{
7
+ bundler/setup
8
+ rspec/core
9
+ flexmock/rspec
10
+ }.each { |f| require f }
11
+
12
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
13
+
14
+ RSpec.configure do |config|
15
+ config.mock_framework = :flexmock
16
+ config.filter_run :focus => true
17
+ config.run_all_when_everything_filtered = true
18
+ config.color_enabled = true
19
+ end
20
+
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arbdrone
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ben Klang
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-27 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: &70937070 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.10
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70937070
26
+ - !ruby/object:Gem::Dependency
27
+ name: eventmachine
28
+ requirement: &70936350 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *70936350
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ requirement: &70935480 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70935480
48
+ - !ruby/object:Gem::Dependency
49
+ name: pry
50
+ requirement: &70935210 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *70935210
59
+ - !ruby/object:Gem::Dependency
60
+ name: pcap
61
+ requirement: &70934790 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :runtime
68
+ prerelease: false
69
+ version_requirements: *70934790
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: &70934290 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.4.0
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *70934290
81
+ - !ruby/object:Gem::Dependency
82
+ name: flexmock
83
+ requirement: &70933800 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *70933800
92
+ - !ruby/object:Gem::Dependency
93
+ name: rake
94
+ requirement: &70932920 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *70932920
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov
105
+ requirement: &70932620 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: *70932620
114
+ - !ruby/object:Gem::Dependency
115
+ name: simplecov-rcov
116
+ requirement: &70932310 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: *70932310
125
+ - !ruby/object:Gem::Dependency
126
+ name: ci_reporter
127
+ requirement: &70932010 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: *70932010
136
+ description: Ruby library for controlling the AR.Drone
137
+ email: ben@alkaloid.net
138
+ executables:
139
+ - arbdrone
140
+ - pcap-trace.rb
141
+ extensions: []
142
+ extra_rdoc_files: []
143
+ files:
144
+ - Gemfile
145
+ - LICENSE
146
+ - PARROT_LICENSE
147
+ - README.markdown
148
+ - Rakefile
149
+ - arbdrone.gemspec
150
+ - bin/arbdrone
151
+ - bin/pcap-trace.rb
152
+ - lib/arbdrone.rb
153
+ - lib/arbdrone/control.rb
154
+ - lib/arbdrone/nav_data.rb
155
+ - lib/arbdrone/tcp_control.rb
156
+ - lib/arbdrone/version.rb
157
+ - spec/arbdrone/control_spec.rb
158
+ - spec/spec_helper.rb
159
+ has_rdoc: true
160
+ homepage: https://github.com/bklang/ARbDrone
161
+ licenses: []
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ segments:
173
+ - 0
174
+ hash: 895418991
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ segments:
182
+ - 0
183
+ hash: 895418991
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 1.6.2
187
+ signing_key:
188
+ specification_version: 3
189
+ summary: Ruby library for controlling the AR.Drone
190
+ test_files: []