Skip to content

Data Structures

DepthData pydantic-model ¤

data: ndarray pydantic-field required ¤

Array of size (WIDTH, HEIGHT, 3)

__config__ ¤

Config ¤

__json_encoder__(obj) special staticmethod ¤

IMUData pydantic-model ¤

accelerometer: Vector3D pydantic-field ¤

Linear acceleration in m/s^2

gyroscope: Vector3D pydantic-field ¤

Angular velocity in rad/sec

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

Location pydantic-model ¤

x: float pydantic-field required ¤

Distance in meters from origin to spot on X axis

y: float pydantic-field required ¤

Distance in meters from origin to spot on Y axis

z: float pydantic-field required ¤

Distance in meters from origin to spot on Z axis

__config__ ¤

__add__(self, other) special ¤

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
31
32
33
def __add__(self, other):
    """"""
    return Location(x=self.x + other.x, y=self.y + other.y, z=self.z + other.z)

__json_encoder__(obj) special staticmethod ¤

__str__(self) special ¤

Return str(self).

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
35
36
def __str__(self):
    return f"{self.x:.3},{self.y:.3},{self.z:.3}"

distance(self, other_location) ¤

Euclidean distance between current location and other location

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
24
25
26
27
28
29
def distance(self, other_location):
    """Euclidean distance between current location and other location"""
    return distance.euclidean(
        (self.x, self.y, self.z),
        (other_location.x, other_location.y, other_location.z),
    )

to_array(self) ¤

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
38
39
def to_array(self) -> np.array:
    return np.array([self.x, self.y, self.z])

RGBData pydantic-model ¤

data: ndarray pydantic-field required ¤

Array of size (WIDTH, HEIGHT, 3)

__config__ ¤

Config ¤

__json_encoder__(obj) special staticmethod ¤

Rotation pydantic-model ¤

pitch: float pydantic-field required ¤

Degree around the Y-axis

roll: float pydantic-field required ¤

Degree around the X-axis

yaw: float pydantic-field required ¤

Degree around the Z-axis

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

__str__(self) special ¤

Return str(self).

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
47
48
def __str__(self):
    return f"{self.pitch},{self.yaw},{self.roll}"

to_array(self) ¤

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
50
51
def to_array(self) -> np.array:
    return np.array([self.pitch, self.yaw, self.roll])

SensorsData pydantic-model ¤

front_depth: DepthData pydantic-field ¤

front_rgb: RGBData pydantic-field ¤

imu_data: IMUData pydantic-field ¤

rear_rgb: RGBData pydantic-field ¤

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

Transform pydantic-model ¤

location: Location pydantic-field ¤

rotation: Rotation pydantic-field ¤

__config__ ¤

__json_encoder__(obj) special staticmethod ¤

get_matrix(self) ¤

Calculate extrinsics matrix with respect to parent object http://planning.cs.uiuc.edu/node104.html

Returns:

Type Description
ndarray

Extrinsics matrix

Source code in ROAR_simulation/roar_autonomous_system/utilities_module/data_structures_models.py
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
def get_matrix(self) -> np.ndarray:
    """
    Calculate extrinsics matrix with respect to parent object
    http://planning.cs.uiuc.edu/node104.html

    Returns:
        Extrinsics matrix
    """
    location = self.location
    rotation = self.rotation
    yaw, pitch, roll = rotation.yaw, rotation.pitch, rotation.roll
    c_y = np.cos(np.radians(yaw))
    s_y = np.sin(np.radians(yaw))
    c_r = np.cos(np.radians(roll))
    s_r = np.sin(np.radians(roll))
    c_p = np.cos(np.radians(pitch))
    s_p = np.sin(np.radians(pitch))

    matrix = np.identity(4)
    matrix[0, 3] = location.x
    matrix[1, 3] = location.y
    matrix[2, 3] = location.z
    matrix[0, 0] = c_p * c_y
    matrix[0, 1] = c_y * s_p * s_r - s_y * c_r
    matrix[0, 2] = -c_y * s_p * c_r - s_y * s_r
    matrix[1, 0] = s_y * c_p
    matrix[1, 1] = s_y * s_p * s_r + c_y * c_r
    matrix[1, 2] = -s_y * s_p * c_r + c_y * s_r
    matrix[2, 0] = s_p
    matrix[2, 1] = -c_p * s_r
    matrix[2, 2] = c_p * c_r
    return matrix

Vector3D pydantic-model ¤

x: float pydantic-field ¤

y: float pydantic-field ¤

z: float pydantic-field ¤

__config__ ¤

__json_encoder__(obj) special staticmethod ¤