cognite-toolkit 0.7.71__py3-none-any.whl → 0.7.73__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.
- cognite_toolkit/_cdf_tk/builders/_raw.py +2 -2
- cognite_toolkit/_cdf_tk/client/_toolkit_client.py +0 -2
- cognite_toolkit/_cdf_tk/client/api/raw.py +47 -27
- cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +9 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +12 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +10 -3
- cognite_toolkit/_cdf_tk/client/http_client/_client.py +1 -1
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes.py +1 -0
- cognite_toolkit/_cdf_tk/client/http_client/_exception.py +6 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +26 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +70 -16
- cognite_toolkit/_cdf_tk/client/testing.py +23 -19
- cognite_toolkit/_cdf_tk/commands/build_cmd.py +2 -2
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +3 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +4 -5
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +3 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +99 -91
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +154 -160
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +3 -3
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/RECORD +30 -40
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +0 -8
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/api.py +0 -20
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/capabilities.py +0 -142
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/data_postprocessing.py +0 -144
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/frames.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/locations.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/maps.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/robots.py +0 -132
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/utlis.py +0 -13
- cognite_toolkit/_cdf_tk/client/resource_classes/legacy/robotics.py +0 -970
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/entry_points.txt +0 -0
|
@@ -1,970 +0,0 @@
|
|
|
1
|
-
from abc import ABC
|
|
2
|
-
from typing import Any, Literal, TypeAlias
|
|
3
|
-
|
|
4
|
-
from cognite.client import CogniteClient
|
|
5
|
-
from cognite.client.data_classes._base import (
|
|
6
|
-
CogniteObject,
|
|
7
|
-
CogniteResource,
|
|
8
|
-
CogniteResourceList,
|
|
9
|
-
CogniteUpdate,
|
|
10
|
-
ExternalIDTransformerMixin,
|
|
11
|
-
PropertySpec,
|
|
12
|
-
WriteableCogniteResource,
|
|
13
|
-
WriteableCogniteResourceList,
|
|
14
|
-
)
|
|
15
|
-
from typing_extensions import Self
|
|
16
|
-
|
|
17
|
-
MapType: TypeAlias = Literal["WAYPOINTMAP", "THREEDMODEL", "TWODMAP", "POINTCLOUD"]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class RobotCapabilityCore(WriteableCogniteResource["RobotCapabilityWrite"], ABC):
|
|
21
|
-
"""Robot capabilities define what actions that robots can execute, including data capture (PTZ, PTZ-IR, 360)
|
|
22
|
-
and behaviors (e.g., docking)
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
name: RobotCapability name.
|
|
26
|
-
external_id: RobotCapability external id. Must be unique for the resource type.
|
|
27
|
-
method: RobotCapability method. The method is used to call the right functionality on the robot.
|
|
28
|
-
description: Description of RobotCapability. Textual description of the RobotCapability.
|
|
29
|
-
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
def __init__(
|
|
33
|
-
self,
|
|
34
|
-
name: str,
|
|
35
|
-
external_id: str,
|
|
36
|
-
method: str,
|
|
37
|
-
description: str | None = None,
|
|
38
|
-
) -> None:
|
|
39
|
-
self.name = name
|
|
40
|
-
self.external_id = external_id
|
|
41
|
-
self.method = method
|
|
42
|
-
self.description = description
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class RobotCapabilityWrite(RobotCapabilityCore):
|
|
46
|
-
"""Robot capabilities define what actions that robots can execute, including data capture (PTZ, PTZ-IR, 360)
|
|
47
|
-
and behaviors (e.g., docking)
|
|
48
|
-
|
|
49
|
-
Args:
|
|
50
|
-
name: RobotCapability name.
|
|
51
|
-
external_id: RobotCapability external id. Must be unique for the resource type.
|
|
52
|
-
method: RobotCapability method. The method is used to call the right functionality on the robot.
|
|
53
|
-
input_schema: Schema that defines what inputs are needed for the action. The input are values that
|
|
54
|
-
configure the action, e.g pan, tilt and zoom values.
|
|
55
|
-
data_handling_schema: Schema that defines how the data from a RobotCapability should be handled,
|
|
56
|
-
including upload instructions.
|
|
57
|
-
description: Description of RobotCapability. Textual description of the RobotCapability.
|
|
58
|
-
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
def __init__(
|
|
62
|
-
self,
|
|
63
|
-
name: str,
|
|
64
|
-
external_id: str,
|
|
65
|
-
method: str,
|
|
66
|
-
input_schema: dict | None = None,
|
|
67
|
-
data_handling_schema: dict | None = None,
|
|
68
|
-
description: str | None = None,
|
|
69
|
-
) -> None:
|
|
70
|
-
super().__init__(name, external_id, method, description)
|
|
71
|
-
self.input_schema = input_schema
|
|
72
|
-
self.data_handling_schema = data_handling_schema
|
|
73
|
-
|
|
74
|
-
def as_write(self) -> Self:
|
|
75
|
-
return self
|
|
76
|
-
|
|
77
|
-
@classmethod
|
|
78
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
79
|
-
return cls(
|
|
80
|
-
name=resource["name"],
|
|
81
|
-
external_id=resource["externalId"],
|
|
82
|
-
method=resource["method"],
|
|
83
|
-
input_schema=resource.get("inputSchema"),
|
|
84
|
-
data_handling_schema=resource.get("dataHandlingSchema"),
|
|
85
|
-
description=resource.get("description"),
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class RobotCapability(RobotCapabilityCore):
|
|
90
|
-
"""Robot capabilities define what actions that robots can execute, including data capture (PTZ, PTZ-IR, 360)
|
|
91
|
-
and behaviors (e.g., docking)
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
name: RobotCapability name.
|
|
95
|
-
external_id: RobotCapability external id. Must be unique for the resource type.
|
|
96
|
-
method: RobotCapability method. The method is used to call the right functionality on the robot.
|
|
97
|
-
input_schema: Schema that defines what inputs are needed for the action. The input are values that
|
|
98
|
-
configure the action, e.g pan, tilt and zoom values.
|
|
99
|
-
data_handling_schema: Schema that defines how the data from a RobotCapability should be handled,
|
|
100
|
-
including upload instructions.
|
|
101
|
-
description: Description of RobotCapability. Textual description of the RobotCapability.
|
|
102
|
-
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
def __init__(
|
|
106
|
-
self,
|
|
107
|
-
name: str,
|
|
108
|
-
external_id: str,
|
|
109
|
-
method: str,
|
|
110
|
-
input_schema: dict,
|
|
111
|
-
data_handling_schema: dict,
|
|
112
|
-
description: str | None = None,
|
|
113
|
-
) -> None:
|
|
114
|
-
super().__init__(name, external_id, method, description)
|
|
115
|
-
self.input_schema = input_schema
|
|
116
|
-
self.data_handling_schema = data_handling_schema
|
|
117
|
-
|
|
118
|
-
def as_write(self) -> RobotCapabilityWrite:
|
|
119
|
-
return RobotCapabilityWrite(
|
|
120
|
-
name=self.name,
|
|
121
|
-
external_id=self.external_id,
|
|
122
|
-
method=self.method,
|
|
123
|
-
input_schema=self.input_schema,
|
|
124
|
-
data_handling_schema=self.data_handling_schema,
|
|
125
|
-
description=self.description,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
@classmethod
|
|
129
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
130
|
-
return cls(
|
|
131
|
-
name=resource["name"],
|
|
132
|
-
external_id=resource["externalId"],
|
|
133
|
-
method=resource["method"],
|
|
134
|
-
input_schema=resource["inputSchema"],
|
|
135
|
-
data_handling_schema=resource["dataHandlingSchema"],
|
|
136
|
-
description=resource.get("description"),
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
class RobotCapabilityWriteList(CogniteResourceList, ExternalIDTransformerMixin):
|
|
141
|
-
_RESOURCE = RobotCapabilityWrite
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
class RobotCapabilityList(
|
|
145
|
-
WriteableCogniteResourceList[RobotCapabilityWrite, RobotCapability], ExternalIDTransformerMixin
|
|
146
|
-
):
|
|
147
|
-
_RESOURCE = RobotCapability
|
|
148
|
-
|
|
149
|
-
def as_write(self) -> RobotCapabilityWriteList:
|
|
150
|
-
return RobotCapabilityWriteList([capability.as_write() for capability in self])
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
class _RobotCapabilityUpdate(CogniteUpdate):
|
|
154
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
155
|
-
_get_update_properties in the .update method of the RobotCapability class.
|
|
156
|
-
|
|
157
|
-
All updates are done through the RobotCapabilityWrite class instead.
|
|
158
|
-
"""
|
|
159
|
-
|
|
160
|
-
@classmethod
|
|
161
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
162
|
-
return [
|
|
163
|
-
# External ID is nullable, but is used in the upsert logic and thus cannot be nulled out.
|
|
164
|
-
PropertySpec("external_id", is_nullable=False),
|
|
165
|
-
PropertySpec("name"),
|
|
166
|
-
PropertySpec("description", is_nullable=False),
|
|
167
|
-
PropertySpec("method", is_nullable=False),
|
|
168
|
-
PropertySpec("input_schema", is_nullable=False),
|
|
169
|
-
PropertySpec("data_handling_schema", is_nullable=False),
|
|
170
|
-
]
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
RobotType: TypeAlias = Literal["SPOT", "ANYMAL", "DJI_DRONE", "TAUROB", "UWNKNOWN"]
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
class RobotCore(WriteableCogniteResource["RobotWrite"], ABC):
|
|
177
|
-
"""
|
|
178
|
-
Robot contains information for a single robot, including capabilities, type, video streaming setup, etc.
|
|
179
|
-
These fields are updated every time a robot registers with Robotics Services and do not require manual changes.
|
|
180
|
-
|
|
181
|
-
Args:
|
|
182
|
-
name: Robot name
|
|
183
|
-
capabilities: List of external ids for the capabilities the robot can perform.
|
|
184
|
-
robot_type: Type of robot.
|
|
185
|
-
data_set_id: The id of the data set this asset belongs to.
|
|
186
|
-
description: A brief description of the robot.
|
|
187
|
-
metadata: Custom, application specific metadata. String key -> String value.
|
|
188
|
-
location_external_id: External id of the location.
|
|
189
|
-
|
|
190
|
-
"""
|
|
191
|
-
|
|
192
|
-
def __init__(
|
|
193
|
-
self,
|
|
194
|
-
name: str,
|
|
195
|
-
capabilities: list[str],
|
|
196
|
-
robot_type: RobotType,
|
|
197
|
-
data_set_id: int,
|
|
198
|
-
description: str | None = None,
|
|
199
|
-
metadata: dict | None = None,
|
|
200
|
-
location_external_id: str | None = None,
|
|
201
|
-
) -> None:
|
|
202
|
-
self.name = name
|
|
203
|
-
self.capabilities = capabilities
|
|
204
|
-
self.robot_type = robot_type
|
|
205
|
-
self.data_set_id = data_set_id
|
|
206
|
-
self.description = description
|
|
207
|
-
self.metadata = metadata
|
|
208
|
-
self.location_external_id = location_external_id
|
|
209
|
-
|
|
210
|
-
def as_write(self) -> "RobotWrite":
|
|
211
|
-
return RobotWrite(
|
|
212
|
-
name=self.name,
|
|
213
|
-
capabilities=self.capabilities,
|
|
214
|
-
robot_type=self.robot_type,
|
|
215
|
-
data_set_id=self.data_set_id,
|
|
216
|
-
description=self.description,
|
|
217
|
-
metadata=self.metadata,
|
|
218
|
-
location_external_id=self.location_external_id,
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
class RobotWrite(RobotCore):
|
|
223
|
-
@classmethod
|
|
224
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
225
|
-
return cls(
|
|
226
|
-
name=resource["name"],
|
|
227
|
-
capabilities=resource["capabilities"],
|
|
228
|
-
robot_type=resource["robotType"],
|
|
229
|
-
data_set_id=resource["dataSetId"],
|
|
230
|
-
description=resource.get("description"),
|
|
231
|
-
metadata=resource.get("metadata"),
|
|
232
|
-
location_external_id=resource.get("locationExternalId"),
|
|
233
|
-
)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
class Robot(RobotCore):
|
|
237
|
-
"""
|
|
238
|
-
Robot contains information for a single robot, including capabilities, type, video streaming setup, etc.
|
|
239
|
-
These fields are updated every time a robot registers with Robotics Services and do not require manual changes.
|
|
240
|
-
|
|
241
|
-
Args:
|
|
242
|
-
name: Robot name
|
|
243
|
-
capabilities: List of external ids for the capabilities the robot can perform.
|
|
244
|
-
robot_type: Type of robot.
|
|
245
|
-
data_set_id: The id of the data set this asset belongs to.
|
|
246
|
-
created_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
247
|
-
updated_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
248
|
-
description: A brief description of the robot.
|
|
249
|
-
metadata: Custom, application-specific metadata. String key -> String value.
|
|
250
|
-
location_external_id: External id of the location.
|
|
251
|
-
|
|
252
|
-
"""
|
|
253
|
-
|
|
254
|
-
def __init__(
|
|
255
|
-
self,
|
|
256
|
-
name: str,
|
|
257
|
-
capabilities: list[str],
|
|
258
|
-
robot_type: RobotType,
|
|
259
|
-
data_set_id: int,
|
|
260
|
-
created_time: int,
|
|
261
|
-
updated_time: int,
|
|
262
|
-
description: str | None = None,
|
|
263
|
-
metadata: dict | None = None,
|
|
264
|
-
location_external_id: str | None = None,
|
|
265
|
-
) -> None:
|
|
266
|
-
super().__init__(name, capabilities, robot_type, data_set_id, description, metadata, location_external_id)
|
|
267
|
-
self.created_time = created_time
|
|
268
|
-
self.updated_time = updated_time
|
|
269
|
-
|
|
270
|
-
@classmethod
|
|
271
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
272
|
-
return cls(
|
|
273
|
-
name=resource["name"],
|
|
274
|
-
capabilities=resource["capabilities"],
|
|
275
|
-
robot_type=resource["robotType"],
|
|
276
|
-
data_set_id=resource["dataSetId"],
|
|
277
|
-
created_time=resource["createdTime"],
|
|
278
|
-
updated_time=resource["updatedTime"],
|
|
279
|
-
description=resource.get("description"),
|
|
280
|
-
metadata=resource.get("metadata"),
|
|
281
|
-
location_external_id=resource.get("locationExternalId"),
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
class RobotWriteList(CogniteResourceList):
|
|
286
|
-
_RESOURCE = RobotWrite
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
class RobotList(WriteableCogniteResourceList[RobotWrite, Robot]):
|
|
290
|
-
_RESOURCE = Robot
|
|
291
|
-
|
|
292
|
-
def as_write(self) -> RobotWriteList:
|
|
293
|
-
return RobotWriteList([robot.as_write() for robot in self])
|
|
294
|
-
|
|
295
|
-
def get_robot_by_name(self, name: str) -> Robot:
|
|
296
|
-
try:
|
|
297
|
-
return next(robot for robot in self if robot.name == name)
|
|
298
|
-
except StopIteration:
|
|
299
|
-
raise ValueError(f"No robot with name {name} found in list")
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
class _RobotUpdate(CogniteUpdate):
|
|
303
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
304
|
-
_get_update_properties in the .update method of the Robot class.
|
|
305
|
-
|
|
306
|
-
All updates are done through the RobotWrite
|
|
307
|
-
"""
|
|
308
|
-
|
|
309
|
-
@classmethod
|
|
310
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
311
|
-
return [
|
|
312
|
-
PropertySpec("name", is_nullable=False),
|
|
313
|
-
PropertySpec("description", is_nullable=False),
|
|
314
|
-
PropertySpec("metadata", is_object=True, is_nullable=False),
|
|
315
|
-
PropertySpec("robot_type", is_nullable=False),
|
|
316
|
-
PropertySpec("location_external_id", is_nullable=False),
|
|
317
|
-
]
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
class DataPostProcessingCore(WriteableCogniteResource["DataPostProcessingWrite"], ABC):
|
|
321
|
-
"""Robot capabilities define what actions that robots can execute, including data capture (PTZ, PTZ-IR, 360)
|
|
322
|
-
and behaviors (e.g., docking)
|
|
323
|
-
|
|
324
|
-
Args:
|
|
325
|
-
name: DataProcessing name.
|
|
326
|
-
external_id: DataProcessing external id. Must be unique for the resource type.
|
|
327
|
-
method: DataProcessing method. The method is used to call the right functionality on the robot.
|
|
328
|
-
description: Description of DataProcessing. Textual description of the DataProcessing.
|
|
329
|
-
|
|
330
|
-
"""
|
|
331
|
-
|
|
332
|
-
def __init__(
|
|
333
|
-
self,
|
|
334
|
-
name: str,
|
|
335
|
-
external_id: str,
|
|
336
|
-
method: str,
|
|
337
|
-
description: str | None = None,
|
|
338
|
-
) -> None:
|
|
339
|
-
self.name = name
|
|
340
|
-
self.external_id = external_id
|
|
341
|
-
self.method = method
|
|
342
|
-
self.description = description
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
class DataPostProcessingWrite(DataPostProcessingCore):
|
|
346
|
-
"""DataPostprocessing define types of data processing on data captured by the robot.
|
|
347
|
-
DataPostprocessing enables you to automatically process data captured by the robot.
|
|
348
|
-
|
|
349
|
-
Args:
|
|
350
|
-
name: DataProcessing name.
|
|
351
|
-
external_id: DataProcessing external id. Must be unique for the resource type.
|
|
352
|
-
method: DataProcessing method. The method is used to call the right functionality on the robot.
|
|
353
|
-
input_schema: Schema that defines what inputs are needed for the data postprocessing. The input are values
|
|
354
|
-
that configure the data postprocessing, e.g max and min values for a gauge.
|
|
355
|
-
configure the action, e.g pan, tilt and zoom values.
|
|
356
|
-
description: Description of DataProcessing. Textual description of the DataProcessing.
|
|
357
|
-
|
|
358
|
-
"""
|
|
359
|
-
|
|
360
|
-
def __init__(
|
|
361
|
-
self,
|
|
362
|
-
name: str,
|
|
363
|
-
external_id: str,
|
|
364
|
-
method: str,
|
|
365
|
-
input_schema: dict | None = None,
|
|
366
|
-
description: str | None = None,
|
|
367
|
-
) -> None:
|
|
368
|
-
super().__init__(name, external_id, method, description)
|
|
369
|
-
self.input_schema = input_schema
|
|
370
|
-
|
|
371
|
-
def as_write(self) -> Self:
|
|
372
|
-
return self
|
|
373
|
-
|
|
374
|
-
@classmethod
|
|
375
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
376
|
-
return cls(
|
|
377
|
-
name=resource["name"],
|
|
378
|
-
external_id=resource["externalId"],
|
|
379
|
-
method=resource["method"],
|
|
380
|
-
input_schema=resource.get("inputSchema"),
|
|
381
|
-
description=resource.get("description"),
|
|
382
|
-
)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
class DataPostProcessing(DataPostProcessingCore):
|
|
386
|
-
"""DataPostprocessing define types of data processing on data captured by the robot.
|
|
387
|
-
DataPostprocessing enables you to automatically process data captured by the robot.
|
|
388
|
-
|
|
389
|
-
Args:
|
|
390
|
-
name: DataProcessing name.
|
|
391
|
-
external_id: DataProcessing external id. Must be unique for the resource type.
|
|
392
|
-
method: DataProcessing method. The method is used to call the right functionality on the robot.
|
|
393
|
-
input_schema: Schema that defines what inputs are needed for the data postprocessing. The input are values
|
|
394
|
-
that configure the data postprocessing, e.g max and min values for a gauge.
|
|
395
|
-
configure the action, e.g pan, tilt and zoom values.
|
|
396
|
-
description: Description of DataProcessing. Textual description of the DataProcessing.
|
|
397
|
-
|
|
398
|
-
"""
|
|
399
|
-
|
|
400
|
-
def __init__(
|
|
401
|
-
self,
|
|
402
|
-
name: str,
|
|
403
|
-
external_id: str,
|
|
404
|
-
method: str,
|
|
405
|
-
input_schema: dict,
|
|
406
|
-
description: str | None = None,
|
|
407
|
-
) -> None:
|
|
408
|
-
super().__init__(name, external_id, method, description)
|
|
409
|
-
self.input_schema = input_schema
|
|
410
|
-
|
|
411
|
-
def as_write(self) -> DataPostProcessingWrite:
|
|
412
|
-
return DataPostProcessingWrite(
|
|
413
|
-
name=self.name,
|
|
414
|
-
external_id=self.external_id,
|
|
415
|
-
method=self.method,
|
|
416
|
-
input_schema=self.input_schema,
|
|
417
|
-
description=self.description,
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
@classmethod
|
|
421
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
422
|
-
return cls(
|
|
423
|
-
name=resource["name"],
|
|
424
|
-
external_id=resource["externalId"],
|
|
425
|
-
method=resource["method"],
|
|
426
|
-
input_schema=resource["inputSchema"],
|
|
427
|
-
description=resource.get("description"),
|
|
428
|
-
)
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
class DataPostProcessingWriteList(CogniteResourceList, ExternalIDTransformerMixin):
|
|
432
|
-
_RESOURCE = DataPostProcessingWrite
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
class DataPostProcessingList(
|
|
436
|
-
WriteableCogniteResourceList[DataPostProcessingWrite, DataPostProcessing], ExternalIDTransformerMixin
|
|
437
|
-
):
|
|
438
|
-
_RESOURCE = DataPostProcessing
|
|
439
|
-
|
|
440
|
-
def as_write(self) -> DataPostProcessingWriteList:
|
|
441
|
-
return DataPostProcessingWriteList([capability.as_write() for capability in self])
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
class _DataProcessingUpdate(CogniteUpdate):
|
|
445
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
446
|
-
_get_update_properties in the .update method of the DataProcessing class.
|
|
447
|
-
|
|
448
|
-
All updates are done through the DataProcessingWrite class instead.
|
|
449
|
-
"""
|
|
450
|
-
|
|
451
|
-
@classmethod
|
|
452
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
453
|
-
return [
|
|
454
|
-
PropertySpec("name", is_nullable=False),
|
|
455
|
-
PropertySpec("description", is_nullable=False),
|
|
456
|
-
PropertySpec("method", is_nullable=False),
|
|
457
|
-
PropertySpec("input_schema", is_nullable=False),
|
|
458
|
-
]
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
class LocationCore(WriteableCogniteResource["LocationWrite"], ABC):
|
|
462
|
-
"""Robot capabilities define what actions that robots can execute, including data capture (PTZ, PTZ-IR, 360)
|
|
463
|
-
and behaviors (e.g., docking)
|
|
464
|
-
|
|
465
|
-
Args:
|
|
466
|
-
name: Location name.
|
|
467
|
-
external_id: Location external id. Must be unique for the resource type.
|
|
468
|
-
description: Description of Location. Textual description of the Location.
|
|
469
|
-
|
|
470
|
-
"""
|
|
471
|
-
|
|
472
|
-
def __init__(
|
|
473
|
-
self,
|
|
474
|
-
name: str,
|
|
475
|
-
external_id: str,
|
|
476
|
-
description: str | None = None,
|
|
477
|
-
) -> None:
|
|
478
|
-
self.name = name
|
|
479
|
-
self.external_id = external_id
|
|
480
|
-
self.description = description
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
class LocationWrite(LocationCore):
|
|
484
|
-
"""The Locations resource is used to specify the physical location of a robot. Robot missions are defined
|
|
485
|
-
for a specific location. In addition, the location is used to group Missions and Map resources.
|
|
486
|
-
|
|
487
|
-
Args:
|
|
488
|
-
name: Location name.
|
|
489
|
-
external_id: Location external id. Must be unique for the resource type.
|
|
490
|
-
description: Description of Location. Textual description of the Location.
|
|
491
|
-
|
|
492
|
-
"""
|
|
493
|
-
|
|
494
|
-
def __init__(
|
|
495
|
-
self,
|
|
496
|
-
name: str,
|
|
497
|
-
external_id: str,
|
|
498
|
-
description: str | None = None,
|
|
499
|
-
) -> None:
|
|
500
|
-
super().__init__(name, external_id, description)
|
|
501
|
-
|
|
502
|
-
def as_write(self) -> Self:
|
|
503
|
-
return self
|
|
504
|
-
|
|
505
|
-
@classmethod
|
|
506
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
507
|
-
return cls(
|
|
508
|
-
name=resource["name"],
|
|
509
|
-
external_id=resource["externalId"],
|
|
510
|
-
description=resource.get("description"),
|
|
511
|
-
)
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
class Location(LocationCore):
|
|
515
|
-
"""DataPostprocessing define types of data processing on data captured by the robot.
|
|
516
|
-
DataPostprocessing enables you to automatically process data captured by the robot.
|
|
517
|
-
|
|
518
|
-
Args:
|
|
519
|
-
name: Location name.
|
|
520
|
-
external_id: Location external id. Must be unique for the resource type.
|
|
521
|
-
created_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
522
|
-
updated_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
523
|
-
description: Description of Location. Textual description of the Location.
|
|
524
|
-
|
|
525
|
-
"""
|
|
526
|
-
|
|
527
|
-
def __init__(
|
|
528
|
-
self,
|
|
529
|
-
name: str,
|
|
530
|
-
external_id: str,
|
|
531
|
-
created_time: int,
|
|
532
|
-
updated_time: int,
|
|
533
|
-
description: str | None = None,
|
|
534
|
-
) -> None:
|
|
535
|
-
super().__init__(name, external_id, description)
|
|
536
|
-
self.created_time = created_time
|
|
537
|
-
self.updated_time = updated_time
|
|
538
|
-
|
|
539
|
-
def as_write(self) -> LocationWrite:
|
|
540
|
-
return LocationWrite(
|
|
541
|
-
name=self.name,
|
|
542
|
-
external_id=self.external_id,
|
|
543
|
-
description=self.description,
|
|
544
|
-
)
|
|
545
|
-
|
|
546
|
-
@classmethod
|
|
547
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
548
|
-
return cls(
|
|
549
|
-
name=resource["name"],
|
|
550
|
-
external_id=resource["externalId"],
|
|
551
|
-
created_time=resource["createdTime"],
|
|
552
|
-
updated_time=resource["updatedTime"],
|
|
553
|
-
description=resource.get("description"),
|
|
554
|
-
)
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
class LocationWriteList(CogniteResourceList, ExternalIDTransformerMixin):
|
|
558
|
-
_RESOURCE = LocationWrite
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
class LocationList(WriteableCogniteResourceList[LocationWrite, Location], ExternalIDTransformerMixin):
|
|
562
|
-
_RESOURCE = Location
|
|
563
|
-
|
|
564
|
-
def as_write(self) -> LocationWriteList:
|
|
565
|
-
return LocationWriteList([capability.as_write() for capability in self])
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
class _LocationUpdate(CogniteUpdate):
|
|
569
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
570
|
-
_get_update_properties in the .update method of the Location class.
|
|
571
|
-
|
|
572
|
-
All updates are done through the LocationWrite class instead.
|
|
573
|
-
"""
|
|
574
|
-
|
|
575
|
-
@classmethod
|
|
576
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
577
|
-
return [
|
|
578
|
-
PropertySpec("name", is_nullable=False),
|
|
579
|
-
PropertySpec("description", is_nullable=False),
|
|
580
|
-
]
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
class Point3D(CogniteObject):
|
|
584
|
-
"""A point in 3D space."""
|
|
585
|
-
|
|
586
|
-
def __init__(self, x: float, y: float, z: float) -> None:
|
|
587
|
-
self.x = x
|
|
588
|
-
self.y = y
|
|
589
|
-
self.z = z
|
|
590
|
-
|
|
591
|
-
@classmethod
|
|
592
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
593
|
-
return cls(
|
|
594
|
-
x=resource["x"],
|
|
595
|
-
y=resource["y"],
|
|
596
|
-
z=resource["z"],
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
class Quaternion(Point3D):
|
|
601
|
-
"""A quaternion."""
|
|
602
|
-
|
|
603
|
-
def __init__(self, x: float, y: float, z: float, w: float) -> None:
|
|
604
|
-
super().__init__(x, y, z)
|
|
605
|
-
self.w = w
|
|
606
|
-
|
|
607
|
-
@classmethod
|
|
608
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
609
|
-
return cls(
|
|
610
|
-
x=resource["x"],
|
|
611
|
-
y=resource["y"],
|
|
612
|
-
z=resource["z"],
|
|
613
|
-
w=resource["w"],
|
|
614
|
-
)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
class Transform(CogniteObject):
|
|
618
|
-
"""Transform of the parent frame to the current frame.
|
|
619
|
-
|
|
620
|
-
Args:
|
|
621
|
-
parent_frame_external_id: The external id of the parent frame.
|
|
622
|
-
translation: Transform translation (Point3)
|
|
623
|
-
orientation: Transform orientation as quaternion (Quaternion).
|
|
624
|
-
|
|
625
|
-
"""
|
|
626
|
-
|
|
627
|
-
def __init__(
|
|
628
|
-
self,
|
|
629
|
-
parent_frame_external_id: str,
|
|
630
|
-
translation: Point3D,
|
|
631
|
-
orientation: Quaternion,
|
|
632
|
-
) -> None:
|
|
633
|
-
self.parent_frame_external_id = parent_frame_external_id
|
|
634
|
-
self.translation = translation
|
|
635
|
-
self.orientation = orientation
|
|
636
|
-
|
|
637
|
-
@classmethod
|
|
638
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
639
|
-
return cls(
|
|
640
|
-
parent_frame_external_id=resource["parentFrameExternalId"],
|
|
641
|
-
translation=Point3D._load(resource["translation"]),
|
|
642
|
-
orientation=Quaternion._load(resource["orientation"]),
|
|
643
|
-
)
|
|
644
|
-
|
|
645
|
-
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
646
|
-
return {
|
|
647
|
-
"parentFrameExternalId" if camel_case else "parent_frame_external_id": self.parent_frame_external_id,
|
|
648
|
-
"translation": self.translation.dump(camel_case),
|
|
649
|
-
"orientation": self.orientation.dump(camel_case),
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
class FrameCore(WriteableCogniteResource["FrameWrite"], ABC):
|
|
654
|
-
"""The frames resource represents coordinate frames, which are used to describe how maps are aligned with
|
|
655
|
-
respect to each other. For example, frames are used to describe the relative position of a context map
|
|
656
|
-
(e.g., a 3D model of a location) and a robot's navigation map. Frames are aligned with each other through
|
|
657
|
-
transforms, which consist of a translation (in meters) and rotation (quaternion).
|
|
658
|
-
|
|
659
|
-
Args:
|
|
660
|
-
name: Frame name.
|
|
661
|
-
external_id: Frame external id. Must be unique for the resource type.
|
|
662
|
-
transform: Transform of the parent frame to the current frame.
|
|
663
|
-
"""
|
|
664
|
-
|
|
665
|
-
def __init__(
|
|
666
|
-
self,
|
|
667
|
-
name: str,
|
|
668
|
-
external_id: str,
|
|
669
|
-
transform: Transform | None = None,
|
|
670
|
-
) -> None:
|
|
671
|
-
self.name = name
|
|
672
|
-
self.external_id = external_id
|
|
673
|
-
self.transform = transform
|
|
674
|
-
|
|
675
|
-
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
676
|
-
output: dict[str, Any] = {
|
|
677
|
-
"name": self.name,
|
|
678
|
-
"externalId" if camel_case else "external_id": self.external_id,
|
|
679
|
-
}
|
|
680
|
-
if self.transform:
|
|
681
|
-
output["transform"] = self.transform.dump(camel_case)
|
|
682
|
-
return output
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
class FrameWrite(FrameCore):
|
|
686
|
-
"""The frames resource represents coordinate frames, which are used to describe how maps are aligned with
|
|
687
|
-
respect to each other. For example, frames are used to describe the relative position of a context map
|
|
688
|
-
(e.g., a 3D model of a location) and a robot's navigation map. Frames are aligned with each other through
|
|
689
|
-
transforms, which consist of a translation (in meters) and rotation (quaternion).
|
|
690
|
-
|
|
691
|
-
Args:
|
|
692
|
-
name: Frame name.
|
|
693
|
-
external_id: Frame external id. Must be unique for the resource type.
|
|
694
|
-
transform: Transform of the parent frame to the current frame.
|
|
695
|
-
"""
|
|
696
|
-
|
|
697
|
-
def __init__(
|
|
698
|
-
self,
|
|
699
|
-
name: str,
|
|
700
|
-
external_id: str,
|
|
701
|
-
transform: Transform | None = None,
|
|
702
|
-
) -> None:
|
|
703
|
-
super().__init__(name, external_id, transform)
|
|
704
|
-
|
|
705
|
-
def as_write(self) -> Self:
|
|
706
|
-
return self
|
|
707
|
-
|
|
708
|
-
@classmethod
|
|
709
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
710
|
-
return cls(
|
|
711
|
-
name=resource["name"],
|
|
712
|
-
external_id=resource["externalId"],
|
|
713
|
-
transform=Transform._load(resource["transform"], cognite_client) if resource.get("transform") else None,
|
|
714
|
-
)
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
class Frame(FrameCore):
|
|
718
|
-
"""DataPostprocessing define types of data processing on data captured by the robot.
|
|
719
|
-
DataPostprocessing enables you to automatically process data captured by the robot.
|
|
720
|
-
|
|
721
|
-
Args:
|
|
722
|
-
name: Frame name.
|
|
723
|
-
external_id: Frame external id. Must be unique for the resource type.
|
|
724
|
-
created_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
725
|
-
updated_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
726
|
-
|
|
727
|
-
"""
|
|
728
|
-
|
|
729
|
-
def __init__(
|
|
730
|
-
self,
|
|
731
|
-
name: str,
|
|
732
|
-
external_id: str,
|
|
733
|
-
created_time: int,
|
|
734
|
-
updated_time: int,
|
|
735
|
-
transform: Transform | None = None,
|
|
736
|
-
) -> None:
|
|
737
|
-
super().__init__(name, external_id, transform)
|
|
738
|
-
self.created_time = created_time
|
|
739
|
-
self.updated_time = updated_time
|
|
740
|
-
|
|
741
|
-
def as_write(self) -> FrameWrite:
|
|
742
|
-
return FrameWrite(
|
|
743
|
-
name=self.name,
|
|
744
|
-
external_id=self.external_id,
|
|
745
|
-
transform=self.transform,
|
|
746
|
-
)
|
|
747
|
-
|
|
748
|
-
@classmethod
|
|
749
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
750
|
-
return cls(
|
|
751
|
-
name=resource["name"],
|
|
752
|
-
external_id=resource["externalId"],
|
|
753
|
-
created_time=resource["createdTime"],
|
|
754
|
-
updated_time=resource["updatedTime"],
|
|
755
|
-
transform=Transform._load(resource["transform"]) if resource.get("transform") else None,
|
|
756
|
-
)
|
|
757
|
-
|
|
758
|
-
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
759
|
-
output = super().dump(camel_case)
|
|
760
|
-
output["createdTime" if camel_case else "created_time"] = self.created_time
|
|
761
|
-
output["updatedTime" if camel_case else "updated_time"] = self.updated_time
|
|
762
|
-
return output
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
class FrameWriteList(CogniteResourceList, ExternalIDTransformerMixin):
|
|
766
|
-
_RESOURCE = FrameWrite
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
class FrameList(WriteableCogniteResourceList[FrameWrite, Frame], ExternalIDTransformerMixin):
|
|
770
|
-
_RESOURCE = Frame
|
|
771
|
-
|
|
772
|
-
def as_write(self) -> FrameWriteList:
|
|
773
|
-
return FrameWriteList([capability.as_write() for capability in self])
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
class _FrameUpdate(CogniteUpdate):
|
|
777
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
778
|
-
_get_update_properties in the .update method of the Frame class.
|
|
779
|
-
|
|
780
|
-
All updates are done through the FrameWrite class instead.
|
|
781
|
-
"""
|
|
782
|
-
|
|
783
|
-
@classmethod
|
|
784
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
785
|
-
return [
|
|
786
|
-
PropertySpec("name", is_nullable=False),
|
|
787
|
-
PropertySpec("transform", is_nullable=False),
|
|
788
|
-
]
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
class MapCore(WriteableCogniteResource["MapWrite"], ABC):
|
|
792
|
-
"""The map resource allows defining both context maps and robot maps of a specific location. A context map is a
|
|
793
|
-
visual representation of a location, for example, a 3D model, a 2D floor plan, or a point cloud model.
|
|
794
|
-
A robot map is a representation of where a robot is able to navigate. Maps need to be aligned with respect
|
|
795
|
-
to each other using coordinate frames.
|
|
796
|
-
|
|
797
|
-
Args:
|
|
798
|
-
name: Map name.
|
|
799
|
-
external_id: Map external id. Must be unique for the resource type.
|
|
800
|
-
map_type: Map type
|
|
801
|
-
description: Description of Map. Textual description of the Map.
|
|
802
|
-
frame_external_id: External id of the map's reference frame.
|
|
803
|
-
data: Map-specific data.
|
|
804
|
-
location_external_id: External id of the location.
|
|
805
|
-
scale: Uniform scaling factor, for example, for map unit conversion (centimeter to meter).
|
|
806
|
-
|
|
807
|
-
"""
|
|
808
|
-
|
|
809
|
-
def __init__(
|
|
810
|
-
self,
|
|
811
|
-
name: str,
|
|
812
|
-
external_id: str,
|
|
813
|
-
map_type: MapType,
|
|
814
|
-
description: str | None = None,
|
|
815
|
-
frame_external_id: str | None = None,
|
|
816
|
-
data: dict | None = None,
|
|
817
|
-
location_external_id: str | None = None,
|
|
818
|
-
scale: float | None = None,
|
|
819
|
-
) -> None:
|
|
820
|
-
self.name = name
|
|
821
|
-
self.external_id = external_id
|
|
822
|
-
self.map_type = map_type
|
|
823
|
-
self.description = description
|
|
824
|
-
self.frame_external_id = frame_external_id
|
|
825
|
-
self.data = data
|
|
826
|
-
self.location_external_id = location_external_id
|
|
827
|
-
self.scale = scale
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
class MapWrite(MapCore):
|
|
831
|
-
"""The map resource allows defining both context maps and robot maps of a specific location. A context map is a
|
|
832
|
-
visual representation of a location, for example, a 3D model, a 2D floor plan, or a point cloud model.
|
|
833
|
-
A robot map is a representation of where a robot is able to navigate. Maps need to be aligned with respect
|
|
834
|
-
to each other using coordinate frames.
|
|
835
|
-
|
|
836
|
-
Args:
|
|
837
|
-
name: Map name.
|
|
838
|
-
external_id: Map external id. Must be unique for the resource type.
|
|
839
|
-
map_type: Map type
|
|
840
|
-
description: Description of Map. Textual description of the Map.
|
|
841
|
-
frame_external_id: External id of the map's reference frame.
|
|
842
|
-
data: Map-specific data.
|
|
843
|
-
location_external_id: External id of the location.
|
|
844
|
-
scale: Uniform scaling factor, for example, for map unit conversion (centimeter to meter).
|
|
845
|
-
|
|
846
|
-
"""
|
|
847
|
-
|
|
848
|
-
def __init__(
|
|
849
|
-
self,
|
|
850
|
-
name: str,
|
|
851
|
-
external_id: str,
|
|
852
|
-
map_type: MapType,
|
|
853
|
-
description: str | None = None,
|
|
854
|
-
frame_external_id: str | None = None,
|
|
855
|
-
data: dict | None = None,
|
|
856
|
-
location_external_id: str | None = None,
|
|
857
|
-
scale: float | None = None,
|
|
858
|
-
) -> None:
|
|
859
|
-
super().__init__(name, external_id, map_type, description, frame_external_id, data, location_external_id, scale)
|
|
860
|
-
|
|
861
|
-
def as_write(self) -> Self:
|
|
862
|
-
return self
|
|
863
|
-
|
|
864
|
-
@classmethod
|
|
865
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
866
|
-
return cls(
|
|
867
|
-
name=resource["name"],
|
|
868
|
-
external_id=resource["externalId"],
|
|
869
|
-
map_type=resource["mapType"],
|
|
870
|
-
description=resource.get("description"),
|
|
871
|
-
frame_external_id=resource.get("frameExternalId"),
|
|
872
|
-
data=resource.get("data"),
|
|
873
|
-
location_external_id=resource.get("locationExternalId"),
|
|
874
|
-
scale=resource.get("scale"),
|
|
875
|
-
)
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
class Map(MapCore):
|
|
879
|
-
"""The map resource allows defining both context maps and robot maps of a specific location. A context map is a
|
|
880
|
-
visual representation of a location, for example, a 3D model, a 2D floor plan, or a point cloud model.
|
|
881
|
-
A robot map is a representation of where a robot is able to navigate. Maps need to be aligned with respect
|
|
882
|
-
to each other using coordinate frames.
|
|
883
|
-
|
|
884
|
-
Args:
|
|
885
|
-
name: Map name.
|
|
886
|
-
external_id: Map external id. Must be unique for the resource type.
|
|
887
|
-
map_type: Map type
|
|
888
|
-
created_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
889
|
-
updated_time: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
|
|
890
|
-
description: Description of Map. Textual description of the Map.
|
|
891
|
-
frame_external_id: External id of the map's reference frame.
|
|
892
|
-
data: Map-specific data.
|
|
893
|
-
location_external_id: External id of the location.
|
|
894
|
-
scale: Uniform scaling factor, for example, for map unit conversion (centimeter to meter).
|
|
895
|
-
|
|
896
|
-
"""
|
|
897
|
-
|
|
898
|
-
def __init__(
|
|
899
|
-
self,
|
|
900
|
-
name: str,
|
|
901
|
-
external_id: str,
|
|
902
|
-
map_type: MapType,
|
|
903
|
-
created_time: int,
|
|
904
|
-
updated_time: int,
|
|
905
|
-
description: str | None = None,
|
|
906
|
-
frame_external_id: str | None = None,
|
|
907
|
-
data: dict | None = None,
|
|
908
|
-
location_external_id: str | None = None,
|
|
909
|
-
scale: float | None = None,
|
|
910
|
-
) -> None:
|
|
911
|
-
super().__init__(name, external_id, map_type, description, frame_external_id, data, location_external_id, scale)
|
|
912
|
-
self.created_time = created_time
|
|
913
|
-
self.updated_time = updated_time
|
|
914
|
-
|
|
915
|
-
def as_write(self) -> MapWrite:
|
|
916
|
-
return MapWrite(
|
|
917
|
-
name=self.name,
|
|
918
|
-
external_id=self.external_id,
|
|
919
|
-
map_type=self.map_type,
|
|
920
|
-
description=self.description,
|
|
921
|
-
frame_external_id=self.frame_external_id,
|
|
922
|
-
data=self.data,
|
|
923
|
-
location_external_id=self.location_external_id,
|
|
924
|
-
scale=self.scale,
|
|
925
|
-
)
|
|
926
|
-
|
|
927
|
-
@classmethod
|
|
928
|
-
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
|
|
929
|
-
return cls(
|
|
930
|
-
name=resource["name"],
|
|
931
|
-
external_id=resource["externalId"],
|
|
932
|
-
map_type=resource["mapType"],
|
|
933
|
-
created_time=resource["createdTime"],
|
|
934
|
-
updated_time=resource["updatedTime"],
|
|
935
|
-
description=resource.get("description"),
|
|
936
|
-
frame_external_id=resource.get("frameExternalId"),
|
|
937
|
-
data=resource.get("data"),
|
|
938
|
-
location_external_id=resource.get("locationExternalId"),
|
|
939
|
-
scale=resource.get("scale"),
|
|
940
|
-
)
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
class MapWriteList(CogniteResourceList, ExternalIDTransformerMixin):
|
|
944
|
-
_RESOURCE = MapWrite
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
class MapList(WriteableCogniteResourceList[MapWrite, Map], ExternalIDTransformerMixin):
|
|
948
|
-
_RESOURCE = Map
|
|
949
|
-
|
|
950
|
-
def as_write(self) -> MapWriteList:
|
|
951
|
-
return MapWriteList([capability.as_write() for capability in self])
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
class _MapUpdate(CogniteUpdate):
|
|
955
|
-
"""This is not fully implemented as the Toolkit only needs it for the
|
|
956
|
-
_get_update_properties in the .update method of the Map class.
|
|
957
|
-
|
|
958
|
-
All updates are done through the MapWrite class instead.
|
|
959
|
-
"""
|
|
960
|
-
|
|
961
|
-
@classmethod
|
|
962
|
-
def _get_update_properties(cls, item: CogniteResource | None = None) -> list[PropertySpec]:
|
|
963
|
-
return [
|
|
964
|
-
PropertySpec("name", is_nullable=False),
|
|
965
|
-
PropertySpec("description", is_nullable=False),
|
|
966
|
-
PropertySpec("frame_external_id", is_nullable=False),
|
|
967
|
-
PropertySpec("data", is_nullable=False),
|
|
968
|
-
PropertySpec("location_external_id", is_nullable=False),
|
|
969
|
-
PropertySpec("scale", is_nullable=False),
|
|
970
|
-
]
|