plexus-python-common 1.0.62__py3-none-any.whl → 1.0.63__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.
- plexus/common/carto/OSMFile.py +1 -1
- plexus/common/carto/OSMNode.py +1 -1
- plexus/common/{proj.py → utils/gisutils.py} +102 -1
- {plexus_python_common-1.0.62.dist-info → plexus_python_common-1.0.63.dist-info}/METADATA +1 -1
- {plexus_python_common-1.0.62.dist-info → plexus_python_common-1.0.63.dist-info}/RECORD +7 -8
- plexus/common/pose.py +0 -107
- {plexus_python_common-1.0.62.dist-info → plexus_python_common-1.0.63.dist-info}/WHEEL +0 -0
- {plexus_python_common-1.0.62.dist-info → plexus_python_common-1.0.63.dist-info}/top_level.txt +0 -0
plexus/common/carto/OSMFile.py
CHANGED
|
@@ -5,7 +5,7 @@ import lxml.etree
|
|
|
5
5
|
from plexus.common.carto.OSMNode import OSMNode
|
|
6
6
|
from plexus.common.carto.OSMTags import OSMTags
|
|
7
7
|
from plexus.common.carto.OSMWay import OSMWay
|
|
8
|
-
from plexus.common.
|
|
8
|
+
from plexus.common.utils.gisutils import Coord, Proj
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class OSMFile(object):
|
plexus/common/carto/OSMNode.py
CHANGED
|
@@ -5,10 +5,111 @@ from typing import Annotated, Self
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
import pydantic as pdt
|
|
7
7
|
import pyproj
|
|
8
|
+
import pyquaternion as pyquat
|
|
8
9
|
from iker.common.utils.funcutils import singleton
|
|
9
10
|
from iker.common.utils.strutils import parse_params_string, repr_data, str_conv
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
class Pose(object):
|
|
14
|
+
@classmethod
|
|
15
|
+
def from_numbers(
|
|
16
|
+
cls,
|
|
17
|
+
px: float,
|
|
18
|
+
py: float,
|
|
19
|
+
pz: float,
|
|
20
|
+
qx: float,
|
|
21
|
+
qy: float,
|
|
22
|
+
qz: float,
|
|
23
|
+
qw: float,
|
|
24
|
+
ts: float = 0,
|
|
25
|
+
) -> Self:
|
|
26
|
+
"""
|
|
27
|
+
Constructs a pose from numbers representing position and orientation
|
|
28
|
+
"""
|
|
29
|
+
return Pose(ts, np.array([px, py, pz], dtype=np.float64), np.array([qw, qx, qy, qz], dtype=np.float64))
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def add(cls, x: Self, d: Self) -> Self:
|
|
33
|
+
"""
|
|
34
|
+
Performs pose SE3 addition, as x + d = y
|
|
35
|
+
"""
|
|
36
|
+
xq = pyquat.Quaternion(x.q)
|
|
37
|
+
dq = pyquat.Quaternion(d.q)
|
|
38
|
+
|
|
39
|
+
yp = x.p + xq.rotate(d.p)
|
|
40
|
+
yq = xq * dq
|
|
41
|
+
|
|
42
|
+
return Pose(0, yp, yq.normalised.elements)
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def sub(cls, y: Self, x: Self) -> Self:
|
|
46
|
+
"""
|
|
47
|
+
Performs pose SE3 subtraction, as x + d = y => d = y - x
|
|
48
|
+
"""
|
|
49
|
+
xq = pyquat.Quaternion(x.q)
|
|
50
|
+
yq = pyquat.Quaternion(y.q)
|
|
51
|
+
|
|
52
|
+
dp = xq.inverse.rotate(y.p - x.p)
|
|
53
|
+
dq = xq.inverse * yq
|
|
54
|
+
|
|
55
|
+
return Pose(0, dp, dq.normalised.elements)
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def interpolate(cls, a: Self, b: Self, t: float) -> Self:
|
|
59
|
+
"""
|
|
60
|
+
Interpolates between two given poses, as a * t + b * (1 - t)
|
|
61
|
+
|
|
62
|
+
:return: interpolated pose
|
|
63
|
+
"""
|
|
64
|
+
ts = a.ts + (b.ts - a.ts) * t
|
|
65
|
+
p = a.p + (b.p - a.p) * t
|
|
66
|
+
q = pyquat.Quaternion.slerp(pyquat.Quaternion(a.q), pyquat.Quaternion(b.q), t)
|
|
67
|
+
return Pose(ts, p, q.normalised.elements)
|
|
68
|
+
|
|
69
|
+
def __init__(self, ts: float, p: np.ndarray, q: np.ndarray):
|
|
70
|
+
"""
|
|
71
|
+
Represents a pose
|
|
72
|
+
|
|
73
|
+
:param ts: timestamp
|
|
74
|
+
:param p: position vector
|
|
75
|
+
:param q: orientation quaternion
|
|
76
|
+
"""
|
|
77
|
+
self.ts = ts
|
|
78
|
+
self.p = p
|
|
79
|
+
self.q = q
|
|
80
|
+
|
|
81
|
+
def matrix(self) -> np.ndarray:
|
|
82
|
+
"""
|
|
83
|
+
Returns the transformation matrix of this pose
|
|
84
|
+
|
|
85
|
+
:return: transformation matrix
|
|
86
|
+
"""
|
|
87
|
+
r = pyquat.Quaternion(self.q).rotation_matrix
|
|
88
|
+
t = self.p[:, None]
|
|
89
|
+
return np.block([[r, t], [np.zeros((1, 3), dtype=np.float64), np.ones((1, 1), dtype=np.float64)]])
|
|
90
|
+
|
|
91
|
+
def translate(self, v: np.ndarray) -> np.ndarray:
|
|
92
|
+
"""
|
|
93
|
+
Translate the given vector with the pose position
|
|
94
|
+
|
|
95
|
+
:param v: the vector to be translated
|
|
96
|
+
|
|
97
|
+
:return: translated vector
|
|
98
|
+
"""
|
|
99
|
+
return self.p + v
|
|
100
|
+
|
|
101
|
+
def rotate(self, v: np.ndarray) -> np.ndarray:
|
|
102
|
+
"""
|
|
103
|
+
Rotates the given vector with the pose orientation
|
|
104
|
+
|
|
105
|
+
:param v: the vector to be rotated
|
|
106
|
+
|
|
107
|
+
:return: rotated vector
|
|
108
|
+
"""
|
|
109
|
+
return pyquat.Quaternion(self.q).rotate(v)
|
|
110
|
+
|
|
111
|
+
def __str__(self):
|
|
112
|
+
return repr_data(self)
|
|
12
113
|
|
|
13
114
|
|
|
14
115
|
class Proj(ABC):
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
plexus/common/__init__.py,sha256=uWSQ4w3n7-zO3xJA1MTde4zbyZ73W8eVQ2EcoDzHwqc,177
|
|
2
|
-
plexus/common/
|
|
3
|
-
plexus/common/
|
|
4
|
-
plexus/common/carto/OSMFile.py,sha256=yKG0ImkUNOrOs6oiEANDKZ6KaQCTEaPSolYMVLACVB0,8136
|
|
5
|
-
plexus/common/carto/OSMNode.py,sha256=XJkp-tD945tFz3MWO5v3IdGfsjZy3YZE_yaBNc4dTdM,593
|
|
2
|
+
plexus/common/carto/OSMFile.py,sha256=niFPKMDxSrsgbRSVW1WuzIJpD1huikJo4LXgy_ufW4U,8146
|
|
3
|
+
plexus/common/carto/OSMNode.py,sha256=MYm9haPzUDWNdmT4SeR-HiC2zP09wacjT5kKP5gpfAs,603
|
|
6
4
|
plexus/common/carto/OSMTags.py,sha256=wGtdfl1gzuXMk75xU2cyeF6hwFdKADxq77fah7vrFwg,3450
|
|
7
5
|
plexus/common/carto/OSMWay.py,sha256=zqSUzn_evoYwG51ZbSOCBbzHKQ2fFIDcaToYE9SVKxE,562
|
|
8
6
|
plexus/common/carto/__init__.py,sha256=rmUEoSB4Rq3xmFGD16Y7zkjWpzbkxJgZEXt2Vnqxhws,264
|
|
@@ -16,6 +14,7 @@ plexus/common/utils/bagutils.py,sha256=X1za0tOStq5EY5qVfRbQDz7Ov-uoL53XeUuSI-EV2
|
|
|
16
14
|
plexus/common/utils/config.py,sha256=uCzSYR9W-vNNZiRJ3FdiExuUazlDXY7xJtJaY11T_bA,2401
|
|
17
15
|
plexus/common/utils/datautils.py,sha256=mgnr-dcHpw-Pk3qBud0lC3JX_pv-iKzI8llsPW9Q12g,9275
|
|
18
16
|
plexus/common/utils/dockerutils.py,sha256=WPxQuabRWyyM8wpSSYhb_HZaOw5yZ2TbU2dEQ2xRIlQ,5787
|
|
17
|
+
plexus/common/utils/gisutils.py,sha256=UR3uVoD1nAy0SWJ1AYWCUy94Lo8zNb4nv_JdpcANBDE,11462
|
|
19
18
|
plexus/common/utils/jsonutils.py,sha256=hD3cFkBll0AIH3u5FniJSVAsyZpUosgARX4ayIJmY6s,3238
|
|
20
19
|
plexus/common/utils/ormutils.py,sha256=IenV_DdgGPS7Xb3QuV0GuIYmYw0GbU4dAN2a2XDaoxs,59327
|
|
21
20
|
plexus/common/utils/pathutils.py,sha256=hGJqSLj08tuOeZ7WeC5d4BtjnPI732BuntVQBQsqOaI,9581
|
|
@@ -24,7 +23,7 @@ plexus/common/utils/sqlutils.py,sha256=D6kTBjhO5YlNRt3uFlPt6z3uH61m9ajEzPYmsI6No
|
|
|
24
23
|
plexus/common/utils/strutils.py,sha256=O9Inv4ffUTf6Xjc5ftoZwbIua1NeG7itCT9S3zjZxBc,16436
|
|
25
24
|
plexus/common/utils/tagutils.py,sha256=Ga22WnUQxVbzFtGR8XyiRiZZnaddOhdHqBNVof40pqs,44514
|
|
26
25
|
plexus/common/utils/testutils.py,sha256=GyrKOKfrl1Go8Q7tCZLybxYvVqyox1AtEFWzWoecNwg,6163
|
|
27
|
-
plexus_python_common-1.0.
|
|
28
|
-
plexus_python_common-1.0.
|
|
29
|
-
plexus_python_common-1.0.
|
|
30
|
-
plexus_python_common-1.0.
|
|
26
|
+
plexus_python_common-1.0.63.dist-info/METADATA,sha256=x1Njz90tSzZxpbdTNZHMD2IPGqmSiZxFFzoSLa9Ae40,1481
|
|
27
|
+
plexus_python_common-1.0.63.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
28
|
+
plexus_python_common-1.0.63.dist-info/top_level.txt,sha256=ug_g7CVwaMQuas5UzAXbHUrQvKGCn8ezc6ZNvvRlJOE,7
|
|
29
|
+
plexus_python_common-1.0.63.dist-info/RECORD,,
|
plexus/common/pose.py
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
from typing import Self
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
import pyquaternion as pyquat
|
|
5
|
-
from iker.common.utils.strutils import repr_data
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Pose(object):
|
|
9
|
-
@classmethod
|
|
10
|
-
def from_numbers(
|
|
11
|
-
cls,
|
|
12
|
-
px: float,
|
|
13
|
-
py: float,
|
|
14
|
-
pz: float,
|
|
15
|
-
qx: float,
|
|
16
|
-
qy: float,
|
|
17
|
-
qz: float,
|
|
18
|
-
qw: float,
|
|
19
|
-
ts: float = 0,
|
|
20
|
-
) -> Self:
|
|
21
|
-
"""
|
|
22
|
-
Constructs a pose from numbers representing position and orientation
|
|
23
|
-
"""
|
|
24
|
-
return Pose(ts, np.array([px, py, pz], dtype=np.float64), np.array([qw, qx, qy, qz], dtype=np.float64))
|
|
25
|
-
|
|
26
|
-
@classmethod
|
|
27
|
-
def add(cls, x: Self, d: Self) -> Self:
|
|
28
|
-
"""
|
|
29
|
-
Performs pose SE3 addition, as x + d = y
|
|
30
|
-
"""
|
|
31
|
-
xq = pyquat.Quaternion(x.q)
|
|
32
|
-
dq = pyquat.Quaternion(d.q)
|
|
33
|
-
|
|
34
|
-
yp = x.p + xq.rotate(d.p)
|
|
35
|
-
yq = xq * dq
|
|
36
|
-
|
|
37
|
-
return Pose(0, yp, yq.normalised.elements)
|
|
38
|
-
|
|
39
|
-
@classmethod
|
|
40
|
-
def sub(cls, y: Self, x: Self) -> Self:
|
|
41
|
-
"""
|
|
42
|
-
Performs pose SE3 subtraction, as x + d = y => d = y - x
|
|
43
|
-
"""
|
|
44
|
-
xq = pyquat.Quaternion(x.q)
|
|
45
|
-
yq = pyquat.Quaternion(y.q)
|
|
46
|
-
|
|
47
|
-
dp = xq.inverse.rotate(y.p - x.p)
|
|
48
|
-
dq = xq.inverse * yq
|
|
49
|
-
|
|
50
|
-
return Pose(0, dp, dq.normalised.elements)
|
|
51
|
-
|
|
52
|
-
@classmethod
|
|
53
|
-
def interpolate(cls, a: Self, b: Self, t: float) -> Self:
|
|
54
|
-
"""
|
|
55
|
-
Interpolates between two given poses, as a * t + b * (1 - t)
|
|
56
|
-
|
|
57
|
-
:return: interpolated pose
|
|
58
|
-
"""
|
|
59
|
-
ts = a.ts + (b.ts - a.ts) * t
|
|
60
|
-
p = a.p + (b.p - a.p) * t
|
|
61
|
-
q = pyquat.Quaternion.slerp(pyquat.Quaternion(a.q), pyquat.Quaternion(b.q), t)
|
|
62
|
-
return Pose(ts, p, q.normalised.elements)
|
|
63
|
-
|
|
64
|
-
def __init__(self, ts: float, p: np.ndarray, q: np.ndarray):
|
|
65
|
-
"""
|
|
66
|
-
Represents a pose
|
|
67
|
-
|
|
68
|
-
:param ts: timestamp
|
|
69
|
-
:param p: position vector
|
|
70
|
-
:param q: orientation quaternion
|
|
71
|
-
"""
|
|
72
|
-
self.ts = ts
|
|
73
|
-
self.p = p
|
|
74
|
-
self.q = q
|
|
75
|
-
|
|
76
|
-
def matrix(self) -> np.ndarray:
|
|
77
|
-
"""
|
|
78
|
-
Returns the transformation matrix of this pose
|
|
79
|
-
|
|
80
|
-
:return: transformation matrix
|
|
81
|
-
"""
|
|
82
|
-
r = pyquat.Quaternion(self.q).rotation_matrix
|
|
83
|
-
t = self.p[:, None]
|
|
84
|
-
return np.block([[r, t], [np.zeros((1, 3), dtype=np.float64), np.ones((1, 1), dtype=np.float64)]])
|
|
85
|
-
|
|
86
|
-
def translate(self, v: np.ndarray) -> np.ndarray:
|
|
87
|
-
"""
|
|
88
|
-
Translate the given vector with the pose position
|
|
89
|
-
|
|
90
|
-
:param v: the vector to be translated
|
|
91
|
-
|
|
92
|
-
:return: translated vector
|
|
93
|
-
"""
|
|
94
|
-
return self.p + v
|
|
95
|
-
|
|
96
|
-
def rotate(self, v: np.ndarray) -> np.ndarray:
|
|
97
|
-
"""
|
|
98
|
-
Rotates the given vector with the pose orientation
|
|
99
|
-
|
|
100
|
-
:param v: the vector to be rotated
|
|
101
|
-
|
|
102
|
-
:return: rotated vector
|
|
103
|
-
"""
|
|
104
|
-
return pyquat.Quaternion(self.q).rotate(v)
|
|
105
|
-
|
|
106
|
-
def __str__(self):
|
|
107
|
-
return repr_data(self)
|
|
File without changes
|
{plexus_python_common-1.0.62.dist-info → plexus_python_common-1.0.63.dist-info}/top_level.txt
RENAMED
|
File without changes
|