Frame Handler APIs¶
FrameHandler
¶
Source code in t265/FrameHandler.py
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
__init__(frame_name)
¶
Create a new FrameHandler object to manage the transformation between frames.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_name |
str
|
The unique identifier of the frame. |
required |
Source code in t265/FrameHandler.py
set_frame_transformation(trans=None, rot=None, rot_format='quat', degrees=False, T=None)
¶
Define the transformation matrix for this frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trans |
array
|
The translation vector [x, y, z]. Defaults to zero vector if not provided. |
None
|
rot |
array
|
The rotation, represented as either a quaternion or Euler angles. Defaults to identity matrix if not provided. |
None
|
rot_format |
str
|
The format of the rotation (e.g., 'quat', 'matrix', 'xyz'). Defaults to 'quat'. |
'quat'
|
degrees |
bool
|
Indicates whether the rotation angles are in degrees. Defaults to False (i.e., angles are in radians). |
False
|
T |
array
|
A precomputed 4x4 transformation matrix. If provided, 'trans' and 'rot' will be ignored. Defaults to None. |
None
|
Source code in t265/FrameHandler.py
set_init_frame(trans=None, rot=None, rot_format='quat', degrees=False, T=None)
¶
Define the initial frame for the transformation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trans |
array
|
The translation vector [x, y, z]. Defaults to zero vector if not provided. |
None
|
rot |
array
|
The rotation, represented as either a quaternion or Euler angles. Defaults to identity matrix if not provided. |
None
|
rot_format |
str
|
The format of the rotation (e.g., 'quat', 'matrix', 'xyz'). Defaults to 'quat'. |
'quat'
|
degrees |
bool
|
Indicates whether the rotation angles are in degrees. Defaults to False (i.e., angles are in radians). |
False
|
T |
array
|
A precomputed 4x4 transformation matrix. If provided, 'trans' and 'rot' will be ignored. Defaults to None. |
None
|
Source code in t265/FrameHandler.py
convert(current_camera_frame, T_mat=True, angular=None, linear=None)
¶
Apply the frame transformation to the given frame, resulting in a transformed frame and, optionally, angular and linear velocities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_camera_frame |
array
|
4x4 transformation matrix of the current camera frame. |
required |
T_mat |
bool
|
If True, the resulting transformed frame matrix is included in the return tuple. Defaults to True. |
True
|
angular |
bool
|
If True, the transformed angular velocity is included in the return tuple. Defaults to True. |
None
|
linear |
bool
|
If True, the transformed linear velocity is included in the return tuple. Defaults to True. |
None
|
Returns:
Name | Type | Description |
---|---|---|
tuple |
A tuple containing the transformed frame, angular velocity, and linear velocity as requested. The order of the returned items is as follows: transformed frame, angular velocity, linear velocity. |
Source code in t265/FrameHandler.py
transform(current_camera_frame, return_all_frames=False)
¶
Apply the frame transformation to the given frame, resulting in a transformed frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_camera_frame |
array
|
4x4 transformation matrix of the current camera frame. |
required |
return_all_frames |
bool
|
If True, returns a tuple of all intermediate transformation matrices. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
np.array or tuple: If return_all_frames is False, this function returns a 4x4 transformation matrix to the target frame. If True, it returns a tuple containing all intermediate transformation matrices used in the process. |
Source code in t265/FrameHandler.py
transform_velocity(current_camera_frame, angular, linear)
¶
Transforms velocity components from the current camera frame to the target frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_camera_frame |
array
|
4x4 transformation matrix of the current camera frame. |
required |
angular |
array
|
Angular velocity vector [wx, wy, wz] in the initial frame. |
required |
linear |
array
|
Linear velocity vector [vx, vy, vz] in the initial frame. |
required |
Returns:
Type | Description |
---|---|
np.array: The transformed velocity vector [wx', wy', wz', vx', vy', vz'] in the target frame. |