Data Transforms¶
Data transformations and compatibility layers.
roverd.transforms.ouster
¶
Ouster Lidar transforms.
Warning
This module is not automatically imported; you will need to explicitly import it:
This is a pure-numpy reimplementation of the subset of the ouster-sdk
lidar projection API (SensorInfo, destagger, XYZLut) required by
Destagger and
PointCloud, since ouster-sdk is
an unstable dependency which we would like to avoid requiring.
The projection math follows the "Lidar Range Data to Cartesian Coordinates"
algorithm described in the Ouster Software User Guide, and has been
validated to reproduce ouster.sdk.client.XYZLut bit-for-bit (up to
floating point error) on the sensor metadata this codebase generates.
roverd.transforms.ouster.ConfigCache
¶
Ouster sensor intrinsics cache.
Source code in format/src/roverd/transforms/ouster.py
__getitem__
¶
__getitem__(path: str) -> LidarIntrinsics
Get sensor intrinsics by path.
- First checks if we have
LidarIntrinsicsloaded already for the given path. - If not, we then check if we have
LidarIntrinsicsloaded with an identical configuration. - If neither is found, we read the file and parse a new
LidarIntrinsics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the sensor intrinsics file. |
required |
Returns:
| Type | Description |
|---|---|
LidarIntrinsics
|
Parsed lidar intrinsics. |
Source code in format/src/roverd/transforms/ouster.py
roverd.transforms.ouster.Destagger
¶
Bases: Transform[OSDepth, Depth]
Destagger Ouster Lidar depth data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ConfigCache | None
|
if provided, use this configuration cache (to share with other transforms). |
None
|
Source code in format/src/roverd/transforms/ouster.py
__call__
¶
Destagger Ouster Lidar depth data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
OSDepth
|
Ouster Lidar depth data with staggered measurements. |
required |
Returns:
| Type | Description |
|---|---|
Depth
|
Depth data with destaggered measurements. |
Source code in format/src/roverd/transforms/ouster.py
roverd.transforms.ouster.LidarIntrinsics
dataclass
¶
Parsed Ouster lidar sensor metadata (lidar.json).
Only the fields required for destaggering and XYZ projection are kept; see the Ouster sensor metadata reference for the full schema.
Attributes:
| Name | Type | Description |
|---|---|---|
pixels_per_column |
int
|
number of beams. |
columns_per_frame |
int
|
number of measurements ("ticks") per rotation. |
pixel_shift_by_row |
Int64[ndarray, beam]
|
per-beam staggering offset, in columns. |
beam_altitude_angles |
Float64[ndarray, beam]
|
per-beam altitude angle, in degrees. |
beam_azimuth_angles |
Float64[ndarray, beam]
|
per-beam azimuth firing offset, in degrees. |
beam_to_lidar_transform |
Float64[ndarray, '4 4']
|
|
lidar_to_sensor_transform |
Float64[ndarray, '4 4']
|
|
Source code in format/src/roverd/transforms/ouster.py
from_json
classmethod
¶
from_json(cfg: str) -> LidarIntrinsics
Parse lidar intrinsics from a lidar.json metadata string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
LidarIntrinsics
|
Parsed lidar intrinsics. |
Source code in format/src/roverd/transforms/ouster.py
roverd.transforms.ouster.PointCloud
¶
Bases: Transform[OSDepth, PointCloud]
Calculate point cloud from Ouster Lidar depth data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_range
|
float | None
|
minimum range to include in the point cloud; if |
None
|
Source code in format/src/roverd/transforms/ouster.py
__call__
¶
__call__(data: OSDepth) -> PointCloud
Convert Ouster Lidar depth data to point cloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
OSDepth
|
Ouster Lidar depth data with staggered measurements. |
required |
Returns:
| Type | Description |
|---|---|
PointCloud
|
Point cloud data. |
Source code in format/src/roverd/transforms/ouster.py
roverd.transforms.ros
¶
Rover to rosbag conversion.
Warning
This module is not automatically imported; you will need to explicitly import it:
You will also need to have the ros extra installed.
roverd.transforms.ros.rover_to_rosbag
¶
rover_to_rosbag(
out: str, imu: IMU, lidar: OSLidarDepth, min_range: float | None = None
) -> None
Write lidar and IMU data to a ros bag (to run SLAM, e.g., cartographer).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
str
|
output rosbag file path. |
required |
imu
|
IMU
|
IMU sensor. |
required |
lidar
|
OSLidarDepth
|
Lidar sensor. |
required |
min_range
|
float | None
|
minimum range for lidar points. |
None
|
Source code in format/src/roverd/transforms/ros.py
roverd.transforms.ros.ts_sec_ns
¶
Convert float64 timestamp to seconds, ns remainder, and ns timestamp.