xWRLx432 Gesture Recognition Users Guide
Table of Contents
Device Compatibility
⚠️ This lab is currently only compatible with the xWRLx432. Please note, the machine learning model trained for this demo was trained using the xWRL6432. Performance on the xWRL1432 device is slightly degraded because of this and is not intended as a production-ready demo.
Overview
This lab demonstrates the use of TI mmWave sensors for gesture recognition applications. The range, velocity, and angle data from mmWave sensors can enable the detection and classification of several natural gestures. The example provided in this demo can recognize 6 distinct hand gestures: Left swipe, Right swipe, Up swipe, Down swipe, Push, and Pull at a distance of 2m.
Quickstart
Prerequisites
Prerequisite 1 - Run Motion and Presence Detection Lab
Before continuing with this lab, users should run the Motion and Presence Detection Demo for the xWRLx432 to gain familiarity with the sensor’s capabilities and the tools used in the Radar Toolbox.
Prerequisite 2 - XDS Firmware
If using an xWRLx432BOOST EVM, the latest XDS110 firmware is required. The XDS110 Firmware runs on the microcontroller onboard the xWRLx432BOOST, which provides the JTAG Emulation and serial port communication over the XDS110 USB port. Packet loss has been observed on the serial port (COM ports) with some versions of the XDS110 firmware which can cause the demo to fail.
The latest XDS110 firmware is installed with the latest version of Code Composer Studio. CCS version 12.2 or later required.
Prerequisite 3 - PC CPU and GPU Resources
The Industrial Visualizer requires sufficient GPU and CPU resources to process the incoming UART data every frame and run the demo smoothly. Users with insufficient PC resources may notice occasional visualizer lag or missed frames in the log file. The demo should still run on most PCs regardless of hardware resources, but performance might vary.
Requirements
Hardware Requirements
| Item | Details |
|---|---|
| Device | xWRL6432BOOST or xWRL1432BOOST |
| Computer | PC with Windows 10. If a laptop is used, please use the ‘High Performance’ power plan in Windows. |
| Micro USB Cable |
Software Requirements
| Tool | Version | Download Link |
|---|---|---|
| TI mmWave L SDK | 5.5.4.2 | TI mmWave SDK 5.x |
| Uniflash | Latest | Uniflash tool is used for flashing TI mmWave Radar devices. Download offline tool or use the Cloud version |
| Code Composer Studio | Latest | Code Composer Studio |
| TI Radar Toolbox | Latest | Radar toolbox should be downloaded to access binaries and source code. Download Instructions in the readme file. |
1. Configure the EVM for Flashing Mode
Follow the instructions for Hardware Setup of Flashing Mode
2. Flash the EVM using Uniflash
Flash the .appimage fil in the prebuilt_binaries directory. Follow the instructions for using UniFlash
The flashable binary can be found at: <RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Industrial_and_Personal_Electronics\Gesture_Recognition\xWRLx432_gesture_recognition\prebuilt_binaries\
3. Configure the EVM for Functional Mode
Follow the instructions for Hardware Setup of of Functional Mode
4. Run the Lab
4.1. Open Visualizer
Navigate to <RADAR_TOOLBOX_INSTALL_DIR>\tools\visualizers\Applications_Visualizer\Industrial Visualizer. The visualizer software may be run from Python 3.7.3 or as a standalone executable. In general, running the visualizer from the Python source runs faster and results in fewer errors over long periods of time. If running Python directly from source, run the setUpEnvironment.bat script first to ensure all the correct packages and versions are installed. Then run the visualizer either directly from source with python gui_main.py, or as an executable by running the Industrial_Visualizer.exe
4.2. Reset the xWRLx432BOOST EVM by pressing the RESET_SW button
4.3. Select the arrowed options as shown in the below graphic.
Set the Device to appropriate device (xWR6432 or xWR1432) as indicated by arrow 1
Set CLI COM to the appropriate COM port as indicated by arrow 2. If the xWRLx432BOOST EVM is plugged in when the visualizer is opened, then the COM ports filled in automatically. If they do not appear, check the Device Manager on Windows for the XDS110 Class Application/User UART port, and use this port number in the visualizer.
Select the xWRLx432 Gesture Recognition demo as indicated by arrow 3.
Press the Connect button as indicated by arrow 4
Press the Select Configuration button as indicated by arrow 5. Navigate to
<RADAR_TOOLBOX_INSTALL_DIR>\radar_toolbox\source\ti\examples\Industrial_and_Personal_Electronics\Gesture_Recognition\xWRLx432_gesture_recognition\chirp_configsand select the appropriate cfg file based on your EVM.Press the Start and Send Configuration button as indicated by arrow 6.
4.4. Running the Demo
This lab demonstrates the following features.
- Detection/Classification of six gestures (at a range of 2m): Right to Left Swipe, Left to Right Swipe, Up to Down Swipe, Down to Up Swipe, Push Gesture, Pull Gesture.
Perform the above gestures while standing at a distance of 2m from the radar sensor. The detected gestures will be displayed in the visualizer.
This concludes the Quickstart Section
Developer’s Guide
Import Lab Project to CCS
To import the source code into your CCS workspace, a CCS project is provided in the lab at the path given below.
Start CCS and configure workspace as desired.
Import the project specified below to CCS.
<RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Industrial_and_Personal_Electronics\Gesture_Recognition\xWRLx432_Gesture_Recognition\src\xwrl6432\xWRLx432_gesture_recognition.projectspecVerify that the import occurred without error by checking that
xWRLx432_gesture_recognitionshows up in the project explorer
🛑 Error during Import to IDE
If an error occurs, check that the software dependencies listed above have been installed. Errors will occur if necessary files are not installed in the correct location for importing.
Build the Lab
- Select the xWRLx432_gesture_recognition in Project Explorer so that it is highlighted. Right click on the project and select Rebuild Project. The project will then build.
- On successful build, the following should appear:
- In
<PROJECT_WORKSPACE_DIR>\xWRLx432_gesture_recognition→Debug- xWRLx432_gesture_recognition.out (this is the binary used for CCS debug mode)
- gesture_recognition_demo.Debug.appimage (this is the flashable binary used for deployment mode)
- In
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.
🛑 Build Fails with Errors
If the build fails with errors, please ensure that all the software requirements are installed as listed above and in the mmWave SDK release notes.
Execute the Lab
There are two ways to execute the compiled code on the EVM:
- Deployment mode: the EVM boots from flash and starts running the bin image at power-up
- Using Uniflash, flash the gesture_recognition_demo.Debug.appimage found at
<PROJECT_WORKSPACE_DIR>\xWRLx432_gesture_recognition\Debug - The same procedure for flashing can be used as detailed in the Flash the EVM section.
- Using Uniflash, flash the gesture_recognition_demo.Debug.appimage found at
- Debug mode: This mode is used for downloading and running the executable from CCS. This mode enables JTAG connection with CCS while the lab is running and is useful during development and debugging.
- Follow the CCS Debug Mode Guide
Configuration Commands
The configuration file (.cfg) can be found at <RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Industrial_and_Personal_Electronics\Gesture_Recognition\xWRLx432_gesture\chirp_configs\gesture_recognition_2m_xwrl6432.cfg. The majority of the configuration commands for this demo are the same as that of the Motion and Presence Detect Demo. You can find more information on these configuration commands in the SDK documentation at <MMWAVE_SDK5_INSTALL_DIR>\docs\api_guide_xwrL64xx\MOTION_AND_PRESENCE_DETECTION_DEMO.html.
The additional configuration commands which are unique to this demo are described below.
- sigProcChain2 [azimuthFftSize] [elevationFftSize] [motDetMode] [minDist] [maxDist] [maxNumPoints]
- azimuthFftSize - Azimuth FFT size. Suggested to set as power of 2 (Current gesture demo is tested only with values up to 32)
- elevationFftSize - Elevation FFT size. Suggested to set as power of 2 (Current gesture demo is tested only with values up to 32)
- motDetMode - Mode selection. 1 - Major motion detection only (Current gesture demo supports only Major mode of operation)
- minDist - Minimum distance from the radar from which gesture will be detected (Current gesture demo set to 1.35m)
- maxDist - Maximum distance from the radar from which gesture will be detected (Current gesture demo set to 2.25m)
- maxNumPoints - Maximum number of points for which angle calculation has to be calculated (Current gesture demo set to 25)
- PresenceDetectCfg [presenceDetectEnable] [thresholdPresenceDetect] [burstPeriodicity]
- presenceDetectEnable - Enable or disable the presence mode (0-gesture mode, 1-presence + gesture mode (switch from presence->gesture and vice-versa), 2-presence mode only to test/set the threshold value)
- thresholdPresenceDetect - Threshold value in presence mode above which the switch will happen to gesture mode (chosen empirically after setting in presence test mode)
- burstPeriodicity - Burst periodicity (in uS) between 2-bursts to be used in presence mode.
UART Output Data Format
This demo outputs data using a TLV (type-length-value) encoding scheme 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 detected in that scene. The TLVs for this demo include the extracted features used for the neural network inference as well as the detected gesture for that frame.
Frame Header
Length: 40 Bytes
A Frame Header is sent at the start of each packet. Use the Magic Word to find the start of each packet.
| Value | Type | Bytes | Comments |
|---|---|---|---|
| Magic Word | uint64_t | 8 | syncPattern in hex is: ‘02 01 04 03 06 05 08 07’ |
| Version | uint32_t | 4 | Software Version |
| Total Packet Length | uint32_t | 4 | In bytes, including header |
| Platform | uint32_t | 4 | A6843 |
| Frame Number | uint32_t | 4 | Frame Number |
| Time [in CPU Cycles] | uint32_t | 4 | Message create time in cycles |
| Num Detected Obj | uint32_t | 4 | Number of detected points in this frame |
| Num TLVs | uint32_t | 4 | Number of TLVs in this frame |
| Subframe Number | uint32_t | 4 | Sub-Frame number |
TLV Header
Length: 8 Bytes
A TLV Header is sent at the start of each TLV. Following the header is the the TLV-type specific payload.
| Value | Type | Bytes | Comments |
|---|---|---|---|
| Type | uint32_t | 4 | TLV Type |
| Length [number of bytes] | uint32_t | 4 | In bytes |
TLVs
Gesture Features TLV
Type: MMWDEMO_OUTPUT_EXT_RANGE_DOPPLER_FEATURES = 350
Size: 64 Bytes
The Gesture Features TLV consists of an array of extracted features some of which are used as input to the neural network. Each extracted feature is defined as given below.
| Value | Type | Bytes | Comment |
|---|---|---|---|
| rangeAvg | float | 4 | range average across Range-Doppler heatmap |
| dopplerAvg | float | 4 | doppler average across Range-Doppler heatmap |
| dopplerAvgPos | float | 4 | doppler positive average across Range-Doppler heatmap |
| dopplerAvgNeg | float | 4 | doppler negative average across Range-Doppler heatmap |
| numPoints | float | 4 | number of detected points above a threshold across Range-Doppler heatmap |
| azimWtMean | float | 4 | azimuth weighted mean across Range-Doppler heatmap |
| elevWtMean | float | 4 | elevation weighted mean across Range-Doppler heatmap |
| azimWtDisp | float | 4 | azimuth weighted displacement across Range-Doppler heatmap |
| elevWtDisp | float | 4 | elevation weighted displacement across Range-Doppler heatmap |
| dopAzimCorr | float | 4 | Hybrid feature which is a correlation between Doppler and Azimuth for numFrames |
| dopElevCorr | float | 4 | Hybrid feature which is a correlation between Doppler and Elevation for numFrames |
| dopPosNegCorr | float | 4 | Hybrid feature which is a correlation between Doppler positive and Doppler negative correlation for numFrames |
| dopPosElevCorr | float | 4 | Hybrid feature which is a correlation between Doppler positive and Elevation for numFrames |
| dopPosAzimCorr | float | 4 | Hybrid feature which is a correlation between Doppler positive and Azimuth for numFrames |
| dopNegElevCorr | float | 4 | Hybrid feature which is a correlation between Doppler negative and Elevation for numFrames |
| dopNegAzimCorr | float | 4 | Hybrid feature which is a correlation between Doppler negative and Azimuth for numFrames |
Gesture Classifier Output TLV
Type: MMWDEMO_OUTPUT_EXT_CLASSIFIER_OUTPUT = 351
Size: 1 Byte
The Gesture Classifier Output TLV consists of a single uint8_t indicating the detected gesture.
| Gesture | Identifier |
|---|---|
| No Gesture | 0 |
| Left to Right | 1 |
| Right to Left | 2 |
| Up to Down | 3 |
| Down to Up | 4 |
| Push | 5 |
| Pull | 6 |
Presence Detection Output TLV
Type: MMWDEMO_OUTPUT_EXT_PRESENCE_OUTPUT = 352
Size: 1 Byte
The Presence Detection Output TLV consists of a single uint8_t indicating the detected presence. This TLV is not sent out in gesture-only mode.
| Status | Value |
|---|---|
| No Presence Detected | 0 |
| Presence Detected | 1 |
Presence Detection Threshold TLV
Type: MMWDEMO_OUTPUT_EXT_PRESENCE_DETECT_THRESHOLD = 353
Size: 4 Bytes
This TLV contains the sum of magnitude across 2nd Doppler bin from range ‘x’ to range bin ‘y’ in the presence mode. This TLV is not sent out in gesture-only mode.
Stats TLV
Type: MMWDEMO_OUTPUT_EXT_MSG_STATS = 354
Size: 24 Bytes
| Value | Type | Bytes | Comment |
|---|---|---|---|
| interFrameProcessingTime | uint32_t | 4 | Interframe processing time in usec |
| transmitOutputTime | uint32_t | 4 | Transmission data transmit time in usec |
| powerMeasured[4] | uint16_t[4] | 8 | Power at 1.8V, 3.3V, 1.2V and 1.2V RF rails (1LSB = 100 uW) |
| tempReading[4] | int16_t[4] | 8 | Temperature: Rx, Tx, PM, DIG. (°C), 1LSB = 1°C |
Neural Network
This demo utilizes a neural network model which runs on the ARM core making predictions based on extracted features. A sliding window buffer of features, extracted from the data across a number of frames, is used as input to the neural network. The model outputs a set of probabilities, each represents the probability that the input data belongs to a specific gesture.
Features
The model is trained on following extracted features.
| Extracted Feature | Description |
|---|---|
| Doppler Average | Weighted average of the doppler across the range-doppler heatmap |
| Elevation Weighted Mean | Select the N cells of the range-doppler heatmap with the highest magnitude and for each cell compute the elevation bin (via angle-FFT). The average elevation is the weighted average of all these elevation bin indices. |
| Azimuth Weighted Mean | Select the N cells of the heat-map with the highest magnitude and for each cell compute the azimuth bin (via angle-FFT). The average azimuth is the weighted average of all these azimuth bin indices. |
| Number of detected points | Number of cells in the heatmap that have a magnitude above a certain threshold |
| Range Average | Weighted average of the range across the heatmap. |
Retraining
Users may wish to retrain the neural network model for various reasons such as adding or removing certain gestures. A full procedure for retraining and deploying a model is not provided in this guide; however, the extracted features output over UART when running this application can be saved and used training data for a new model.
Need More Help?
- Search for your issue or post a new question on the mmWave E2E forums