Code Monkey home page Code Monkey logo

awr1642-read-data-python-mmwave-sdk-2's Introduction

AWR1642 Read Data (Python 3)

Python program to read and plot the data in real time from the AWR1642 and IWR1642 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.

awr1642-read-data-python-mmwave-sdk-2's People

Contributors

bluems avatar 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  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  avatar  avatar  avatar  avatar  avatar  avatar

awr1642-read-data-python-mmwave-sdk-2's Issues

Raspberry Pi Interface

The code seems to run well on windows and now I would like to run the same on a raspberry pi for my project. But I am not sure about the physical hardware connection between the iwr1642 evm and the raspberry pi board. It would be nice if can share the details for the same as you had mentioned that you have verified the code to run on raspberry pi also.

Thanking you in advance.

Regards,
Kaushik Kalaiselvan

about z-axis

hello!

My problem is that when I use AWR1642 to collect data, the value of z[objectNum] is always being 0. Could you please tell me what I can do to solve the problem?

Hope for your reply! Thanks!

AWR1642 - Raspberry Pi 4(Raspbian OS)

Hi Ibai,

Good Day!

Can you please clarify me the following:

  1. If I can use Raspberry Pi 4 & Raspbian OS for working with AWR1642-Read-Data-Python-MMWAVE-SDK-2?

  2. Can I also install AWR1642 SDK on Raspbian OS?

  3. Is response of Raspberry Pi good(for real-time)?

Thanks
Guru

Matlab program for person detection.

Hi,
I tried running your matlab code to detect the persons coming towards radar. But unfortunately, the demo code which is given by TI in lab004 is throwing errors. Additinally, i tried feeding default config for which the code runs and shows GUI, but no data within it.
Is there anything that i am missing?
Please help.

Dataport.in_waiting only returns 0

Hi,
I have been trying to get this to work, but I have problems with reading data. The Dataport.in_waiting function only returns 0, and there seems to be no data to read.

I have flashed the EVM the way TI recommends and have followed the instructions in the readme file. Any idea what else I could do to resolve this problem?

Thanks in advance.

Potential to Plot 2D FFT

Hi,

I think you did a great work in parsing from TI's software. It will help me a lot. Thank you so much!

Just a question. I'd like to develop the 2D FFT plot on the basis of your code. The demo visualizer said it supports up to 4FPS realtime 2D FFT plot since limited by the bandwidth of USB. Can you give me some hint that which part I can start with extracting the 2D FFT plot? I really appreciate your open-source spirit and help!

Song

Question about readData_AWR1642.py

Hi, this is a question about readData_AWR1642.py. Sometimes there are many frames in one read, which means that the length of startIdx may be greater than 1. But why the only first frame is taken in the code. In addition, there is another place I don't understand: It's line 212(image below), Why is tlv_xyzQFormat calculated like this.
2021-11-25_105927
Do you have any suggestions? I'm waiting for your reply, thank you very much!
Best wishes.

No output

Hi,
I tried your code "Read-Data-Python", in my case, nothing is displayed on the graph window. I would like to know which .bin file you flashed to the radar?

Thank you

Is MATLAB Software needed

Hi,

Can you please let me know, if MATLAB Software is needed to run this python demo on AWR1642.

Thanks
Guru

Question about range-doppler heatmap

Hi my friend
Thank you for uploading the code, it is very useful
There is something wrong with the Doppler heat map when I run the code. Could you please advise me if there is something wrong with the.cfg file I configured and I can only use if np.max(RangeDoppler) >The picture will not appear until 30000 is changed to 50000, otherwise the picture will not be available. Could you please tell me the reason? Thank you!
1 (1)
1 (2)
1 (3)
1 (4)
1 (5)

can't see the number of people detected

Hi,

I think you did a great work from TI's software. It will help me a lot. Thank you so much!

Just a question. I want to use your code to realize all the functions of matlab code provided by Texas Instruments. Both of showing point cloud and showing how many people are there. This peopleCountingDemo.py can only achieve show a point cloud,can't show how many people are there, and which point cloud is a person. Can you give me some advice to achieve that or another demo? cause I am a new learner, it's really difficult for me,I really appreciate your open-source spirit and help!

Qsing

Issue Displaying 2d Scatter Plot

Hey there,
I am having issues with the 2d scatter plot displaying any data. As some other people have shown here I am getting the plot screen to show up, but it is frozen and not displaying anything. When I hover my cursor over the window I get the loading icon.
2dscatterplot1

I have my board flashed with SDK 2.1 and I am using a downloaded configuration file from the demo visualizer. When I run the program you wrote I am not getting any errors and that blank screen is coming right up.
I did have to edit the code a little to get the plot window to open. I changed line from "app = QtGui.QApplication([])" to
"app = QtWidgets.QApplication([])". I am using Windows 10 and all three LEDs on the board are lit up.
Any suggestions? Ive been fighting with this for a couple weeks now. The demo visualizer works perfectly.

Can't execute readData_AWR1642.py

Hey, I'm trying to execute readData_AWR1642.py file in Jupyter Notebook. I'm getting the error in the line - Import pyqtgraph as pg.
But pyqtgraph is already installed.
What should I do ?

cant receive any data

Hi I tried to run it, the graph appear but doesn't receive any data
Im using SDK 02_00_00_04
CCS 9.1.0

What version of SDK you use ?

mmRadar seated people

Hi,

According to your experience is it possible to count seated people in bus with mmradar technology cost effective way ?

any advise for direction ?

2 D scatter plot

Hello!
Thank you so much for this code.
I am using IWR1642BOOST.
But here is the error i get while trying to run it.
**KeyError Traceback (most recent call last)
in
32 try:
33 # Update the data and check if the data is okay
---> 34 dataOk = update()
35
36 if dataOk:

in update()
15 if dataOk:
16 print(targetObj)
---> 17 x = -targetObj["posX"]
18 y = targetObj["posY"]
19

KeyError: 'posX'
**

I removed the comment on
x = -targetObj["posX"]
y = targetObj["posY"]
as
x = -pointObj["range"]*np.sin(pointObj["azimuth"])
y = pointObj["range"]*np.cos(pointObj["azimuth"])
gave an error : " AttributeError: 'numpy.ndarray' object has no attribute 'sin'".

I'm a beginner and any help is apreciated!

Regarding the vital signs demo

after around 5000-9000 frames the device keeps printing the same values. is this from the python script's end or the device's? and have you ever experienced this? I am running on Linux pop!_os 20.04 will try to run it on windows later.

Question about EVM flash file

I have a question regarding the use of other TI lab demos with this python program. I am using the IWR 1642BOOST from TI and It has the Obstacle detection binary flashed onto the EVM. Is it possible to use this python program to graph the output?

Left and right reversed

Hi,

I use the board based on IWR1642, Ubuntu 20.04 and Python 3.8.
When I use your code, The data your code has responded to will appear reversed left and right.
Compared to TI's official demo(mmWave_Demo_Visualizer), it looks reversed.

I tested readData_AWR1642.py

About the communication link

Hi, I have run the readData_AWR1642.py and it does not send the commands to the radar. We have used the mmWave studio and the radar works properly. Do you have any suggestions?

Many thanks,

Jiang

configuration

Hi,
thanks for the code, it helped me a lot. My problem is, with your configuration file I cannot detect objects with a distance of more than about 3 meters. With the default settings in the mmwave demo visualizer, I can detect the object but when I copy this settings in the config-file for the python-programm, its not running. When I increase just the ramptime (and decrease the slope), I can detect the object but then I detect non-existing objects in front of the sensor too.
It would be nice if you can help me, Im new to the topic.

Queries regarding people counting demo

Hi,
Thanks for this great contribution. I will try people counting demo. I have IWR1642BOOST EVM.

For that which pre-built binary file should I first need to upload? Is it the out-of-the-box demo pre-built binary?

regarding 2D scatter plot

Hi !
im a student working on IWR1642boost and fortunately found your post on github !
Everything was going well, including installing and configuration etc also didnt see any errors
but
I dont get any result on 2D scatter plot screen...
So my assumption is... maybe its because my pi3 is not fast enough to run IWR1642boost in real time ?
So i wanna ask
Is pi3 okay to run the codes you wrote ?
also if its okay, then what do you think what my problem would be ,, ?
i loaded the peoplecounting demo on my board, so it works well on my PC
id appreciate if you advice me !
thank you for your time !

Association of points/tracking objects

If I understand correctly, this script visualises all the different detected points. The 1642 sensor also has a tracking algorithm to determine which points belong to which objects. Is there any way to receive this data as well?

Raw ADC Data

Hello,

Is there an option to read the raw ADC data from the device directly?

Thanks,
Josiah W. Smith

configuration file

Hello,
thanks for your code! Would you please tell me the meaning of these parameters and the values after them in the configuration file(1642config.cfg)? Because I may have to modify some values according to my needs. I'm a new learner and I'm confused.

I really appreciate your help!

Differntiating Horizantal Plane and Elevation Plane through Azimuth Plane

Hello Ibai,

Good Day!

I am using AWR1642BOOST EVM to R&D ADAS applications, I see AWR1642 also picks few objects(like over head telephone cables, over head internet cables) on the elevation plane, I had requested TI Forum to help me differntiate the Elevation Plane and Horizantal Plane of detection, they had mentioned the following:

"The AWR1642BOOST EVM has all of the virtual antennas on the same plane. As a result, detections can only be differentiated along the aziumth plane. The angular resolution will be a function of the number of TX and RX antennas that are enabled in your particular configuration."

Can you please let me know, if its possible to differntiate using your code through Azimuth Plane.

Thanks
Guru

Sdk version

Hi,
Is there a limitation to sdk version.
because i am using this code with my configuration file, and it dose not work.

Data collection configuration issues

Hello, let me ask, what settings need to be made for radar equipment to realize real-time data collection using your code? Because I did not run your code successfully, the value of Dataport.in_waiting on line 117 is always 0. Thank you for your reply, thank you~

PyQt5 install error at Raspberry Pi 4

Hello,
First of all, thanks for your codes.

I got the error about setting PyQt5 at my raspberry pi 4 module.
As you mentioned, you've already tested at window and raspberry pi OS, I m just wondering if you didn't encounter any error regarding PyQt5 setting.

The error is as below.

Try.
pip install PyQt5

-> No any response, just pending

and main issue is

Traceback (most recent call last):
File "ppCnt1.py", line 4, in
import pyqtgraph as pg
File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/init.py", line 13, in
from .Qt import QtGui, mkQApp
File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/Qt.py", line 137, in
from PyQt5 import QtGui, QtCore, QtWidgets, sip, uic
ImportError: /usr/lib/python3/dist-packages/PyQt5/sip.so: undefined symbol: _Py_ZeroStruct

Could I get any reply ?

Thanks

  • Does PyQt5 can be installed surely in Raspberry pi ?!

Enquiry

We are three students from the American University of Sharjah. We are working on IWR1642 sensor to detect objects within 25m-30m. We used your code and it worked perfectly but we don't understand what is exactly giving us and what the angle is. We want our sensor to detect objects with 25-30m away and alert the users and the angle where the object is to program it later on with the GPS.

Can you please help us.

regarding driver vital sign

Hi again !

i could see some plots on people counting demo with configuration you edited last night,

but found the same issue on driver vital sign.

i loaded the same configuration file as TI one,

and cant see any results like yesterday.

if you dont mind , would you take a look your code and tell me why it doesnt work ?

i guess the configuration might make problems like yesterday

best regards

AWR1642 - Software & Hardware Requirements

Hi Ibai,

Good Day!

Please accept my apologies, if my question is not relevant to this github page.

Can you let me know, if I can directly connect AWR1642 EVM to a Windows / Linux PC using the USB or RJ45 Ethernet Cable to get the data from the Radar or Do i need to use the DCA1000 EVM, Matlab Runtime Engine version 8.5.1, Code Composer
Studio version 7.1 or higher or the XDS Emulation Software?

the reason to ask this question is, I was going through the TI training videos, I got lost and confused in the middle.

Can you please clarify me.

Thanks
Guru

DriverVitalSignLab

Kaixo Ibai! Eskerrik asko zure kodigoa zabaltzeagatik.

I am trying to work with your code but I do not receive any data from your radar after using the cfg file for the vital sign sensing, and I can therefore not see anything in the GUI (It does not even open)

I would appreciate it if you could help me in any way.

I have flashed the device (AWR1642) with the SDK 2.01

Question about output signal at GUI

I am getting the output signal at the GUI. Could you please send a sample output display of your data to verify it with mine?

Also inside the update() function, you are plotting the output only for the filtered breathing signal(x) but two different graphs are getting displayed at the GUI. Can you please explain this?

ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 4 is different from 3)

Hi Ibai,

After using your peopleCountingDemo code for a while, then i found out out that there is two problem:

  1. Firstly, when i run the program and it return the data for a while then it return an error:
    ValueError: setting an array element with a sequence
    Then i found out that the problem is there could be an miss match with the initialize array so i changed:
    azimuth = np.zeros(numInputPoints, dtype=np.float32)
    dopplerVal = np.zeros(numInputPoints, dtype=np.float32)
    to
    azimuth = np.zeros(numInputPoints, dtype=object)
    dopplerVal = np.zeros(numInputPoints, dtype=object)
    This will solve this problem.
  2. Secondly, i some time receive the error

File "peopleCountingDemo.py", line 215, in readAndParseData16xx
tlv_type = np.matmul(byteBuffer[idX:idX + 4], word)
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 4 is different from 3)

do you know how to solve this problem??

Using your codes

Hello,
I would like to know which .bin file should be flashed onto the AWR1642 to be able to get the 2D plots working in your 'people counting demo' python code.

Also if any information on other requirements (like mmwave SDK version/CCS studio) is needed to run your demo, please do share them as well.
I am not using an the DCA1000EVM, and just have the AWR1642 board and my laptop, FYI.

I have run your python code but the 2D plot doesn't work and the
dataOk = update()
line always returns dataOk as 0.

I am assuming it is because I have not flashed the correct .bin file.

Could you also let me know as to which of the SOP2/SOP1/SOP0 switches are short while running your code?

Data read issues...?

Any ideas why i'm only able to see data in a short period of time (2-3 sec)? Or sometimes just one object is found. The Dataport.in_waiting displays different values as i move the radar around but displays nothing...?

Can we obtain 3D point clouds?

Dear @ibaiGorordo
Thanks for this outstanding contribution.
Can we obtain 3D point clouds or range-elevation-azimuth heatmap with IWR1642BOOST EVM?
I checked that the z in my point cloud data is zero for every detected point. Why is it so? I think my sensor is currently not providing any information related to the elevation plane.

vital sign detection

hello i want measure heart rate but i can't find the file you said in another issue and when i click it there isn't any file in that link page

2D scatter plot appears froze when running the code

Hi,

I tried to run the python file on my PC using readData_AWR1642.py but the 2D scatter plot will freeze every time. I attach the sceenshot of the 2D scatter plot. I am using config file for SDK 3.4 version based on the firmware from SDK 3.4.

screen shot

2Dscatter plot is not plotting

Hello ,

I am using IWR1642 with 2.1 SDK version and raspberry pi 4
I am using the code to read data from radar and plot the values .I have modified the configuration file name
Files used are
Config.cfg
readData_AWR1642.py

On executing the code, scatter plot is plotting the values .
In the terminal i could see that blank frames are printing. Kindly help me understand the issue
error

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.