roverp.readers
¶
Data interfaces for various processed output data formats.
Warning
This module is not automatically imported; you will need to explicitly import it:
roverp.readers.Poses
dataclass
¶
Discrete sampled poses.
Attributes:
Name | Type | Description |
---|---|---|
t |
Float64[ndarray, N]
|
timestamp, in seconds. |
pos |
Float64[ndarray, 'N 3']
|
position, in meters (front-left-up coordinate convention). |
vel |
Float64[ndarray, 'N 3']
|
velocity, in meters/second. |
acc |
Float64[ndarray, 'N 3']
|
acceleration, in meters/second^2. |
rot |
Float64[ndarray, 'N 3 3']
|
rotation (as matrix). |
Source code in processing/src/roverp/readers/pose.py
as_dict
¶
roverp.readers.RawTrajectory
dataclass
¶
Raw trajectory from cartographer.
Attributes:
Name | Type | Description |
---|---|---|
xyz |
Float64[ndarray, '3 N']
|
position |
quat |
Float64[ndarray, '4 N']
|
rotation (as quaternion) |
t |
Float64[ndarray, N]
|
timestamp |
Source code in processing/src/roverp/readers/pose.py
bounds
¶
bounds(
margin_xy: float = 5.0,
margin_z: float = 5.0,
resolution: float = 50.0,
align: int = 16,
) -> tuple[Float[ndarray, 3], Float[ndarray, 3], Integer[ndarray, 3]]
Get bounds for a grid containing the extents of the trajectory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
margin_xy
|
float
|
grid margin around trajectory bounds in the horizontal plane. |
5.0
|
margin_z
|
float
|
grid margin in the vertical axis. |
5.0
|
resolution
|
float
|
resolution, in grid cells/m. |
50.0
|
align
|
int
|
grid resolution alignment; the grid will be expanded from the
specified margin until the resolution is divisible by |
16
|
Returns:
Type | Description |
---|---|
Float[ndarray, 3]
|
grid lower bound |
Float[ndarray, 3]
|
grid upper bound |
Integer[ndarray, 3]
|
grid size |
Source code in processing/src/roverp/readers/pose.py
from_csv
classmethod
¶
from_csv(path: str) -> RawTrajectory
Load trajectory.csv
output file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
path to the |
required |
Source code in processing/src/roverp/readers/pose.py
roverp.readers.Trajectory
¶
Sensor trajectory.
The provided path should be the output of our cartographer processing pipeline, with the following columns:
field.header.stamp
(in ns)field.transform.translation.{xyz}
(meters)field.transform.rotation.{xyzw}
(quaternion, in xyzw order)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to cartographer output |
required |
smoothing
|
float
|
Smoothing coefficient passed to |
10.0
|
start_threshold
|
float
|
Start threshold in meters; the trace is started when
the sensor moves more than |
1.0
|
filter_size
|
int
|
applies a median filter to the start distance to handle any initalization jitter. |
5
|
Source code in processing/src/roverp/readers/pose.py
interpolate
¶
Interpolate trajectory to target timestamps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
Float64[ndarray, N]
|
input timestamps; can be in an arbitrary order. |
required |
Returns:
Type | Description |
---|---|
Poses
|
Output poses; only indluces poses with valid timestamps. |
Bool[ndarray, N]
|
A mask indicating valid timestamps. |
Source code in processing/src/roverp/readers/pose.py
roverp.readers.VoxelGrid
¶
Bases: NamedTuple
Voxel grid of intensities.
Attributes:
Name | Type | Description |
---|---|---|
data |
Float[ndarray, 'Nx Ny Nz']
|
voxel grid values. |
lower |
Float[ndarray, 3]
|
coordinate of lower corner. |
resolution |
Float[ndarray, 3]
|
resolution in units/m for each axis. |
Source code in processing/src/roverp/readers/voxelgrid.py
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 |
|
as_pcd
¶
Save as a .pcd file.
Warning
This method requires pypcd4
to be installed, e.g. via the pcd
extra:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
output path (ending with .pcd). |
required |
mask
|
Bool[ndarray, 'Nx Ny Nz']
|
pointcloud mask. |
required |
cmap
|
str
|
pointcloud colors. |
'inferno'
|
Source code in processing/src/roverp/readers/voxelgrid.py
as_ply
¶
Save as a .ply file.
Warning
This method requires plyfile
to be installed, e.g. via the ply
extra:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
output path (ending with .ply). |
required |
mask
|
Bool[ndarray, 'Nx Ny Nz']
|
pointcloud mask. |
required |
cmap
|
str
|
pointcloud colors. |
'inferno'
|
Source code in processing/src/roverp/readers/voxelgrid.py
as_pointcloud
¶
as_pointcloud(
mask: Bool[ndarray, "Nx Ny Nz"], cmap: str = "inferno"
) -> tuple[Float[ndarray, 3], UInt8[ndarray, 3]]
Convert voxel grid to point cloud.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
Bool[ndarray, 'Nx Ny Nz']
|
mask of voxels to include. |
required |
cmap
|
str
|
matplotlib colormap to use. |
'inferno'
|
Returns:
Name | Type | Description |
---|---|---|
xyz |
Float[ndarray, 3]
|
point positions. |
rgb |
UInt8[ndarray, 3]
|
point colors. |
Source code in processing/src/roverp/readers/voxelgrid.py
cfar
¶
Get CFAR conv comparison values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guard_band
|
int
|
CFAR guard band size. |
1
|
window_size
|
int
|
CFAR window shape. |
3
|
convolve_func
|
convolution backend to use. |
convolve
|
Source code in processing/src/roverp/readers/voxelgrid.py
crop
¶
crop(
left: tuple[int, int, int] | None = None,
right: tuple[int, int, int] | None = None,
) -> VoxelGrid
Crop voxel grid by integer lower and upper indices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left
|
tuple[int, int, int] | None
|
lower indices. |
None
|
right
|
tuple[int, int, int] | None
|
upper; |
None
|
Source code in processing/src/roverp/readers/voxelgrid.py
from_npz
classmethod
¶
Load voxel grid, applying decimation factor if specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
path to |
required |
key
|
str
|
field to load. |
'sigma'
|
decimate
|
int
|
decimation factor to apply. |
1
|
Source code in processing/src/roverp/readers/voxelgrid.py
normalize
¶
Normalize to (0, 1).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left
|
float
|
lower percentile to clip to. |
10.0
|
right
|
float
|
upper percentile to clip to. |
99.9
|