-
Notifications
You must be signed in to change notification settings - Fork 229
fix(read): handle lost frames and corrupted data when using frame sizes which are non-integer multiples of 1456 Bytes (#56, #65) #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
… to place received UDP payload in the correct position of the frame buffer
…is exceeded, for example when one or more packets of a frame are missing
…ETS_IN_FRAME, PACKETS_IN_FRAME_CLIPPED, UINT16_IN_PACKET
|
Thank you for you commit. I have noticed this issue for a while and I'm glad some in noticing it. Upon trying your update; I end up getting this message on repeat "WARNING: Dropped Frame(s) 3100 since they weren't complete. and the size of the file where i save the data never increases |
…bled and make it settable via "dynamic constant"
…Periods up to around 500ms
|
Hello @LadiAdeoluwa, Because I have the feeling the issue could be related to you having a framePeriod >200 ms, I did two things in the last commit:
Please also let me know if you are successfully capturing frames with the adapted code. Thanks, Leon |
|
Hello Leon. Great Work! It's trending in the right direction. only issue is that the new PR bricks my implementation on the Jetson(Linux). Context: I am running a AWR2243 with the DCA1000. -To benchmark the PR I first captured data using MMwave studio for 15 secs, the file size was ~380MB. This is a spectrogram of my hand moving away and from the radar You would notice that the spectrogram is not as crisp as the previous one. -Using the New PR ADC.py with Mmwave to trigger the radar, the data is is ~380MB and by all indications it appears complete. So we cans that Using mmwave studio this PR works fine. However on the Jetson using an mmwavelink example to trigger the radar, only the Original ADC.py runs and collects data, your previous PR before the last (e78d7ab) worked on the Jetson (and by worked in this instance I mean it executed and data was logged albeit wrongly) but the new PR (22b4743) doesn't . When recording on the Jetson using the original ADC.py, the data is also halved and is about 190MB, here's the spectrogram: when I try your new PR with the Jetson nothing is logged and no data is saved for some reason. I am not doing anything special and my code is pretty basic, see below. so I dont know why the new PR does not work with it . it doesnt timeout too, the board just keeps blinking till I do a keyboard interrupt.
my cf.json file is attached but I dont think the linux implementation uses the cf.json, only mmwave studio does if I'm not mistaken Thanks, Ladi |
|
Thank you for your detailed reply! Glad that it's working for you at least with mmWave studio. The script you posted a screenshot of, in what order do you execute it? Do you first start the script you posted and then send the (configuration and the) |
|
Right now the Radar is triggered first using a different script before the DCA script runs and attempts to start capturing the packets. The code to run the radar is a python script and not mine but i have never seen the ‘sensorStart’ command. My understanding is that you trigger the radar then the DCA because it times out when there are no packets received but i will try it out, maybe there’s a way of creating a delay? Could you share how you trigger your radar and DCA1000? i know it’s a different sensor but i believe it can provide insight as to why this is not working with your new Pull request. Congratulations on your thesis Ladi |
|
You want to do it the other way around: First start recording with the DCA1000 and then start chirping in the sensor. Doing it in this order ensures that the data flow is aligned and the DCA1000 doesn't start reading somewhere in the middle of a frame. Concerning the |
|
Hey I tried it. Triggered the radar after the DCA but it didn't work. I have troubleshooted the code and the adc.py is in fact reading the packets. When I print "packet_data" in function” _read_data_packet(self):" the packets are printed. What I noticed is if you look at my "main" code it never gets out of the read() function to print the second ('here) and just keeps running till infinity if I let it or the socket is going home. it just gets stuck in the read() function do you have any idea why why might be the case? this is my main code #Run radar Senso t_end = time.time() + 5 # Run for 10 seconds while time.time() < t_end:
cmd = kill(radar_loc) It's interesting/funny that with the old adc.py it runs. my thoughts are that the frame never gets full and the buffer is never filled. my initial assessment is that because (frame_id, frame_data) always returns (None, None) in perpetuity, the frame is never filled and is code id stuck within the read()’s "while True" loop my adc params are ADC_PARAMS = {'chirps': 128, # 32 'rx': 4, 'tx': 2, 'samples': 256, 'IQ': 2, 'bytes': 2} I am leaving the vicinity of the radar rn, but I created a “Mock” socket that reads the packets from a recorded file that I created after binding the address of the fpga so I can work on this at home EDIT: when I print(packet_data.nbytes) I get 1456. WTF!!!!!! For some reason it starts at 4 billion!!! You would notice the byte count is unfathomably high but still increments by 1456. This gave me an idea to normalize the byte number before it goes into _place_data_packet_in_frame_buffer(). I create a self.base_byte_count in the DCA .init and set it to None then I place this: if not hasattr(self, 'base_byte_count') or self.base_byte_count is None: This way it always starts from zero regardless of whether I start capturing packet mid stream. I tried this and was able to get out of the read loop finally, the recorded file I used was pretty small so I dont know if this is indicative of what will happen when I try this with the actual data tomorrow. **(EDIT 2)**HELP: haven't gotten to a radar yet but when I printed (frame_id, frame data) after my fix I get (None, None) while the data is filling up then 1 [ 904 65378 630 ... 218 64823 64591] then immediately: WARNING: Dropped Frame(s) 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 since they weren't complete. Is this normal? Do you have any idea What is going on? EDIT 3: is it normal to receive packets for other Frames while one is still being completed ? thats is the only thing that explains it, cause I'm guessing the deleted function is getting rid of them after the timeout, could it be that since I'm emulating a socket using a mock socket file its not fast enough? Ladi |
|
okay, just to be clear for the sake of the topic of this pull request: The solution works for you together with mmWave Studio, which is what this repository and also the PR is aimed at. Now I previously mentioned, the probability is very high, that it is one of the two issues, and not related to the code of this PR:
Now you probably eliminated the timing part, assuming that all the commands you send with What firmware image is flashed to the AWR2243 and how are the chirp parameters set? Are they hardcoded or is there a CLI you can access via UART? If there is a CLI, this is something usually mmWave Studio handles (at least the chirp configuration), so this is something you need to implement on your side.
All I can say is that something is causing none of the frames being read completely due to a configuration misamtch between what is actually configured in the radar and what is configured in your Good luck! |
|
thank you. i figured out the issue. I have it running on a non MmWave triggered pipeline! Regards, |





What
This PR fixes a bug in the ADC reader’s
read()function when the frame size isn’t an integer multiple of the UDP payload sizeBYTES_IN_PACKET=1456. It assumed frames always start/end at packet boundaries, which causes:The combination of the two results in (slightly) corrupted data and a perceived halving of the frame rate.
How
Essentially refactor the whole
read()function:read()calls, with timeout‐based purgingReferences
For background, see my comment on issue #56: #56 (comment)
Closes