File size: 3,713 Bytes
da2e2ac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
from enum import IntEnum
class StateSE2Index(IntEnum):
_X = 0
_Y = 1
_HEADING = 2
@classmethod
def size(cls):
valid_attributes = [
attribute
for attribute in dir(cls)
if attribute.startswith("_")
and not attribute.startswith("__")
and not callable(getattr(cls, attribute))
]
return len(valid_attributes)
@classmethod
@property
def X(cls):
return cls._X
@classmethod
@property
def Y(cls):
return cls._Y
@classmethod
@property
def HEADING(cls):
return cls._HEADING
@classmethod
@property
def POINT(cls):
# assumes X, Y have subsequent indices
return slice(cls._X, cls._Y + 1)
@classmethod
@property
def STATE_SE2(cls):
# assumes X, Y, HEADING have subsequent indices
return slice(cls._X, cls._HEADING + 1)
class BoundingBoxIndex(IntEnum):
_X = 0
_Y = 1
_Z = 2
_LENGTH = 3
_WIDTH = 4
_HEIGHT = 5
_HEADING = 6
@classmethod
def size(cls):
valid_attributes = [
attribute
for attribute in dir(cls)
if attribute.startswith("_")
and not attribute.startswith("__")
and not callable(getattr(cls, attribute))
]
return len(valid_attributes)
@classmethod
@property
def X(cls):
return cls._X
@classmethod
@property
def Y(cls):
return cls._Y
@classmethod
@property
def Z(cls):
return cls._Z
@classmethod
@property
def LENGTH(cls):
return cls._LENGTH
@classmethod
@property
def WIDTH(cls):
return cls._WIDTH
@classmethod
@property
def HEIGHT(cls):
return cls._HEIGHT
@classmethod
@property
def HEADING(cls):
return cls._HEADING
@classmethod
@property
def POINT2D(cls):
# assumes X, Y have subsequent indices
return slice(cls._X, cls._Y + 1)
@classmethod
@property
def POSITION(cls):
# assumes X, Y, Z have subsequent indices
return slice(cls._X, cls._Z + 1)
@classmethod
@property
def DIMENSION(cls):
# assumes LENGTH, WIDTH, HEIGHT have subsequent indices
return slice(cls._LENGTH, cls._HEIGHT + 1)
class LidarIndex(IntEnum):
_X = 0
_Y = 1
_Z = 2
_INTENSITY = 3
_RING = 4
_ID = 5
@classmethod
def size(cls):
valid_attributes = [
attribute
for attribute in dir(cls)
if attribute.startswith("_")
and not attribute.startswith("__")
and not callable(getattr(cls, attribute))
]
return len(valid_attributes)
@classmethod
@property
def X(cls):
return cls._X
@classmethod
@property
def Y(cls):
return cls._Y
@classmethod
@property
def Z(cls):
return cls._Z
@classmethod
@property
def INTENSITY(cls):
return cls._INTENSITY
@classmethod
@property
def RING(cls):
return cls._RING
@classmethod
@property
def ID(cls):
return cls._ID
@classmethod
@property
def POINT2D(cls):
# assumes X, Y have subsequent indices
return slice(cls._X, cls._Y + 1)
@classmethod
@property
def POSITION(cls):
# assumes X, Y, Z have subsequent indices
return slice(cls._X, cls._Z + 1)
|