Git Product home page Git Product logo

iwr1443-read-data-python-mmwave-sdk-1's Introduction

IWR1443 Read Data (Python 3)

Python program to read and plot the data in real time from the AWR1443 and IWR1443 mmWave radar boards (Texas Instruments). The program has been tested with Windows and Raspberry Pi and is based on the Matlab demo from Texas Instruments.

First, the program configures the Serial ports and sends the CLI commands defined in the configuration file to the radar. Next, the data comming from the radar is parsed to extract the 2D position, range and doppler velocity of the reflected points. Finally, the 2D position of the reflected points is shown in a scatter plot.

Although it works correctly, the program is still in development, so if you have comments or questions, please feel free to comment.

Required Python packages

  • numpy: For the array calculations.
  • serial: To read the serial data from the radar.
  • time: To wait until more data is generated.
  • pyqtgraph: For the scatter plot showing the 2D position of the reflected points.

Program Functions

  • serialConfig(): Configures the serial ports and sends the CLI commands to the radar. It outputs the serial objects for the data and CLI ports.
  • parseConfigFile(): Parses the configuration file to extract the configuration parameters. It returns the configParameters dictionary with the extracted parameters.
  • readAndParseData16xx(): It reads the data from the data serial port and parses the recived buffer to extract the data from the Detected objects package only. Othe package types (range profile, range-azimuth heat map...) could be done similarly but have not been implemented yet. This functions returns a boolean variable (dataOK) that stores if the data has been correctly, the frame number and the detObj dictionary with the number of detected objects, range (m), doppler velocity (m/s), peak value and 3D position (m).
  • update(): Runs the readAndParseData16xx() function to read the current data and if the data has been read correctly the scatter with the 2D position is updated.

HOW TO USE

  • Download the required packages.
  • Change the name of the configuration file (.cfg).
  • Change the serial ports.
  • If not all the antennas are being used, then change the value of numRxAnt and numTxAnt.
  • Run the program.
  • The data of each frame with the position and velocities of the reflected points is stored in the detObj dictionary. Each frame data is stored in the frameData dictionary array.

iwr1443-read-data-python-mmwave-sdk-1's People

Contributors

ibaigorordo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

iwr1443-read-data-python-mmwave-sdk-1's Issues

3d object problem

when i load 3d object config file it does not run. It loads the config file but it can not get the any object data. i use sdk 2

Using IWR1443 to measure velocity

Hi Ibai,

Newbie here. I understand from your code that your application is for up to 1 meters with a maximum radial velocity of 1m/s. I am currently using this board for my project to measure the velocity at about 10 meters with a maximum velocity of 15m/s. Could you guide me on how I could modify your code to meet the needs of my project?

As of now, below are the changes I have made so far:

  1. Changed the serial ports
  2. Changed the number of Tx Antenna to 2
  3. Added "print(dopplerVal)" to display the velocity captured

All help is appreciated. Thanks in advance! :)

how to locate serial port

greetings,

and wonderful job!

how can we locate the serial port like

# Windows
    CLIport = serial.Serial('COM3', 115200)
    Dataport = serial.Serial('COM4', 921600)

I follow 1443 manual and the mmW Studio just save down the .bin file to laptop. I have no clue where is CLIport and Data port.

Best

Jet

Can this program work with SDK 2.1 ?

I'm using a AWR1443, that flashs a SDK 2.1 demo binary file. Because it's failed to flash the 1.2 demo bin file. What if I wanna run the program to read my device's data, you have any advice for it ? Where should I modify your program?
I already tried to modify 1443 configure file, that changed sdk ver 01.02 to sdk ver 02.01, but it didn't work.

Stop working after a few seconds

Hi,,
I can see the data points but after a few seconds the frames received do not contain TLVs.

Do you know why this happen?

Thanks

Regards

Is this code compatible with IWR1443 ES3.0, SDK2.1?

Hi,

Thank you very much for the code.

I'm using IWR1443 ES3.0 with SDK2.1 and trying to get 3D point cloud data. I searched for so many forums and used different github repository but nothing works. It looks like ES2.0 is very different from ES3.0. Most of the repository either only support ES1 or ES2. The only thing work is the mmWave studio 2.1, sadly there isn't 2D plot nor 3D plot.

I'm just wondering is this code compatible with ES3.0 SDK2.1?

AWR1642 not transmitting

Hello,

I am trying to live-stream raw ADC data using the AWR1642 and the MATLAB source you provided, however the device is not transmitting/receiving any data (see screenshot below). I believe this could be a firmware issue, which binary file are you running/which SDK are you using? Thanks in advance, your help is much appreciated!

Best,
-Amir
!
unnamed
unnamed

Do I need to install mmWave sdk to use this repository?

hello, it's good work, I have some question as follows.

  1. What format the captured data is in, and whether it can be saved
  2. I excute the .py program, then appear like this figure, nothing in figure. What went wrong maybe?
    image

various errors

Hi!
first, thank you so much for the code. It is exactly what I am looking for.

I am using an AWR1443Boost module (same as IWR1443 but it handles better high temperatures).
I need to run the code (I have Microsoft Visual Studio Code v1.73.1). but seem always to run in some errors (I am quite new to python).

Which version of the various packages (numpy, pyqtgraph, ecc...) do I need to make it run smoothly?
I saw you posted this code 4 years ago but when I installed the versions of that time I still get the same errors.

First I got
Traceback (most recent call last): File "c:\Users\ViconPC\Desktop\IWR1443-Read-Data-Python-MMWAVE-SDK-1-master\readData_IWR1443.py", line 304, in <module> app = QtGui.QApplication([]) AttributeError: module 'pyqtgraph.Qt.QtGui' has no attribute 'QApplication'. Did you mean: 'QGuiApplication'?

which I fixed by changing the code at the beginning (I left your code as a comment)
import serial import time import numpy as np import pyqtgraph as pg #from pyqtgraph.Qt import QtGui import pyqtgraph.Qt.QtWidgets as QtGui

It fixed that error but I still get the following:
Traceback (most recent call last): File "c:\Users\ViconPC\Desktop\IWR1443-Read-Data-Python-MMWAVE-SDK-1-master\readData_IWR1443.py", line 308, in <module> win = pg.GraphicsWindow(title="2D scatter plot") AttributeError: module 'pyqtgraph' has no attribute 'GraphicsWindow'. Did you mean: 'GraphicsView'?

I tried everything and do seem to be able to handle it.

Can you help me?

Thank you

IWR1443 on MAC OS X

Hi,

I tried your reader on Mac OS X. I only needed to change the serial ports
# MAC
CLIport = serial.Serial('/dev/tty.usbmodemR0031201', 115200)
Dataport = serial.Serial('/dev/tty.usbmodemR0031204', 921600)

That is the only change I needed to make.

The sdk firmware I uploaded to the board is version mmwave_sdk_01_02_00_05.

I started the reader. The graphical screen appears, and I can see data being plotted. However, after a few seconds (sometimes a bit longer, but no more than 10 seconds) the reader crashes and the following exception is given:

File "readData_IWR1443.py", line 334, in
dataOk = update()
File "readData_IWR1443.py", line 292, in update
dataOk, frameNumber, detObj = readAndParseData14xx(Dataport, configParameters)
File "readData_IWR1443.py", line 147, in readAndParseData14xx
byteBuffer[:byteBufferLength-startIdx[0]] = byteBuffer[startIdx[0]:byteBufferLength]
ValueError: could not broadcast input array from shape (0) into shape (32700)

I'm not a python expert at all, but to me this reads as an undesirable condition is found and therefore the exception occurs.
Can you tell me how to cope with it?

Thanks in advance

Below the complete output:

% ***************************************************************
% Created for SDK ver:01.02
% Created using Visualizer ver:2.0.0.2
% Frequency:77
% Platform:xWR14xx
% Scene Classifier:best_range_res
% Azimuth Resolution(deg):15 + Elevation
% Range Resolution(m):0.047
% Maximum unambiguous Range(m):2.41
% Maximum Radial Velocity(m/s):1
% Radial velocity resolution(m/s):0.13
% Frame Duration(msec):50
% Range Detection Threshold (dB):15
% Range Peak Grouping:disabled
% Doppler Peak Grouping:disabled
% Static clutter removal:enabled
% ***************************************************************
sensorStop
flushCfg
dfeDataOutputMode 1
channelCfg 15 7 0
adcCfg 2 1
adcbufCfg 0 1 0 1
profileCfg 0 77 284 7 40 0 0 100 1 64 2000 0 0 30
chirpCfg 0 0 0 0 0 0 0 1
chirpCfg 1 1 0 0 0 0 0 4
chirpCfg 2 2 0 0 0 0 0 2
frameCfg 0 2 16 0 50 1 0
lowPower 0 0
guiMonitor 1 0 0 0 0 0
cfarCfg 0 2 8 4 3 0 1195
peakGrouping 1 0 0 1 56
multiObjBeamForming 1 0.5
clutterRemoval 1
calibDcRangeSig 0 -5 8 256
compRangeBiasAndRxChanPhase 0.0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
measureRangeBiasAndRxChanPhase 0 1.5 0.2
CQRxSatMonitor 0 3 4 99 0
CQSigImgMonitor 0 31 4
analogMonitor 1 1
sensorStart
Traceback (most recent call last):
File "readData_IWR1443.py", line 334, in
dataOk = update()
File "readData_IWR1443.py", line 292, in update
dataOk, frameNumber, detObj = readAndParseData14xx(Dataport, configParameters)
File "readData_IWR1443.py", line 147, in readAndParseData14xx
byteBuffer[:byteBufferLength-startIdx[0]] = byteBuffer[startIdx[0]:byteBufferLength]
ValueError: could not broadcast input array from shape (0) into shape (32700)

IWR1443BOOST: Receiving no data

Hi,

I am not able to run your code perfectly. I am using,

mmwave_sdk_03_04_00_03
IWR1443BOOST (Using functional mode)

I have set the port number correctly and using your config file, just want to see it is working as you told.

In line 325, dataOk = update(), the value of dataOk is always 0.

Can you please tell me other than that you told in your documentation do I need to do anything more? Like do I need to load any image for this?

Best regards,
Nazmul

Does required packages include installing sdk 3.0?

Hi,
i am running the code the dataok always stays zero and no data is being gathered from the sensor , i wanted to know is there any other packages that needed to be installed other then following
numpy
pyqtgraph
pyserial

TypeError issue with AWR1443

Hi,

First of all, thanks for the code!
I was able to run the code on a raspberry pi 4 with python 2.7. I downloaded all the required libraries and I used pyqt4. I use an AWR1443 mmWave radar bought very recently. The demo code was compiled with mmWave SDK 2.1.0.

When I start the code, a graph window appears on the bottom left corner. It has axes but no data are being plotted.

I logged the output of the console and put them in the file in the attachment. Since the same error is displayed on the console repeatedly, I put a single instance of the recurring error below (for more details please see there attached log file).

It seems to be a type error between float and int:
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int32') with casting rule 'same_kind'

Here is a single instance:

[22:53:16] Ignored exception:

|==============================>>
|  Traceback (most recent call last):
|    File "readData_IWR1443.py", line 323, in <module>
|      dataOk = update()
|    File "readData_IWR1443.py", line 289, in update
|      QtGui.QApplication.processEvents()
|    File "/home/pi/.local/lib/python2.7/site-packages/pyqtgraph/widgets/GraphicsView.py", line 161, in paintEvent
|      return QtGui.QGraphicsView.paintEvent(self, ev)
|    File "/home/pi/.local/lib/python2.7/site-packages/pyqtgraph/debug.py", line 93, in w
|      printExc('Ignored exception:')
|    --- exception caught here ---
|    File "/home/pi/.local/lib/python2.7/site-packages/pyqtgraph/debug.py", line 91, in w
|      func(*args, **kwds)
|    File "/home/pi/.local/lib/python2.7/site-packages/pyqtgraph/graphicsItems/ScatterPlotItem.py", line 1033, in paint
|      viewMask = self._maskAt(self.getViewBox().viewRect())
|    File "/home/pi/.local/lib/python2.7/site-packages/pyqtgraph/graphicsItems/ScatterPlotItem.py", line 1157, in _maskAt
|      w *= px
|  TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int32') with casting rule 'same_kind'
|==============================<<

log-1st-Feb-2021.txt

Thanks in advance!

Information about the requirements

Hi,

I just wanted to know what version of python and pyqt we were supposed to use for running this code (I use a raspberry pi 4 with AWR1443).

It seems to me:

  • python 2.7
  • pyqt 4

Thanks for the confirmation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.