xwr
¶
TI mmWave Radar + DCA1000EVM Capture Card Raw Data Capture API.
Usage
To use the high-level API, create a XWRConfig
and DCAConfig
;
then pass these to the XWRSystem
. Use stream
or qstream
to automatically configure, start, and stream
spectrum data from the radar.
xwr.XWRSystem
¶
Bases: Generic[TRadar]
Radar capture system with a mmWave Radar and DCA1000EVM.
Known Constraints
The XWRSystem
will check for certain known constraints, and warn if
these are violated via a logger:
- Radar data throughput is greater than 80% of the capture card theoretical network throughput.
- Receive buffer size (in the linux networking stack) can hold less than 2 full frames.
- The duty cycle (active frame time / frame period) of the radar is greater than 99%.
- The ADC is still sampling when the ramp ends.
- The range-Doppler frame size is greater than 2^14.
- The number of samples per chirp (i.e., range resolution) or chirps per frame (i.e., doppler resolution) is not a power of 2.
Type Parameters
TRadar
: radar type (subclass ofXWRBase
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radar
|
XWRConfig | dict
|
radar configuration; if |
required |
capture
|
DCAConfig | dict
|
capture card configuration; if |
required |
name
|
str
|
friendly name for logging; can be default. |
'RadarCapture'
|
strict
|
bool
|
if |
False
|
Source code in src/xwr/system.py
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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
dstream
¶
dstream(numpy: Literal[False]) -> Iterator[RadarFrame]
dstream(numpy: bool = False) -> Iterator[RadarFrame | ndarray]
Stream frames, dropping any frames if the consumer gets behind.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
numpy
|
bool
|
yield a numpy array instead of a |
False
|
Yields:
Type | Description |
---|---|
RadarFrame | ndarray
|
Read frames; the iterator terminates when the capture card stream times out. |
Source code in src/xwr/system.py
qstream
¶
qstream(numpy: Literal[False] = False) -> Queue[RadarFrame | None]
qstream(
numpy: bool = False,
) -> Queue[RadarFrame | None] | Queue[ndarray | None]
Read into a queue from a threaded worker.
The threaded worker is run with daemon=True
. Like stream
,
.qstream()
also relies on another worker to trigger stop
.
Note
If a TimeoutError
is received (e.g. after .stop()
), the
error is caught, and the stream is halted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
numpy
|
bool
|
yield a numpy array instead of a |
False
|
Returns:
Type | Description |
---|---|
Queue[RadarFrame | None] | Queue[ndarray | None]
|
A queue of |
Source code in src/xwr/system.py
stop
¶
Stop by halting the capture card and reboot the radar.
In testing, we found that the radar may ignore commands if the frame timings are too tight, which prevents a soft reset. We simply reboot the radar via the capture card instead.
Warning
If you fail to .stop()
the system before exiting, the radar may
become non-responsive, and require a power cycle.
Source code in src/xwr/system.py
stream
¶
stream() -> Iterator[RadarFrame]
Iterator which yields successive frames.
Note
.stream()
does not internally terminate data collection;
another worker must call stop
.
Yields:
Type | Description |
---|---|
RadarFrame
|
Read frames; the iterator terminates when the capture card stream times out. |
Source code in src/xwr/system.py
xwr.DCAConfig
dataclass
¶
DCA1000EVM Capture card configuration.
Attributes:
Name | Type | Description |
---|---|---|
sys_ip |
str
|
system IP; should be manually configured with a subnet mask of
|
fpga_ip |
str
|
FPGA IP address; either hard-coded or configured. |
data_port |
int
|
data network port number. |
config_port |
int
|
configuration network port number. |
timeout |
float
|
Socket read timeout, in seconds. |
socket_buffer |
int
|
Network read buffer size; should be less than
|
delay |
float
|
Packet delay for the capture card, in microseconds. |
Source code in src/xwr/config.py
create
¶
create() -> DCA1000EVM
Initialize and setup capture card from this configuration.
Source code in src/xwr/config.py
xwr.XWRConfig
dataclass
¶
Radar configuration.
The TI mmWave sensing estimator may be helpful for creating a configuration.
Attributes:
Name | Type | Description |
---|---|---|
device |
type[XWRBase] | str
|
radar device type, or the name of a radar device class in
|
frequency |
float
|
base frequency, in GHz. |
idle_time |
float
|
radar timing parameters; in microseconds. |
adc_start_time |
float
|
radar timing parameters; in microseconds. |
ramp_end_time |
float
|
radar timing parameters; in microseconds. |
tx_start_time |
float
|
radar timing parameters; in microseconds. |
freq_slope |
float
|
chirp slope, in MHz/us. |
adc_samples |
int
|
number of samples per chirp. Must be a power of two. |
sample_rate |
int
|
ADC sampling rate, in KHz. |
frame_length |
int
|
number of chirps per TX antenna per frame. Must be a power of two. |
frame_period |
float
|
periodicity of frames, in ms. |
port |
str | None
|
Control serial port (usually |
Source code in src/xwr/config.py
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 |
|
as_dict
¶
Export as dictionary.