From f0fe8ae39a2fa6c47cdd4a18016d1c2a0f2a7c68 Mon Sep 17 00:00:00 2001 From: David Protzman Date: Sat, 13 May 2023 12:17:32 -0400 Subject: [PATCH 1/3] Added README for building the add/remove turbo applications in Windows --- cpp/README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 cpp/README.md diff --git a/cpp/README.md b/cpp/README.md new file mode 100644 index 0000000..2cf7beb --- /dev/null +++ b/cpp/README.md @@ -0,0 +1,60 @@ +# Building for Windows + +## Installing and Configuration Cygwin + +1. Download Cygwin from https://www.cygwin.com/setup-x86_64.exe +2. Execute downloaded install executable +3. Select Yes when prompted by User Account Control +4. Click `Next` +5. Select `Install from Internet` and click `Next` +6. Leave `Root Install Directory` alone and click `Next` +7. Leave `Select Local Package Directory` alone and click `Next` +8. Leave `Select Your Internet Connection` alone and click `Next` +9. Select a mirror and click `Next` +10. From the `View` dropdown select `Full` +11. Enter `gcc-g++` in the `Search` box and select `11.3.0-1` in the `New` column for the `gcc-g++` row +13. Enter `autoconf` in the `Search` box and select `15-1` in the `New` column for the `autoconf` row +14. Enter `automake` in the `Search` box and select `11-1` in the `New` column for the `automake` row +15. Enter `make` in the `Search` box and select `4.4.1-2` in the `New` column for the `make` row +16. Enter `git` in the `Search` box and select `2.39.0-1` in the `New` column for the `git` row +17. Enter `wget` in the `Search` box and select `1.21.3-1` in the `New` column for the `wget` row +18. Click `Next` at the bottom right of the window +19. Click `Next` at the `Review and confirm changes` window +20. Click `Finish` to close the window + +## Updating Windows PATH + +1. Click on the Start menu +2. Type `PATH` +3. Select `Edit the system environment variables` +4. A new window called `System Properties` should come up +5. Click `Environment Variables` button +6. In the top panel click the `Path` button +7. In the new window click the `Edit` button +8. In the new window click the `New` button +9. Type in `C:\cygwin64\bin` +10. Click `OK` to close the edit window +11. Click `OK` to close the `Environment Variables` window +12. Click `OK` to close the `System Properties` window +13. At this point you might have to reboot the computer, but sometimes you don't have to + +## Building the Turbo decode/encode executables + +1. Open the Cygwin terminal (should be on your desktop, search the start menu if not) +2. Navigate to where you have extracted/cloned the `dji_droneid` repo in Windows + If you have the code at `C:\Users\\Downloads\dji_droneid` then you would run: `cd /cygdrive/c/Users//Downloads/dji_droneid` in the Cygwin terminal +3. Run the following set of commands in the Cygwin terminal +``` +pushd cpp +wget https://raw.githubusercontent.com/d-bahr/CRCpp/master/inc/CRC.h -O CRC.h +mkdir -p deps; pushd deps +git clone https://github.com/ttsou/turbofec; pushd turbofec +autoreconf -i && ./configure && make && make install +popd && popd +g++ -Wall add_turbo.cc -o add_turbo -I. -I/usr/local/include -L/usr/local/lib -lturbofec +g++ -Wall remove_turbo.cc -o remove_turbo -I. -I/usr/local/include -L/usr/local/lib -lturbofec +``` + +You should now have two new executables: `add_turbo` and `remove_turbo` + +These executables should be usable from Windows From f7e7452413e6d122f4acfe237494fb078a6c8d07 Mon Sep 17 00:00:00 2001 From: David Protzman Date: Sat, 13 May 2023 12:39:43 -0400 Subject: [PATCH 2/3] Added changes to support Windows --- matlab/updated_scripts/process_file.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/matlab/updated_scripts/process_file.m b/matlab/updated_scripts/process_file.m index f1c5813..a298c01 100644 --- a/matlab/updated_scripts/process_file.m +++ b/matlab/updated_scripts/process_file.m @@ -20,7 +20,12 @@ % THIS CAN BE COMMENTED OUT IF NEEDED!!! JUST MAKE SURE TO COMMENT OUT THE `saveas` CALL LATER AS WELL mkdir(fullfile(this_script_path, "images")); -turbo_decoder_path = fullfile(this_script_path, filesep, '..', filesep, '..', filesep, 'cpp', filesep, 'remove_turbo'); +if (~ ispc) + turbo_decoder_path = fullfile(this_script_path, filesep, '..', filesep, '..', filesep, 'cpp', filesep, 'remove_turbo.exe'); +else + turbo_decoder_path = fullfile(this_script_path, filesep, '..', filesep, '..', filesep, 'cpp', filesep, 'remove_turbo'); +end + if (~ isfile(turbo_decoder_path)) error("Could not find Turbo decoder application at '%s'. Check that the program has been compiled",... turbo_decoder_path); @@ -318,12 +323,12 @@ bits = bitxor(bits, second_scrambler); % Write the descrambled bits to disk as 8-bit integers - handle = fopen("/tmp/bits", "wb"); + handle = fopen("bits", "wb"); fwrite(handle, bits, 'int8'); fclose(handle); % Run the Turbo decoder and rate matcher - [retcode, out] = system(sprintf("%s %s", turbo_decoder_path, "/tmp/bits")); + [retcode, out] = system(sprintf("%s %s", turbo_decoder_path, "bits")); if (retcode ~= 0) warning("Failed to run the final processing step"); end From ee5880b92cc23c8520b10ef123098ad392044344 Mon Sep 17 00:00:00 2001 From: David Protzman Date: Sat, 13 May 2023 12:44:00 -0400 Subject: [PATCH 3/3] Got the ispc logic backward --- matlab/updated_scripts/process_file.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/updated_scripts/process_file.m b/matlab/updated_scripts/process_file.m index a298c01..11004bd 100644 --- a/matlab/updated_scripts/process_file.m +++ b/matlab/updated_scripts/process_file.m @@ -20,7 +20,7 @@ % THIS CAN BE COMMENTED OUT IF NEEDED!!! JUST MAKE SURE TO COMMENT OUT THE `saveas` CALL LATER AS WELL mkdir(fullfile(this_script_path, "images")); -if (~ ispc) +if (ispc) turbo_decoder_path = fullfile(this_script_path, filesep, '..', filesep, '..', filesep, 'cpp', filesep, 'remove_turbo.exe'); else turbo_decoder_path = fullfile(this_script_path, filesep, '..', filesep, '..', filesep, 'cpp', filesep, 'remove_turbo');