# Radar Payload

## Overview

The Doppler radar enables speed and direction measurement to be collected and added to events.

### Hardware

{% hint style="info" %}
See [Recommended Hardware](/build-your-own-device-diy/recommended-hardware.md#radar) for more information on selecting a radar unit.
{% endhint %}

The [OPS243-A](https://omnipresense.com/product/ops243-doppler-radar-sensor/) radar from [OmniPreSense](https://omnipresense.com/):&#x20;

> OmniPreSense’s OPS243 is complete short-range radar (SRR) solution providing motion detection, speed, direction, and range reporting. All radar signal processing is done on board and a simple API reports the processed data.

### Software

The OPS243 radar sensors include an easy-to-use [API interface](https://omnipresense.com/wp-content/uploads/2023/06/AN-010-Y_API_Interface.pdf) for returning a variety of radar readings and calculated values in JSON format. By default, we capture all of these values in separate tables:

* **DetectedObjectVelocity** (command `ON`).&#x20;
  * [#radar\_dov-table](#radar_dov-table "mention")
  * Sensor determines if an object is present by looking for 2 consecutive speed reports. If met, the max speed detected is reported. If a faster speed is detected, additional speeds are reported. This lowers the number of speed reports for a given detected object. Use On to turn the mode off.
* **TimedSpeedCounts** (command @O).&#x20;
  * [#radar\_timed\_speed\_counts-table](#radar_timed_speed_counts-table "mention").&#x20;
  * Sensor counts and reports the cumulative number of objects (defined by DetectedObjectVelocity) that have gone by in a given period. Default TM setting is reporting every 300-seconds.
* **Raw Speed Magnitude** (command `OS`).&#x20;
  * [#radar\_raw\_speed\_magnitude-table](#radar_raw_speed_magnitude-table "mention") and [#radar\_raw\_speed\_magnitude\_single-table](#radar_raw_speed_magnitude_single-table "mention")
  * Reports magnitude and associated speed of each reading. The magnitude is a measure of the size, distance, and reflectivity of the object detected. By default, TM captures the 3-burst speed/magnitude pairs and the single strongest magnitude and associated speed in separate tables for deep dive and easier analysis, respectively.
* **Vehicle Length** (command `OC`).&#x20;
  * Note: *Requires Firmware OPS9243.*&#x20;
  * [#radar\_oc\_payload-table](#radar_oc_payload-table "mention")
  * From the docs: *Provides several parameters which can help identify the vehicle type and/or lane in which the vehicle is located*. This includes start/end time, frames, min/max MPH, magnitude, and length calculations.

## Radar Database

The following attributes are captured, by default, into `tmdb.events.sqlite`:

### radar\_dov table

| Attribute      | Description                                                                                                                                                   | SQLite data type  | Valid values                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------- |
| time           | Unix timestamp directly from radar                                                                                                                            | REAL              | Unix timestamp in Seconds                                                                 |
| unit           | Unit of measure for velocity/speed set on radar (configurable)                                                                                                | TEXT              | "mph"                                                                                     |
| direction      | Object moving direction relative to radar placement; i.e. "outbound" is moving away from radar.                                                               | TEXT              | "outbound" or "inbound"                                                                   |
| velocity       | <p>Maximum speed/velocity calculated for all measurements object was detected in the radar zone.<br>`DetectedObjectVelocity` from API</p>                     | REAL              | Integer, Positive, Negative corresponding to inbound and outbound direction, respectively |
| radarName      | Radar sensor that captured the data. This field is used to associate with cameras and other radars.                                                           | TEXT              |                                                                                           |
| deployment\_id | Each ID represents a unique deployment configuration and/or location for the device. This acts a foreign key link to the \`deployment\` table, \`id\` column. | TEXT, FOREIGN KEY | \`deployment\`.\`id\` foreign key, may be null                                            |

### radar\_timed\_speed\_counts table

| Attribute      | Description                                                                                                                                                   | SQLite data type  | Valid values                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------- |
| time           | Unix timestamp directly from radar                                                                                                                            | REAL              | Unix timestamp in Seconds                                                                 |
| direction      | Object moving direction relative to radar placement; i.e. "outbound" is moving away from radar.                                                               | TEXT              | "outbound" or "inbound"                                                                   |
| units          | Unit of measure for velocity/speed set on radar (configurable)                                                                                                | TEXT              | "mph"                                                                                     |
| count          | Number of object detection (DOV) measurements; should correspond to number of objects/vehicles that passed through radar zone                                 | INTEGER           | Integer, positive                                                                         |
| average        | Average speed/velocity across all object detections (count) during measurement interval; defined by \`units\` attribute                                       | REAL              | Integer, Positive, Negative corresponding to inbound and outbound direction, respectively |
| radarName      | Radar sensor that captured the data. This field is used to associate with cameras and other radars.                                                           | TEXT              |                                                                                           |
| deployment\_id | Each ID represents a unique deployment configuration and/or location for the device. This acts a foreign key link to the \`deployment\` table, \`id\` column. | TEXT, FOREIGN KEY | \`deployment\`.\`id\` foreign key, may be null                                            |

### radar\_raw\_speed\_magnitude table

| Attribute      | Description                                                                                                                                                                                                                    | SQLite data type  | Valid values                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- | -------------------------------------------------------------------------------- |
| time           | Unix timestamp directly from radar                                                                                                                                                                                             | REAL              | Unix timestamp in Seconds                                                        |
| unit           | Unit of measure for velocity/speed set on radar (configurable)                                                                                                                                                                 | TEXT              | "mph"                                                                            |
| magnitude      | Array of individual magnitude measurements for the sampling time depending on K+ setting; e.g. one speed represents \~50-ms at 20k samples. Corresponds to speed's array location in descending order of speed (configurable). | TEXT              | Positive                                                                         |
| speed          | Array of individual Speed/velocity for the sampling time depending on K+ setting; e.g. one speed represents \~50-ms at 20k samples. Corresponds to magnitude's array location in descending order of speed (configurable).     | REAL              | Positive, Negative corresponding to inbound and outbound direction, respectively |
| radarName      | Radar sensor that captured the data. This field is used to associate with cameras and other radars.                                                                                                                            | TEXT              |                                                                                  |
| deployment\_id | Each ID represents a unique deployment configuration and/or location for the device. This acts a foreign key link to the \`deployment\` table, \`id\` column.                                                                  | TEXT, FOREIGN KEY | \`deployment\`.\`id\` foreign key, may be null                                   |

### radar\_raw\_speed\_magnitude\_single table

| Attribute      | Description                                                                                                                                                                                                                    | SQLite data type  | Valid values                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- | -------------------------------------------------------------------------------- |
| time           | Unix timestamp directly from radar                                                                                                                                                                                             | REAL              | Unix timestamp in Seconds                                                        |
| unit           | Unit of measure for velocity/speed set on radar (configurable)                                                                                                                                                                 | TEXT              | "mph"                                                                            |
| magnitude      | Array of individual magnitude measurements for the sampling time depending on K+ setting; e.g. one speed represents \~50-ms at 20k samples. Corresponds to speed's array index==0 in descending order of speed (configurable). | REAL              | Positive                                                                         |
| speed          | Array of individual Speed/velocity for the sampling time depending on K+ setting; e.g. one speed represents \~50-ms at 20k samples. Corresponds to magnitude's array index==0 in descending order of speed (configurable).     | REAL              | Positive, Negative corresponding to inbound and outbound direction, respectively |
| radarName      | Radar sensor that captured the data. This field is used to associate with cameras and other radars.                                                                                                                            | TEXT              |                                                                                  |
| deployment\_id | Each ID represents a unique deployment configuration and/or location for the device. This acts a foreign key link to the \`deployment\` table, \`id\` column.                                                                  | TEXT, FOREIGN KEY | \`deployment\`.\`id\` foreign key, may be null                                   |

### radar\_oc\_payload table

| Attribute             | Description                                                                                                                                                                                                                                                                                                                                                          | SQLite data type  | Valid values                                                                          |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------- |
| start\_time           | Unix timestamp directly from radar                                                                                                                                                                                                                                                                                                                                   | REAL              | Unix timestamp in Seconds                                                             |
| end\_time             | Unix timestamp directly from radar                                                                                                                                                                                                                                                                                                                                   | REAL              | Unix timestamp in Seconds                                                             |
| delta\_time\_msec     | Different in end and start times in milliseconds, representing the amount of time the object was in the radar zone: i.e. \`end\_time\` minus \`start\_time\` \* 1000                                                                                                                                                                                                 | REAL              |                                                                                       |
| direction             | Object moving direction relative to radar placement; i.e. "outbound" is moving away from radar.                                                                                                                                                                                                                                                                      | TEXT              | inbound, outbound                                                                     |
| frames\_count         | Number of frames, defined by doppler pings (equivalent to OS) for an object through the field of view (FOV)                                                                                                                                                                                                                                                          | INTEGER           |                                                                                       |
| velocity\_max         | Maximum velocity/speed of object through field of view (FOV)                                                                                                                                                                                                                                                                                                         | REAL              |                                                                                       |
| velocity\_min         | Minimum velocity/speed of object through field of view (FOV)                                                                                                                                                                                                                                                                                                         | REAL              |                                                                                       |
| magnitude\_max        | Maximium magnitude of doppler radar response of object through field of view (FOV)                                                                                                                                                                                                                                                                                   | REAL              |                                                                                       |
| magnitude\_mean       | Average / mean magnitude of doppler radar response of object through field of view (FOV)                                                                                                                                                                                                                                                                             | REAL              |                                                                                       |
| velocity\_change      | Delta max\_speed – min\_speed. This can help with indication of the lane a vehicle is in. A vehicle farther to the edge of the FoV will have a higher cosine error change and therefore delta speed. This should be normalized to speed so offline we’ve used (max\_speed – min\_speed)/max\_speed. A lower number tends to show a vehicle in the farther lane over. | REAL              |                                                                                       |
| frames\_per\_velocity | Number of frames captured per unit of velocity. This acts as the inverse to speed in order to calculate length of object. Calculated as \`frames\_count / velocity\_max\`                                                                                                                                                                                            | REAL              |                                                                                       |
| object\_length        | Estimted length of object, calculated by taking speed and time through field of view.                                                                                                                                                                                                                                                                                | REAL              |                                                                                       |
| units                 | Velocity unit of measurement. Will also match length units, relatively.                                                                                                                                                                                                                                                                                              | TEXT              | mph, mps - for Miles Per Hour (imperial) and Meters Per Second (metric), respectively |
| object\_label         | RESERVE FOR FUTURE USE. Radar-based classification for the type of object that moved through the field of view. This is estimated from common roadway-based objects. Payload is a JSON object containing key:value of the top -calculated labels and respective likelihood score.                                                                                    | TEXT, JSON        | JSON object with key:value pairs; e.g. {"car": 0.86, "bike": 0.25, "person": 0.10}    |
| radarName             | Radar sensor that captured the data. This field is used to associate with cameras and other radars.                                                                                                                                                                                                                                                                  | TEXT              |                                                                                       |
| deployment\_id        | Each ID represents a unique deployment configuration and/or location for the device. This acts a foreign key link to the \`deployment\` table, \`id\` column.                                                                                                                                                                                                        | TEXT, FOREIGN KEY | \`deployment\`.\`id\` foreign key, may be null                                        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trafficmonitor.ai/data-and-payloads/radar-payload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
