-
Notifications
You must be signed in to change notification settings - Fork 86
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
(Question) drone_id_test.grc failed to output file #1
Comments
Thanks for the ticket! The issue you're seeing is that I added debugging logic to the various modules that outputs files to https://github.com/proto17/dji_droneid/blob/gr-droneid/gnuradio/gr-droneid/lib/demodulation_impl.cc#L88 If you choose not to comment out the lines be aware that you might run out of disk space if you leave the graph running for hours and hours. The files are very small and what's getting written is just the burst itself for debugging purposes (I throw them into MATLAB and plot things) Just to reiterate, this is a WIP and I might end up breaking things here and there. Feel free to post tickets like this to bring it to my attention :) Oh, and the code has only been tested against the DJI Mini 2. I know that some drones only send 8 OFDM symbols while my drone sends 9. Mine sends one additional symbol at the beginning, but that symbol zeros out after the scrambler is removed, so it's not actually used. The logic was updated to not look at the first symbol for frequency offset correction. |
Thank you, works great now. I'll close the ticket and try this out on as soon as I can. There's an aerial photographer person around here, I think they've got a Mini 2 as well as the Mavic 3. Have to see if they'll let me experiment again! This was an easy test on DragonOS as it already had everything needed to run. |
Sorry one other question, based on the flow graph defaults for sample rate and my limited knowledge at the moment, is it safe to assume you need an SDR that’s at least capable of doing a sample rate of 30msps or greater? |
DroneID is 10 MHz of occupied bandwidth, so in theory you could sample at ~ 10 MSPS (assuming you have a really good filter with sharp roll-off) and resample to 15.36 MSPS to do demod. I was using 30.72 as it gave me the ability to offset tune to get the DC spike out of the way, and made it easier to hunt for the signal (since it hops around). You should be able to change |
Thank you. I’ll try it as is and also change to what you explained above and see if the hackrf is sufficient. I also have a lime/blade to try out as well. |
So there are going to be two main problems:
I'm looking at a way to fix the second issue by autocorrelating for the true ZC sequence start. That logic will be in the MATLAB/Octave before the OOT module though as the OOT module is secondary for me at the moment. I'll take a look at the first issue tonight and see if it's an easy fix. For drones that send 9 OFDM symbols, the first one is just a constant value that ends up as all zeros after removing the scrambler. So it's not all that useful anyway. |
Quick correction: The OOT modules does do CFO estimation and correction based on the second (your first) OFDM symbol. Working on adding in some debugging to show extra information to help with troubleshooting. I just have the DJI Mini 2 here to test with, so these kinds of issues will keep happening =\ |
Oh that's perfect! Thank you! The signal you're seeing in the first part is likely just Bluetooth. They are usually pretty narrow and look like little cones. Around 2:00 is where you start to see Drone ID bursts. I'm not sure why you're not getting a constellation plot that makes any kind of sense. Usually if there is just a freq offset you'll see a ring, not a blob. As for the rampant crashing, well, poop. I haven't given this branch any love in a while due to trying to make the MATLAB/Octave work reliably. I'll try running for longer here to see if I can recreate that crashing. |
Additionally, the signal does jump around between frequencies. It doesn't stay put for long which is why I made the GNU Radio graph in the first place. Taking really long collects just to get a frame or two wasn't working out well. I've been told that it might be moving between 2.4 and 5.8 GHz vs the usual stay put in one band that most systems seem to use. You only get to see a burst every ~ 640 milliseconds and I don't normally see more than ~ 15 bursts at a single frequency before it moves on. |
One possible thing that's causing you to not see constellations: The amplitude of the constellation is too high. Try setting the X/Y max/min values to something like -10 and 10 instead of -2 and 2 that are set by default. Alternatively, enable auto scaling. I think that what you are seeing in the constellation plot is actually the FFT bins that are not carrying data. Those will all usually be fairly low amplitude which means they cluster together in the center of the constellation plot. The graph is exploding regularly for me too :( Will be looking at what's causing the problem |
I’ll take all this info and try again tomorrow evening. I’ll look into what else may have been transmitting and go even further away from stuff and/or not just disable but power off anything additional I have on me. Exciting stuff, not to mention the first time I’ve actually messed with a DJI. |
The crashing issue you were seeing was due (at least in part) to walking off the edge of an array. There is a commit in the gr-droneid branch [1] that should fix it. No real need to get a completely RF quiet area. It's rather unlikely to get a false trigger. The real thing to stay away from is WiFi. Try not to use frequencies that are being used by your WiFi AP as those transmit wide bandwidths and very frequently. |
Getting a fatal error on extractor_impl.cc of droneid/misc_utils.h No such file or directory after doing the pull. I’ll retrace my steps. |
Man... I really should have just gone to bed. I goofed twice in a row with that fix. The local copy of the repo that I am using has some changes to the utilities that don't exist in the remote just yet. Gimmie a sec to fix that. Maybe now that I'm awake it won't all go pear shaped. |
Give the new main a go and see if that helps. Apologies for the busted code! |
Pulled main, switched to gr-droneid and did another pull. Builds and installs fine now. I’m probably not helping with the sleeping part haha! Thanks for the update. I’ll give it another go this evening. |
Flow graph was so much more stable, in fact I only got it to close out by cranking the gain next to some WiFi networks. It took me a little to realize I was seeing (I think) the burst. |
You're definitely seeing bursts. If you zoom out on the constellation plot (bottom plot) you'll likely see some constellations :) |
I didn’t even realize I could zoom out or just didn’t think of that, but good to hear I’m looking at the right thing. The last record to file sink I did in the video came out to about 2.3GB so I’ll see if I can work with that and use your other tools. Hopefully I can borrow the drone again some time. Safe to assume this ticket can probably be closed. Although it’s been helpful to share info and learn. |
To do anything with the smaller capture, is that where I'd need to start learning about Matlab/Octave? I compiled the turbo decoder and was reading the notes at the top of it, doesn't seem like I can just feed it a 2.3GB file and expect it to do something with it. |
There is a very brief and vague explanation at https://github.com/proto17/dji_droneid/#how-to-process-samples. There is a script called You don't need to process the full file if there were bursts. Check your /tmp/bursts directory after running the flow graph. That directory will contain one file per burst detected by the flow graph. This problem of processing giant files is why I created the graph and partially why it doesn't do full equalization and demod. I just needed it to pull bursts out instead of having to wait for minutes and accumulating GBs of samples. You can feed the individual bursts to the |
Now I get what the tmp part is for. I wasn't connecting the dots. I went in and disabled that part of the code. I'll put it back, then use my file capture to run back through GNU Radio and get the bursts this time in /tmp, hopefully. |
Whoops, it looks like I commented out the saving of the bursts. Uncomment line 85 in time_sync_impl.cc (https://github.com/proto17/dji_droneid/blob/gr-droneid/gnuradio/gr-droneid/lib/time_sync_impl.cc#L85) to have each burst saved off. The file you're looking at now is the golden reference for the ZC sequence. Though as this thread has been going, I'm wondering if my ZC sequence is wrong. I think it's supposed to be one sweep, not two O.o Might need to remove the call to fftshift. Sorry about that! |
Oh I gotcha, I’ll go do that. That way I’ll get more bursts I suppose. |
Should it be pdu_element_count at the end of line 85 in time_sync_impl? |
Were you by chance tuning around during the recording? It's very strange to me that you found a good ZC sequence, but didn't have any symbols before, and the symbols after were rather garbage except for number 7. The version of the MATLAB/Octave code in the GNU Radio branch is a little bit behind. You can comment out these lines in the process_file.m script https://github.com/proto17/dji_droneid/blob/gr-droneid/matlab/updated_scripts/process_file.m#L151-L153. Then run it again and you should see frames. In the latest Also, the MATLAB/Octave code in |
I reran again as I walked away to bed on a much larger capture, woke up thirsty just now and couldn’t resist checking. I’m looking at frames printed to screen with a good looking png. I think we have success! edit: I was using the gnuradio branch for its one piece, but main for all the new decoding stuff. However, I was tuning around in some of the captured. I’ll make better notes when I’m awake again. |
The structure of the DroneID frame is slightly different on the "RF" (I
don't have a better name) link vs the WiFi. The beginning and end are
slightly different. The middle does match up if memory serves. See
https://github.com/proto17/dji_droneid/blob/main/matlab/updated_scripts/transmit/create_frame_bytes.m
for a full breakdown of the fields. It's not documented *at all* but the
order of the fields can be seen at line 185
…On Fri, May 6, 2022 at 9:41 AM alphafox02 ***@***.***> wrote:
Messing with the resulting frames and attempting to line up the info
against an image on Twitter of how the drone ID breaks down. It seems like
some parts of the beginning and end match up, but I’m curious if the
matlab/decoder script blanks out any portion of the dji packet.
[image: 0A2FC076-8313-4AC4-9AF8-1D114182B082]
<https://user-images.githubusercontent.com/44436101/167144074-0efb42ce-7a87-4f73-8c55-1f873b37ecea.jpeg>
—
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABALJH3MTC5PIGKJOF3VPGDVIUOOXANCNFSM5UDYNUDQ>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Thank you for the help along the way! I think this ticket is filled with valuable info. At this point everything seems to be working perfectly. I’ll go ahead and close and continue to test and refine on my end. Super awesome, thanks sharing! |
I ran the entire IQ file again (same one) through the octave script and the frames were exactly like I got back 4 days or so ago, except, after the last number in my previous attempt there was lots of zeros and then another string of numbers this time. Basically the frame was longer, but everything up till the ten or so zeros was exactly the same as before. I'm just wondering could this have been do to code changes in main and the decoding process? I'm going to attempt again and see if the frame is still the longer length. I failed to keep track of my git pulls, so it's possible I was running older code in main last week. Just thought this was odd and wondered if you've ran into this on your end. edit: The frame the first time around was roughly 182 characters long |
There was an update to The relevant commit is 000d76e |
I did multiple IQ files on different days, so power cycles happened. I'll look closer now at all of them and see what remains the same using the latest code in main. Without sharing the frame from last week online, what I'm seeing is about 68 characters before hitting more or less 50 zeros (there's a few non zeros) and then back to roughly 64 various numbers. Sorry for being vague. I'll study all results closer and attempt to decode them again and see if my lat/long and other information is correct. |
I checked the remove_turbo.cc file on the machine I decoded the burst with initially and it did not have the commit you referenced above. This explains why my output is different now that I'm decoded it with the newer code in main. |
I’m somewhat stuck on converting the lat/long - the hex portion seems to make make sense but I’m not sure how to convert the float into a readable lat/long that matches up with where I was standing. |
Check out [1] and [2] to see how to convert the value. This is the arithmetic to convert from a floating point lat/long to the packed integer representation that is used in the DroneID frame. [1] https://github.com/proto17/dji_droneid/blob/main/matlab/updated_scripts/transmit/create_frame_bytes.m#L158 |
Got it and it comes out spot on. Had a little extra help with the conversation but all good now. Thank you. |
Very interesting work and write-up. I'd love to test against a Mavic 3, however, after installing w/ GR 3.8 and attempting to run w/ a B205mini I get the following when running the drone_id_test.
I suspect it's something to do with the note about 1024 FFT and maybe my use of the 205. Although the failed to open output file has me confused. I'm not super familiar with how the droneid_swig.py is generated besides what I quickly researched after reading the top of the file saying that it's automatically generated.
The correlation_test flow graph has no problems running.
The text was updated successfully, but these errors were encountered: