Navigation CrossPLA is a cross-platform navigation project written in C++ and configured with CMake. It leverages OpenCV for computer vision tasks and includes organized folders for source (src/). The goal is to develop a robust, portable navigation solution that can be built and run on multiple platforms with minimal configuration.
-
Download the exact binary distribution Depending on your OS (operating system) (e.g., Windows, Mac, and more). Cmake (3.31.4) = https://cmake.org/download/
-
Installing Opencv, Depending on your OS once again pick the correct download. Opencv (OpenCV – 4.10.0) = https://opencv.org/releases/ In my case it is Windows. click on the windows button then install to a path for me it is C:\opencv
-
Create a new environment variable (Windows > Edit the system environment variables). Restart the VS Code to take effect if it is already open. This step is required when we call find_package(OpenCV REQUIRED) in the CMakeList.txt file as we will see later.
Under (User variables) click (new...) and add Variable name:
OpenCV_DIR
Value Value:C:\opencv\build
unless you installed the opencv somewhere else this should be right.
-
Add the following paths to your environment variables (Windows > Edit the system environment variables). This is to find the bin and lib folders.
Under (User variables) click (path) and then click new and add the following 3 things (one by one)
C:\Program Files\CMake\bin
C:\opencv\build\x64\vc16\bin
C:\opencv\build\x64\vc16\lib
- Enable Wsl for Windows.
-
Enable the wsl feature.
- Look up in the windows search bar “turn windows features on or off”. Open the panel.
- Find the “Windows Subsystem for Linux” feature and tick the checkbox to enable it.
- Restart your machine. Make sure that you have all important work saved before restarting.
-
Install Ubuntu
- search up “Ubuntu” in the Microsoft Store.
- Click on “Get” button.
- After installation finishes, open the Windows terminal.
- On the list of tabs, there should be a dropdown button that looks like the letter (V). Click on it and select Ubuntu.
- Follow the instructions if prompted
-
Install the needed packages
- Run the following commands
sudo apt update && sudo apt upgrade sudo apt install -y build-essential ninja-build cmake libopencv-dev
-
If you do not have vscode, install vscode. Packages are found (here).
-
Open up vscode.
-
(Optional) Set up a profile for C/C++ development specifically. (link)
-
Follow the instructions here until you have Ubuntu open in vscode. You will do this everytime you open up vscode.
-
Download the C/C++ extension, CMake Tools extension.
-
When the project is open, pick gcc as compiler if prompted.
-
.\build_and_run.ps1