Obstacle Detection AOP Users Guide

Table of Contents

Overview

This lab demonstrates the use of TI mmWave sensors to detect objects that are within close proximity of a vehicle. Using the AWR1843-AoP (Antenna on Package) device, algorithms run onboard the single-chip device to create Range-Azimuth and Range-Elevation heatmaps, then performs object detection with CFAR, angle of arrival estimation and clustering on configured range rows in the heatmaps.

This version of the lab also supports a secondary peak search, so that more than one peak can be detected on a single range bin.

Quickstart

The quickstart contains:

1. Hardware and Software Requirements

Hardware

Item Details
Device AWR1843 AoP EVM
Computer PC with Windows 7 or 10. If a laptop is used, please use the ‘High Performance’ power plan in Windows. 2.4Ghz processor, 8GB RAM recommended.
Micro USB Cable USB 2.0 to Micro USB.
Power Supply 5V, 3A with 2.1-mm barrel jack (center positive). The power supply can be wall adapter style or a battery pack with a USB to barrel jack cable.

Software

Tool Version Required For Details
MATLAB Runtime 2017a (9.2) GUI Visualizer To run the quickstart visualizer the runtime is sufficient.
TI mmWave SDK 3.5.0.4 Firmware Source Code The latest TI mmWave SDK and all the related tools are required to be installed as specified in the mmWave SDK release notes
TI Emulators package 7.0.188.0 or later - Upgrade to the latest using CCS update process (see SDK user guide for more details)
ODS Design Document n/a More Details /Info TI Design

2. Physical Setup

For best results, the EVM should be positioned at car door height, with no objects in the configured range of the sensor except those objects that are under test.

In order to provide +/-70deg FOV in azimuth and +/-70deg FOV in elevation, the AoP EVM must be placed with antenna at the top as shown in the following picture. This positions the Tx antennas vertically along the left side of the chip with the Rx antennas along the top.

3. Flash the Device

Image Location
Meta Image 1/RadarSS <RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Automotive_Body_Sensors\obstacle_detection_aop\prebuilt_binaries\ods_aop_18xx.bin

Steps for flashing via uniflash can be found here

4. Run the Lab Visualizer

Before running the demo, you will need to know the COM port numbers for the EVM’s User and Data UART ports. This is discussed in the pulldown section above titled “Expand for help using Uniflash”. Once found, the COM port numbers will usually not change from run to run or boot to boot. You can run the visualizer either from DOS or within Matlab:

Program File Purpose
ods_3d_visualizer.m Running within Matlab
ods_3d_visualizer.exe Running from a DOS command window

To start the radar chirp processing, perform the following steps:

To modify the display, the widgets in the “Plot Settings” window can be modified:

To modify the rendered image orientation and size:

5. Understanding the Output

By default, detected objects and clusters are displayed. Detected objects are shown as dots in the 3D space, and clusters are shown as boxes. Cluster box sizes are obtained from the DSP’s clustering algorithm. Detected objects are updated at the configured frame rate, and clusters are updated at a slower rate, typically once every four frames. Note that detected objects and clusters can be disabled from being output from the EVM. This is enabled in the “guiMonitor” command, discussed in the “Visualizer Source Files” section below.

First, there is a banner line over the plot area. This banner displays the current frame number, the number of detected objects for the frame, and the number of clusters for the current frame. The number in parentheses is the number of clusters that are derived from a single point.

The detected object (dot) colors are determined by their Z distance (height) from the antenna. Cluster colors are red if the center is within 1 meter of the antenna, and green if outside 1 meter.

Each 2D display shows a flat projection along two of the three planes. Shown here is the “top-down” display that shows objects and clusters in the X-Y plane. Object point colors are still rendered according to Z position:

Developer’s Guide

Building the Firmware from Source Code

1. Prerequisites for Firmware

🛑 The software prerequisites must be met before continuing!

To verify proper installations, navigate to C:\ti and ensure that the following tools have been installed in the EXACT directory specified.

Tool Version Folder Path Download link & Details
CCS 7.3 or later C:\ti\ccsv7 Download link Note: CCSv6.x cannot be used
mmWave SDK 03.05.00.04 C:\ti\mmwave_sdk_03_05_00_04 Download Link
TI SYS/BIOS 6.73.01.01 C:\ti\bios_6_73_01_01 Included in mmwave sdk installer
TI ARM compiler 16.9.6.LTS C:\ti\ti-cgt-arm_16.9.6.LTS Included in mmwave sdk installer
TI DSP compiler 8.3.3 C:\ti\ti-cgt-c6000_8.3.3 Included in mmwave sdk installer
XDC 3.50.8.24 C:\ti\xdctools_3_50_08_24_core Included in mmwave sdk installer
C64x+ DSPLIB 3.4.0.0 C:\ti\dsplib_c64Px_3_4_0_0 Included in mmwave sdk installer
C674x DSPLIB 3.4.0.0 C:\ti\dsplib_c674x_3_4_0_0 Included in mmwave sdk installer
C674x MATHLIB 3.1.2.1 C:\ti\mathlib_c674x_3_1_2_1 Included in mmwave sdk installer
TI Emulators package 7.0.188.0 or later - Upgrade to the latest using CCS update process (see SDK user guide for more details)

2. Import Lab Project

For the Obstacle Detection lab there are two projects, the DSS for the C674x DSP core and the MSS project for the R4F core. Both need to be imported to CCS and compiled to generate firmware for the xWR1843.

When importing projects to a workspace, a copy is created in the workspace. All modifications will only be implemented for the workspace copy. The original project downloaded from the Toolbox is not touched.

3. Build the Lab

Build DSS Project

The DSS project must be built before the MSS project.

⚠️ The DSS project must be built using compiler version 8.3.3.
To check the build settings, select ods_aop_18xx_dss and right click on the project to select Show build settings…. Under the General tab, the Advanced Settings section has a drop down menu for Compiler Version. Ensure that it reads TI v8.3.3.

With the ods_aop_18xx_dss project selected in Project Explorer, right click on the project and select Rebuild Project. Selecting Rebuild instead of Build ensures that the project is always re-compiled. This is especially important in case the previous build failed with errors.

Successful DSS Project Build In the Project Explorer panel, navigate to and expand ods_aop_18xx_dss > Debug directory. The project has been successfully built if the following files appear in the Debug folder:

Build MSS Project

After the DSS project is successfully built, select ods_aop_18xx_mss in Project Explorer, right click on the project and select Rebuild Project.

Successful MSS Project Build In the Project Explorer panel, navigate to and expand ods_aop_18xx_mss > Debug directory. The project has been successfully built if the following files appear in the Debug folder:

⚠️ Build Fails with Errors
If the build fails with errors, please ensure that all the prerequisites are installed as mentioned in the mmWave SDK release notes.

4. Execute the Lab

There are two ways to execute the compiled code on the EVM:

For more information on using CCS Debug, refer to the documentation here

After starting the lab on the AWR1843 using either method, the program will wait until a chirp configuration is sent to it via the “User” COM port.

Visualizer Source Files

⚠️ Working with and running the visualizer source files requires a full MATLAB license not just the MATLAB Runtime Engine

The detection processing chain is implemented in the C674x DSP core of the AWR1843 device. The visualizer serves to read the UART stream from the device and plots the detected objects and cluster information.

Source files are located at <RADAR_TOOLBOX_INSTALL_DIR>\tools\visualizers\Automotive_Obstacle_Detection_GUI.

Chirp Configuration files are located at <RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Automotive_Body_Sensors\obstacle_detection_aop\chirp_configs\ods_aop_config.cfg. In addition to the normal mmWave chirp configuration CLI commands, there are a few commands that are specific to the Obstacle Detection Demo:

Command Parameters
guiMonitor 1 1 0 0
(this command has unique arguments for this demo)
1 1 = send the detected object array.
1 1 = send the cluster array.
0 1 = send the range-azimuth heatmap.
0 1 = send the range-elevation heatmap.
cfarCfg 1 4 12 4 2 8 2 350 30 2 0 5 20 0.5
1 Range-azimuth heatmap generation method 1) Covariance BF, 2) MVDR
4 Number of left range bins to skip, default = 4
12 Number of close-In range bins, default = 12. Near field range bins receive special treatment.
4 CFAR noise average window size, default = 4.
2 CFAR detection guard window size, default = 2.
8 FFT spreading effect window size, default = 8. The peak due to the FFT spreading of neighboring peak will be ignored.
2 FFT spreading effect guard window size, default = 2.
350 CFAR detection threshold (in units of 0.1 linear), default = 350.
30 FFT spreading threshold(in the unit of 1e-5 linear), default = 30.
2 Noise calculation type: 0) CFAR-CA: take the average between left-side noise average and right side noise average. 1) take the minimum value of left-side noise average or the total mean. 2) take the minimum of left-side or right-side noise average. Default = 2.
0 Enable local peak requirement: The detection points needs to bigger than its direct left and right neighbor.
5 Peak angle difference threshold (in units of 3 degrees): For the close in target, all the detection has to be a local peak. In addition, if it is less than its second left neighbor, then the peak angle between this two range indexes (current and its second left neighbor) has to be differ by this peak angle difference threshold. Suggested value: 3-5.
20 Max range for detection (in units of 0.1m). Depending on the interested detected range of each application, users can set it differently. There is a hard limitation of up to 256 range bins. Setting a smaller value than the max range that chirp configuration allows can save computation complexity and therefore, can set a higher frame rate in the frame configuration.
0.5 Second peak search threshold; Percentage (specified as 0.0 to 1.0) of a range bin’s primary peak value to be met for a second peak on the range bin to be output. Second peak search is enabled via a build time flag SECOND_PEAK_SEARCH (enabled by default).
dbscanCfg 4 4 13 20 3 256
4 Number of accumulated frames to do clustering. Default = 4.
4 Max distance allowed in clustering (in units of 0.1m), depending on the object size. For door opening, default value is 2 - 4.
13 Weighting factor between the distance and speed in cost function (in units of 0.1). Default value is 1.3. To ignore the speed impact in clustering, this value can be set to 0.
20 Speed clipping threshold (in units of 0.1m/s): if speed is too high, the speed impact in clustering cost function can be too large. Speed is clipped up to this threshold. Default value is 20.
3 Minimum points to claim a cluster: A cluster will be claimed to be cluster if it contains at least this minimum number of detected points. Default value: number of accumulated frames - 1.
256 Fixed point scale: the speed (in m/s) and distance (in m) are scaled up to apply clustering algorithm in fixed-point. Default value: 256.

Please refer to the mmWave SDK’s user guide for details on the chirp (RF) related CLI configuration commands.

Data Packet Format

A TLV(type-length-value) encoding scheme is used with little endian byte order. For every frame, a packet is sent consisting of a fixed sized Frame Header and then a variable number of TLVs depending on what was selected via the guiMonitor command. There are 4 possible TLV types for the Obstacle Detection demo:

TLV Name Type Data Size (bytes)
Detected Objects 1 4 + (12 x numDetObj)
Clusters 2 4 + (12 x numClusters)
Range Azimuth Heatmap 3 60 x Yr x sizeof(float)
Range Elevation Heatmap 4 60 x Yr x sizeof(float)

Frame Header

Size: 40 bytes

frameHeaderStructType = struct(...
    'sync',             {'uint16', 8}, ... % syncPattern in hex is: '02 01 04 03 06 05 08 07'
    'version',          {'uint32', 4}, ... % SDK Version number
    'totalPacketLen',   {'uint32', 4}, ... % In bytes, including header and 32 byte padding
    'platform',         {'uint32', 4}, ... % 0xA1843 or 0xA1843
    'frameNumber',      {'uint32', 4}, ... % Starting from 1
    'timeCpuCycles',    {'uint32', 4}, ... % Time in DSP cycles when the message was created
    'numDetectedObj',   {'uint32', 4}, ... % number of detected objects
    'numTLVs' ,         {'uint32', 4}, ... % Number of TLVs in this message
    'subFrameIndex',    {'uint32', 4});    % always zero

TLVs

TLVs in this demo can be of type DETECTED_OBJECTS, CLUSTERS, RANGE_AZIMUTH_HEAT_MAP, or RANGE_ELEV_HEAT_MAP. Each TLV consists of a TLV header plus a unique data type.

TLV Header

Size: 8 bytes

% TLV Type: 01 = DetectedObjects, 02 = Clusters, 03 = RangeAzimuthHeatmap, 04 = RangeElevHeatmap
tlvHeaderStruct = struct(...
    'type',             {'uint32', 4}, ... % TLV object
    'length',           {'uint32', 4});    % TLV object Length, in bytes

Following the header are the TLV-type specific payloads

Detected Objects TLV

Type: DETECTED_OBJECTS

Size: 4 + (12 x numDetObj)

The following structure is only present if the TLV header.length is greater than zero.

featureVector = struct(...
    'numDetObj',  {'short', 2}, ... % Number of detected objects in the following sub-struct
    'xyzQFormat', {'short', 2}, ... % Q-point shift value to convert to meters
      %per object:
      'speedIdx', {'short', 2}, ... % Doppler index
      'x',        {'short', 2}, ... % x - coordinate in meters, divided by xyzQFormat
      'y',        {'short', 2}, ... % y - coordinate in meters, divided by xyzQFormat
      'z',        {'short', 2}, ... % z - coordinate in meters, divided by xyzQFormat
      'rangeIdx', {'short', 2}, ... % Range index
      'peakVal',  {'short', 2}, ... % Peak value

Cluster TLV

Type: CLUSTERS

Size: 4 + (12 x numClusters)

The following structure is only present if the TLV header.length is greater than zero. Note that cluster size can be adjusted by the “max distance” parameter of dbscanCfg.

featureVector = struct(...
    'numClusters',{'short', 2}, ... % Number of clusters in the following sub-struct
    'xyzQFormat', {'short', 2}, ... % Q-point shift value to convert to meters
      %per cluster:
      'x',        {'short', 2}, ... % x - coordinate in meters, divided by xyzQFormat
      'y',        {'short', 2}, ... % y - coordinate in meters, divided by xyzQFormat
      'z',        {'short', 2}, ... % z - coordinate in meters, divided by xyzQFormat
      'xsize',    {'short', 2}, ... % x size of the cluster, in meters, by xyzQFormat
      'ysize',    {'short', 2}, ... % y size of the cluster, in meters, by xyzQFormat
      'zsize',    {'short', 2}, ... % z size of the cluster, in meters, by xyzQFormat

The two ODS heatmaps are 2D array of floats, and will be the same size based on the current configuration. The size of the row is currently hardcoded in the target code and visualizer to be 180 degrees divided by the angular or elevation resolution, currently 3 degrees. So each row contains 60 points, and the row corresponds to a range from the antenna. The number of rows, Yr, is calculated by both the target code and visualizer code, based on the profileCfg and cfarCfg commands in the configuration file. First, the range resolution (in meters) is calculated from profileCfg, then the max detection range in cfarCfg is divided by the range resolution to obtain the number of range rows.

Range Azimuth Heatmap TLV

Type: RANGE_AZIMUTH_HEAT_MAP

Size: 60 x Yr x sizeof (float)

Range Elevation Heatmap TLV

Type: RANGE_ELEV_HEAT_MAP

Size: 60 x Yr x sizeof (float)

Need More Help?