isar 1.19.1__py3-none-any.whl → 1.20.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,533 @@
1
+ Metadata-Version: 2.1
2
+ Name: isar
3
+ Version: 1.20.2
4
+ Summary: Integration and Supervisory control of Autonomous Robots
5
+ Author-email: Equinor ASA <fg_robots_dev@equinor.com>
6
+ License: Eclipse Public License version 2.0
7
+
8
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
9
+
10
+ 1. DEFINITIONS
11
+ “Contribution” means:
12
+
13
+ a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and
14
+ b) in the case of each subsequent Contributor:
15
+ i) changes to the Program, and
16
+ ii) additions to the Program;
17
+ where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works.
18
+ “Contributor” means any person or entity that Distributes the Program.
19
+
20
+ “Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
21
+
22
+ “Program” means the Contributions Distributed in accordance with this Agreement.
23
+
24
+ “Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors.
25
+
26
+ “Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
27
+
28
+ “Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof.
29
+
30
+ “Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy.
31
+
32
+ “Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files.
33
+
34
+ “Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor.
35
+
36
+ 2. GRANT OF RIGHTS
37
+ a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works.
38
+ b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
39
+ c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
40
+ d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
41
+ e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3).
42
+ 3. REQUIREMENTS
43
+ 3.1 If a Contributor Distributes the Program in any form, then:
44
+
45
+ a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and
46
+ b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:
47
+ i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
48
+ ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
49
+ iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and
50
+ iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.
51
+ 3.2 When the Program is Distributed as Source Code:
52
+
53
+ a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and
54
+ b) a copy of this Agreement must be included with each copy of the Program.
55
+ 3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.
56
+
57
+ 4. COMMERCIAL DISTRIBUTION
58
+ Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
59
+
60
+ For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
61
+
62
+ 5. NO WARRANTY
63
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
64
+
65
+ 6. DISCLAIMER OF LIABILITY
66
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
67
+
68
+ 7. GENERAL
69
+ If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
70
+
71
+ If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
72
+
73
+ All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
74
+
75
+ Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version.
76
+
77
+ Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
78
+
79
+ Exhibit A – Form of Secondary Licenses Notice
80
+ “This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.”
81
+
82
+ Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses.
83
+
84
+ If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
85
+
86
+ You may add additional accurate notices of copyright ownership.
87
+
88
+ Project-URL: repository, https://github.com/equinor/isar.git
89
+ Classifier: Intended Audience :: Developers
90
+ Classifier: Intended Audience :: Science/Research
91
+ Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
92
+ Classifier: Natural Language :: English
93
+ Classifier: Programming Language :: Python :: 3
94
+ Classifier: Programming Language :: Python :: 3.11
95
+ Classifier: Programming Language :: Python :: 3.12
96
+ Classifier: Topic :: Scientific/Engineering
97
+ Classifier: Topic :: Scientific/Engineering :: Physics
98
+ Classifier: Topic :: Software Development :: Libraries
99
+ Requires-Python: >=3.11
100
+ Description-Content-Type: text/markdown
101
+ License-File: LICENSE
102
+ Requires-Dist: alitra >=1.1.3
103
+ Requires-Dist: azure-identity
104
+ Requires-Dist: azure-keyvault-secrets
105
+ Requires-Dist: azure-storage-blob
106
+ Requires-Dist: backoff
107
+ Requires-Dist: click
108
+ Requires-Dist: dacite
109
+ Requires-Dist: fastapi-azure-auth
110
+ Requires-Dist: fastapi
111
+ Requires-Dist: injector
112
+ Requires-Dist: numpy
113
+ Requires-Dist: opencensus-ext-azure
114
+ Requires-Dist: opencensus-ext-logging
115
+ Requires-Dist: opencensus-ext-requests
116
+ Requires-Dist: paho-mqtt
117
+ Requires-Dist: pydantic-settings
118
+ Requires-Dist: pydantic
119
+ Requires-Dist: PyJWT
120
+ Requires-Dist: python-dotenv
121
+ Requires-Dist: PyYAML
122
+ Requires-Dist: requests-toolbelt
123
+ Requires-Dist: requests
124
+ Requires-Dist: transitions
125
+ Requires-Dist: uvicorn
126
+ Provides-Extra: dev
127
+ Requires-Dist: black ; extra == 'dev'
128
+ Requires-Dist: flake8 ; extra == 'dev'
129
+ Requires-Dist: mypy ; extra == 'dev'
130
+ Requires-Dist: myst-parser ; extra == 'dev'
131
+ Requires-Dist: pip-tools ; extra == 'dev'
132
+ Requires-Dist: pre-commit ; extra == 'dev'
133
+ Requires-Dist: pytest-dotenv ; extra == 'dev'
134
+ Requires-Dist: pytest-mock ; extra == 'dev'
135
+ Requires-Dist: pytest-xdist ; extra == 'dev'
136
+ Requires-Dist: pytest ; extra == 'dev'
137
+ Requires-Dist: requests-mock ; extra == 'dev'
138
+ Requires-Dist: sphinx ; extra == 'dev'
139
+
140
+ # ISAR
141
+
142
+ [![Python package](https://github.com/equinor/isar/actions/workflows/pythonpackage.yml/badge.svg)](https://github.com/equinor/isar/actions/workflows/pythonpackage.yml)
143
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
144
+ [![License](https://img.shields.io/badge/License-EPL_2.0-blue.svg)](https://opensource.org/licenses/EPL-2.0)
145
+
146
+ ISAR - Integration and Supervisory control of Autonomous Robots - is a tool for integrating robot applications into
147
+ operator systems. Through the ISAR API you can send commands to a robot to do missions and collect results from the
148
+ missions.
149
+
150
+ ## Getting started
151
+
152
+ Steps:
153
+
154
+ - Install
155
+ - Integrate a robot
156
+ - Run the ISAR server
157
+ - Run a robot mission
158
+
159
+ ### Install
160
+
161
+ For local development, please fork the repository. Then, clone and install in the repository root folder:
162
+
163
+ ```
164
+ git clone https://github.com/<path_to_parent>/isar
165
+ cd isar
166
+ pip install -e .[dev]
167
+ ```
168
+
169
+ For `zsh` you might have to type `".[dev]"`
170
+
171
+ Verify that you can run the tests:
172
+
173
+ ```bash
174
+ pytest .
175
+ ```
176
+
177
+ The repository contains a configuration file for installing pre-commit hooks. Currently, [black](https://github.com/psf/black) and a mirror of [mypy](https://github.com/pre-commit/mirrors-mypy) are configured hooks. Install with:
178
+
179
+ ```
180
+ pre-commit install
181
+ ```
182
+
183
+ Verify that pre-commit runs:
184
+
185
+ ```
186
+ pre-commit
187
+ ```
188
+
189
+ pre-commit will now run the installed hooks before code is commited to git. To turn pre-commit off, run:
190
+
191
+ ```
192
+ pre-commit uninstall
193
+ ```
194
+
195
+ ### Robot integration
196
+
197
+ To connect the state machine to a robot in a separate repository, it is required that the separate repository implements
198
+ the [robot interface](https://github.com/equinor/isar/blob/main/src/robot_interface/robot_interface.py).
199
+ The separate repository should also have a settings.env file in a config folder where `CAPABILITIES` and `ROBOT_MODEL` are set.
200
+ A mocked robot can be found in [this repository](https://github.com/equinor/isar-robot). Install the repo, i.e:
201
+
202
+ ```bash
203
+ pip install isar-robot
204
+ ```
205
+
206
+ NB: isar-robot has not been published to PyPi for some time, and needs to be downloaded directly
207
+ from git to work.
208
+
209
+ Then, ensure the `ISAR_ROBOT_PACKAGE` variable in [settings.env](./src/isar/config/settings.env)
210
+ is set to the name of the package you installed. `isar_robot` is set by default. See the section
211
+ for [configuration](#configuration) for overwriting configuration.
212
+
213
+ If you have the robot repository locally, you can simply install through
214
+
215
+ ```bash
216
+ pip install -e /path/to/robot/repo/
217
+ ```
218
+
219
+ #### Running ISAR with a robot simulator
220
+
221
+ A simulator based on the open source robot Turtlebot3 has been implemented for use with ISAR and may be
222
+ found [here](https://github.com/equinor/isar-turtlebot). Follow the installation instructions for the simulator and
223
+ install `isar-turtlebot` in the same manner as given in the [robot integration](#robot-integration) section. Overwrite
224
+ the following configuration variables:
225
+
226
+ ```bash
227
+ ISAR_ROBOT_PACKAGE = isar_turtlebot
228
+ ISAR_DEFAULT_MAP = turtleworld
229
+ ```
230
+
231
+ ### Run ISAR server
232
+
233
+ To run ISAR:
234
+
235
+ ```bash
236
+ python main.py
237
+ ```
238
+
239
+ Note, running the full system requires that an implementation of a robot has been installed. See
240
+ this [section](#robot-integration) for installing a mocked robot or a Turtlebot3 simulator.
241
+
242
+ ### Running a robot mission
243
+
244
+ Once the application has been started the swagger site may be accessed at
245
+
246
+ ```
247
+ http://localhost:3000/docs
248
+ ```
249
+
250
+ Execute the `/schedule/start-mission` endpoint with `mission_id=1` to run a mission.
251
+
252
+ In [this](./src/isar/config/predefined_missions) folder there are predefined default missions, for example the mission
253
+ corresponding to `mission_id=1`. A new mission may be added by adding a new json-file with a mission description. Note,
254
+ the mission IDs must be unique.
255
+
256
+ ### Running with docker-compose
257
+
258
+ ISAR may be started with an instance of the [isar-robot](https://github.com/equinor/isar-robot) package by
259
+
260
+ ```shell
261
+ docker-compose up --build
262
+ ```
263
+
264
+ Provided that the simulator from [isar-turtlebot](https://github.com/equinor/isar-turtlebot) is running ISAR may be
265
+ started with the turtlebot by
266
+
267
+ ```shell
268
+ docker-compose -f docker-compose-turtlebot.yml up --build
269
+ ```
270
+
271
+ ### Configuration
272
+
273
+ The system consists of many configuration variables which may alter the functionality. As an example, it is possible to
274
+ change mission planners or add multiple storage handlers as described in the [mission planner](#mission-planner)
275
+ and [storage](#storage) sections.
276
+
277
+ There are two methods of specifying configuration.
278
+
279
+ 1. Override the default value by setting an environment variable.
280
+
281
+ Every configuration variable is defined in [settings.py](./src/isar/config/settings.py), and they may all be
282
+ overwritten by specifying the variables in the environment instead. Note that the configuration variable must be
283
+ prefixed with `ISAR_` when specified in the environment. So for the `ROBOT_PACKAGE`configuration variable:
284
+
285
+ ```shell
286
+ export ISAR_ROBOT_PACKAGE=isar_turtlebot
287
+ ```
288
+
289
+ This means ISAR will connect to `isar_turtlebot` robot package.
290
+
291
+ 2. Adding environment variables through [settings.env](./src/isar/config/settings.env).
292
+
293
+ By adding environment variables with the prefix `ISAR_` to the [settings.env](./src/isar/config/settings.env) file
294
+ the configuration variables will be overwritten by the values in this file.
295
+
296
+ ### Running tests
297
+
298
+ After following the steps in [Development](#install), you can run the tests:
299
+
300
+ ```bash
301
+ pytest .
302
+ ```
303
+
304
+ To create an interface test in your robot repository, use the function `interface_test` from `robot_interface`. The
305
+ argument should be an interface object from your robot specific implementation.
306
+ See [isar-robot](https://github.com/equinor/isar-robot/blob/main/tests/interfaces/test_robotinterface.py) for example.
307
+
308
+ #### Integration tests
309
+
310
+ Integration tests can be found [here](https://github.com/equinor/isar/tree/main/tests/integration) and have been created
311
+ with a simulator in mind. The integration tests will not run as part of `pytest .` or as part of the CI/CD pipeline. To
312
+ run the integration tests please follow the instructions in [this section](#running-isar-with-a-robot-simulator) for
313
+ setting up the `isar-turtlebot` implementation with simulator and run the following command once the simulation has been
314
+ launched.
315
+
316
+ ```bash
317
+ pytest tests/integration
318
+ ```
319
+
320
+ Note that these tests will run towards the actual simulation (you may monitor it through Gazebo and RVIZ) and it will
321
+ take a long time.
322
+
323
+ ### Documentation
324
+
325
+ To build the project documentation, run the following commands:
326
+
327
+ ```bash
328
+ cd docs
329
+ make docs
330
+ ```
331
+
332
+ The documentation can now be viewed at `docs/build/html/index.html`.
333
+
334
+ ## Components
335
+
336
+ The system consists of two main components.
337
+
338
+ 1. State machine
339
+ 1. FastAPI
340
+
341
+ ### State machine
342
+
343
+ The state machine handles interaction with the robots API and monitors the execution of missions. It also enables
344
+ interacting with the robot before, during and after missions.
345
+
346
+ The state machine is based on the [transitions](https://github.com/pytransitions/transitions) package for Python. An visualization of the state machine can be seen below:
347
+ ![State Machine](./docs/state_machine_diagram.png)
348
+
349
+ In general the states
350
+
351
+ ```
352
+ States.Off,
353
+ States.Initialize,
354
+ States.Initiate,
355
+ States.Stop,
356
+ States.Monitor,
357
+ States.Paused,
358
+ ```
359
+
360
+ indicates that the state machine is already running. For running a mission the state machine need to be in the state
361
+
362
+ ```
363
+ States.Idle
364
+ ```
365
+
366
+ ### FastAPI
367
+
368
+ The FastAPI establishes an interface to the state machine for the user. As the API and state machine are separate
369
+ threads, they communicate through python queues. FastAPI runs on an ASGI-server, specifically uvicorn. The
370
+ FastAPI-framework is split into routers where the endpoint operations are defined.
371
+
372
+ ## Mission planner
373
+
374
+ The mission planner that is currently in use is a local mission planner, where missions are specified in a json file. You can create your own mission planner by implementing
375
+ the [mission planner interface](./src/isar/mission_planner/mission_planner_interface.py) and adding your planner to the
376
+ selection [here](./src/isar/modules.py). Note that you must add your module as an option in the dictionary.
377
+
378
+ ## Storage
379
+
380
+ The storage modules that are used is defined by the `ISAR_STORAGE` configuration variable. This can be changed by
381
+ overriding the configuration through an environment variable. It accepts a json encoded list and will use each element
382
+ in the list to retrieve the corresponding handler. The current options are
383
+
384
+ ```
385
+ ISAR_STORAGE = '["local", "blob", "slimm"]'
386
+ ```
387
+
388
+ Note that the `blob` and `slimm` options require special configuration to authenticate to these endpoints.
389
+
390
+ ### Implement your own storage module
391
+
392
+ You can create your own storage module by implementing the [storage interface](./src/isar/storage/storage_interface.py)
393
+ and adding your storage module to the selection [here](./src/isar/modules.py). Note that you must add your module as an
394
+ option in the dictionary.
395
+
396
+ ## Task selection
397
+
398
+ The tasks of a mission are selected based on a task selector module, defined by the `TASK_SELECTOR` configuration variable. The default task selector is `sequential`. When using the default module, tasks are executed in sequential order defined by the current input mission.
399
+
400
+ ### Implement you own task selector module
401
+
402
+ Custom task selector modules may be added by implementing additional versions of the [task selector interface](./src/isar/mission_planner/task_selector_interface.py).
403
+
404
+ For every custom module, the interface function `next_task()` must be implemented. All interface implementations by default have access to the list of tasks in the current mission through the member `self.tasks`, however additional variables may be supplied by adding arguments to `next_task()`. To comply with the interface definition, the function should return the next task upon every call, and raise the `TaskSelectorStop` exception when all tasks in the current mission have been completed:
405
+
406
+ ```python
407
+ class CustomTaskSelector(TaskSelectorInterface):
408
+ ...
409
+ def next_task(...) -> Task:
410
+
411
+ # Add code here
412
+ ...
413
+
414
+ # Raise `TaskSelectorStop` when all tasks have been completed
415
+ ...
416
+ ```
417
+
418
+ Optionally, the `initialize()` function may be extended by supplementing the parameter list or function body:
419
+
420
+ ```python
421
+ class CustomTaskSelector(TaskSelectorInterface):
422
+ ...
423
+ def initialize(self, tasks: List[Task], ...) -> None:
424
+ super.initialize(tasks=tasks)
425
+
426
+ # Add supplementary code here
427
+ ...
428
+ ```
429
+
430
+ A custom task selector may be made available during [module selection](./src/isar/modules.py) by adding it to the series of options in the dictionary of injector modules. It can then be activated by overriding the task selector configuration variable:
431
+
432
+ ```python
433
+ # Add custom task selector module to `modules.py`
434
+
435
+ class CustomTaskSelectorModule(Module):
436
+ @provider
437
+ @singleton
438
+ def provide_task_selector(self) -> TaskSelectorInterface:
439
+ return CustomTaskSelector()
440
+
441
+ ...
442
+
443
+ # Make it available to select during injector instantiation
444
+
445
+ modules: dict[str, tuple[Module, Union[str, bool]]] = {
446
+ ...
447
+ "task_selector": (
448
+ {
449
+ "sequential": SequentialTaskSelectorModule,
450
+ "custom": CustomTaskSelectorModule
451
+ }
452
+ ...
453
+ )
454
+ ...
455
+ }
456
+ ```
457
+
458
+ ## API authentication
459
+
460
+ The API has an option to include user authentication. This can be enabled by setting the environment variable
461
+
462
+ ```
463
+ ISAR_AUTHENTICATION_ENABLED = true
464
+ ```
465
+
466
+ By default, the `local` storage module is used and API authentication is disabled. If using Azure Blob Storage a set of
467
+ environment variables must be available which gives access to an app registration that may use the storage account.
468
+ Enabling API authentication also requires the same environment variables. The required variables are
469
+
470
+ ```
471
+ AZURE_CLIENT_ID
472
+ AZURE_TENANT_ID
473
+ AZURE_CLIENT_SECRET
474
+ ```
475
+
476
+ ## MQTT communication
477
+
478
+ ISAR is able to publish parts of its internal state to topics on an MQTT broker whenever they change. This is by default
479
+ turned off but may be activated by setting the environment variable
480
+
481
+ ```
482
+ ISAR_MQTT_ENABLED = true
483
+ ```
484
+
485
+ The connection to the broker will be determined by the following configuration values in `settings.py`
486
+
487
+ ```
488
+ ISAR_MQTT_USERNAME
489
+ ISAR_MQTT_HOST
490
+ ISAR_MQTT_PORT
491
+ ```
492
+
493
+ The default values of these are overwritten by the environment in `settings.env`.
494
+
495
+ To specify broker password, add the following environment variable to a .env file in the root of the repository:
496
+
497
+ ```
498
+ ISAR_MQTT_PASSWORD
499
+ ```
500
+
501
+ If not specified the password will default to an empty string.
502
+
503
+ ## Running several ISAR instances locally
504
+
505
+ To run several ISAR instances in parallel locally:
506
+
507
+ 1. Generate a guid: https://www.guidgenerator.com/
508
+ 2. Open a new terminal in the isar folder
509
+ 3. Run the following command before running main.py:
510
+
511
+ ```
512
+ export ISAR_API_PORT=port_name_higher_than_1024 ISAR_ISAR_ID=guid ISAR_ROBOT_NAME=random_robot_name
513
+ ```
514
+
515
+ # Dependencies
516
+
517
+ The dependencies used for this package are listed in `pyproject.toml` and pinned in `requirements.txt`. This ensures our builds are predictable and deterministic. This project uses `pip-compile` (from [`pip-tools`](https://github.com/jazzband/pip-tools)) for this:
518
+
519
+ ```
520
+ pip-compile --output-file=requirements.txt pyproject.toml
521
+ ```
522
+
523
+ To update the requirements to the latest versions, run the same command with the `--upgrade` flag:
524
+
525
+ ```
526
+ pip-compile --output-file=requirements.txt pyproject.toml --upgrade
527
+ ```
528
+
529
+ # Contributions
530
+
531
+ Equinor welcomes all kinds of contributions, including code, bug reports, issues, feature requests, and documentation
532
+ Please initiate your contribution by creating an [issue](https://github.com/equinor/isar/issues) or by forking the
533
+ project and making a pull requests. Commit messages shall be written according to [this guide](https://cbea.msgit-commit/).
@@ -1,10 +1,11 @@
1
- isar/__init__.py,sha256=vGRSvnHq6l7PIQJcAKYS-sM_YIl1D77m4SGMFjyX8lY,187
1
+ isar/__init__.py,sha256=cH8p8bVveu3FUL6kBhldcSlLaoHgD82Kd0-SwSNfGXw,87
2
2
  isar/modules.py,sha256=aO8bLSC4i_Qo4bOJ6aFfwAZRTJAw8o9SOOfkceUGCiU,6708
3
+ isar/script.py,sha256=145KXMqKWkP5SjB2MyvO1HmIPJnFOQdwwWM3jy6s-9A,5260
3
4
  isar/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
5
  isar/apis/api.py,sha256=vSXfkWR7iITWbh4BsDzjEDtQrz6KS-vi2S8AeaeDc3Q,13112
5
6
  isar/apis/models/__init__.py,sha256=NI1BYyN__Ogr00Qqe0XJ-9gEVPva2brXo2RJsbrS4tM,52
6
7
  isar/apis/models/models.py,sha256=BRm3Wl6TJHdHEKLRQ2SGDx6Y54qq8IesMbBuVO7RuxE,1757
7
- isar/apis/models/start_mission_definition.py,sha256=c2nX5Idll935fQ8vdF5hm9Ytblvw2uINBpZVl_VfFmw,6458
8
+ isar/apis/models/start_mission_definition.py,sha256=GuihnkVRXjzopMEiRQ4rOfeCGw98IFK9EYylB-5S0aI,7253
8
9
  isar/apis/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
10
  isar/apis/schedule/scheduling_controller.py,sha256=w2F-6IKBgVN9HVopAOWBb3KUgPjhsnuPLQ3eqjDNfOg,11888
10
11
  isar/apis/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -70,16 +71,16 @@ isar/state_machine/state_machine.py,sha256=-i7m2xVcgL3cW6AIMGAom97wzt433MXM8EQEG
70
71
  isar/state_machine/states_enum.py,sha256=BlrUcBWkM5K6D_UZXRwTaUgGpAagWmVZH6HhDBGzVU4,278
71
72
  isar/state_machine/states/__init__.py,sha256=kErbKPDTwNfCLijvdyN6_AuOqDwR23nu9F0Qovsnir4,218
72
73
  isar/state_machine/states/idle.py,sha256=_nrM17s4artaHezanl28_WcNyJod1_hkCyzAqZlPQiE,3034
73
- isar/state_machine/states/initialize.py,sha256=Vx7OxWZI_xEkRwHWFh9ymxK_7mDH0Wayt09dGGqBJWk,2359
74
- isar/state_machine/states/initiate.py,sha256=b0Fq3tN6TZMg5j4192OsYdGbphTXWCkftBsFX57mhrw,5652
75
- isar/state_machine/states/monitor.py,sha256=wJCBJo0xc42pzI8mUtOIsPsAK5V82oY3h9uiy-EkNr4,10609
74
+ isar/state_machine/states/initialize.py,sha256=KUuyXVwzWK5bJNspA1JnYO_Xwu8fPPK6bnHK4mtwf5A,2359
75
+ isar/state_machine/states/initiate.py,sha256=WqBROOGAh0DVB0f39RFkpqzkr0qrHMyrBGkh2svBbKw,5652
76
+ isar/state_machine/states/monitor.py,sha256=t0wtRPrjnWnGQ8JXia7kLkSc8tyd33mBI7UDDAsJ6FM,10874
76
77
  isar/state_machine/states/off.py,sha256=jjqN_oJMpBtWuY7hP-c9f0w3p2CYCfe-NpmYHHPnmyI,544
77
78
  isar/state_machine/states/offline.py,sha256=wEMMIwM4JWfmDjI7pe9yKce_Mfz9aXqs6WEkxn8cx5I,2125
78
- isar/state_machine/states/paused.py,sha256=xVZM9WMt90FTiP5forSlA3eJ5Vt9LzZYCFDQDPIocKA,1004
79
- isar/state_machine/states/stop.py,sha256=Sxdo4FGhxc2Pj91jidYtVIjpSNklbEf1sJYJ6x51HgE,3348
79
+ isar/state_machine/states/paused.py,sha256=HqrvONw6r6AoYPUyFGGOy2ToT7Tid8JEw2pKp2ZhZ7Y,1004
80
+ isar/state_machine/states/stop.py,sha256=zu7bVKR5zfkzU7iCrh8Pe2WRDHHzU2RBeFBxFK6Z-eA,3348
80
81
  isar/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
82
  isar/storage/blob_storage.py,sha256=oKdml1VVN8iTr-d_5H4Lz5E7zrhJRknCzOxHD-tO7m8,3230
82
- isar/storage/local_storage.py,sha256=fLzVuwvdEk9l8z7od1qX2p5MeWzcsx-vN4yWvelZeFM,1836
83
+ isar/storage/local_storage.py,sha256=Bnmoi5gyN8r-oRh0aHrOdGqaH3JqRScFKMRXYojW5kY,1855
83
84
  isar/storage/slimm_storage.py,sha256=Hp7ZIgZgIR4KAFjzxDKfgMZjPZwP2kmdc1gG8zVcsMk,8966
84
85
  isar/storage/storage_interface.py,sha256=DYDry4I7aZpDHJhsBF6s8zrgokFAc7fdKJKfA8AvL7o,828
85
86
  isar/storage/uploader.py,sha256=te3GyiSeu96MhbiqQ7ueIMUPLSKblx3UqYAshkxfVIE,6368
@@ -95,10 +96,10 @@ robot_interface/models/initialize/initialize_params.py,sha256=2eG5Aq5bDKU6tVkaUM
95
96
  robot_interface/models/inspection/__init__.py,sha256=14wfuj4XZazrigKD7fL98khFKz-eckIpEgPcYRj40Kg,227
96
97
  robot_interface/models/inspection/inspection.py,sha256=TVqUl5o3d3fp8IravOMwJIuRoEU8y4BltFrF1IkwvTA,2176
97
98
  robot_interface/models/mission/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
- robot_interface/models/mission/mission.py,sha256=obuV2htwoYlcssZF5IIBUYCrd2pIerIONlJsggBYRVs,776
99
+ robot_interface/models/mission/mission.py,sha256=xJ7i79TQkmO0Tv2IQeguhyliNP2J42ziS5iO-FyBpW0,839
99
100
  robot_interface/models/mission/status.py,sha256=R5jLmmn6M7oNX907QvbrhoAqAo4C1zB653Ed1PcxAtg,922
100
101
  robot_interface/models/mission/step.py,sha256=DEzU-LD-i3RTAaXBy5KwJZ6OnN5S0F3wwDaqX2DZ72M,5587
101
- robot_interface/models/mission/task.py,sha256=bjp-m_Ak6tzgUIQvbGe90Mnwt6QhofTgFxnVPkqHOY4,4352
102
+ robot_interface/models/mission/task.py,sha256=JJ062AIdwVoj3PUkWYmJDvRl5B7Tcu9S11J2F_0tfjE,4695
102
103
  robot_interface/models/robots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
104
  robot_interface/models/robots/robot_model.py,sha256=pZQsqhn9hh6XE3EjMZhWMzYqg5oJ4CJ4CXeOASKvEf8,452
104
105
  robot_interface/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -107,8 +108,9 @@ robot_interface/telemetry/payloads.py,sha256=eMK7mjZPsLY6yvu7AK-OcdvkeUpChzDrySD
107
108
  robot_interface/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
109
  robot_interface/utilities/json_service.py,sha256=nU2Q_3P9Fq9hs6F_wtUjWtHfl_g1Siy-yDhXXSKwHwg,1018
109
110
  robot_interface/utilities/uuid_string_factory.py,sha256=_NQIbBQ56w0qqO0MUDP6aPpHbxW7ATRhK8HnQiBSLkc,76
110
- isar-1.19.1.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
111
- isar-1.19.1.dist-info/METADATA,sha256=kZ4uX6V3gxK6sUg-sNnXAzi0JYmvgOm5G38ISMy88xs,15101
112
- isar-1.19.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
113
- isar-1.19.1.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
114
- isar-1.19.1.dist-info/RECORD,,
111
+ isar-1.20.2.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
112
+ isar-1.20.2.dist-info/METADATA,sha256=eGOpcvDhrvMdIocMCNNBxUQ_9q4Z_F_1aZOu9kNisiI,30574
113
+ isar-1.20.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
114
+ isar-1.20.2.dist-info/entry_points.txt,sha256=TFam7uNNw7J0iiDYzsH2gfG0u1eV1wh3JTw_HkhgKLk,49
115
+ isar-1.20.2.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
116
+ isar-1.20.2.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ isar-start = isar.script:start
@@ -1,6 +1,8 @@
1
1
  from dataclasses import dataclass, field
2
2
  from typing import List, Optional
3
3
 
4
+ from alitra import Pose
5
+
4
6
  from robot_interface.models.exceptions.robot_exceptions import ErrorMessage
5
7
  from robot_interface.models.mission.status import MissionStatus
6
8
  from robot_interface.models.mission.task import Task
@@ -12,6 +14,7 @@ class Mission:
12
14
  tasks: List[Task]
13
15
  id: str = field(default_factory=uuid4_string, init=True)
14
16
  name: str = ""
17
+ start_pose: Optional[Pose] = None
15
18
  status: MissionStatus = MissionStatus.NotStarted
16
19
  error_message: Optional[ErrorMessage] = field(default=None, init=False)
17
20
 
@@ -4,10 +4,10 @@ from typing import Iterator, List, Optional
4
4
  from robot_interface.models.exceptions.robot_exceptions import ErrorMessage
5
5
  from robot_interface.models.mission.status import StepStatus, TaskStatus
6
6
  from robot_interface.models.mission.step import (
7
+ STEPS,
7
8
  DriveToPose,
8
9
  InspectionStep,
9
10
  MotionStep,
10
- STEPS,
11
11
  Step,
12
12
  )
13
13
  from robot_interface.utilities.uuid_string_factory import uuid4_string
@@ -53,6 +53,7 @@ class Task:
53
53
  return True
54
54
 
55
55
  def update_task_status(self) -> None:
56
+ some_not_started: bool = False
56
57
  for step in self.steps:
57
58
  if step.status is StepStatus.Failed and isinstance(step, MotionStep):
58
59
  self.error_message = ErrorMessage(
@@ -79,8 +80,16 @@ class Task:
79
80
  elif step.status is StepStatus.Successful:
80
81
  continue
81
82
 
83
+ elif (step.status is StepStatus.NotStarted) and isinstance(
84
+ step, InspectionStep
85
+ ):
86
+ some_not_started = True
87
+
82
88
  if self.status is not TaskStatus.PartiallySuccessful:
83
- self.status = TaskStatus.Successful
89
+ if some_not_started:
90
+ self.status = TaskStatus.InProgress # TODO: handle all not_started
91
+ else:
92
+ self.status = TaskStatus.Successful
84
93
 
85
94
  elif self._all_inspection_steps_failed():
86
95
  self.error_message = ErrorMessage(