Core C++ code repo for WSR toolbox with Cython wrapper.
Create a directory named WSR_Project and clone the repository in that directory.
Install python 3.7 (minimum supported version for using visualization scripts) and make it default version
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7 python3.7-tk python3-pip python3.7-dev python3-gdbm cmake
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
sudo update-alternatives --config python3
Select python3.7 as the default version.
Install the python dependency packages
cd ~/WSR_Project
cd WSR-Toolbox-cpp
pip3 install Cython numpy pybind11 pythran
pip3 install -r requirements.txt
Download and compile the boost_1.68 locally in $HOME/Downloads.
cd ~/Downloads
wget http://downloads.sourceforge.net/project/boost/boost/1.68.0/boost_1_68_0.tar.gz
tar -zxvf boost_1_68_0.tar.gz
cd boost_1_68_0/
./bootstrap.sh
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
sudo ./b2 --with=all -j $cpuCores
Note: Do not run install since will break the default boost installation required for ROS systems.
Compile as a standalone C++ project
Create new subdirectory in the WSR-Toolbox folder to store the build
cd ~/WSR_Project/WSR-Toolbox-cpp/
mkdir wsr_build && cd wsr_build
cmake ..
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
make -j $cpuCores
cd wsr_build
./test_csi_data
cd wsr_build
./test_wsr <displacement type>
e.g. ./test_wsr gt
## Compiling and using Cpython modules
1. First run the setup.py
$ python3 setup.py build_ext --inplace
The above code will auto generate a wsr_module.cpp file in the Cpython_modules directory. A libarary file will also be generated in the scripts/libs directory.
Note: sometimes if the Cpython_modules/wsr_module.cpp file is not deleted before running setup.py, the changes made in C++ modules do not take effect.
cd scripts python3 main.py --d_type gt
The main.py triggers the code similar to test_wsr.
3. The status of some important flags and parameters are available during initialization. (This requires that the 'debug' config parameter is set to 'true' to see the status during code execution):
log [Precomp]: Important FLAGS status Trajectory Type = "2D" (3D) FLAG_packet_threshold = true FLAG_debug = true __FLAG_threading = true FLAG_interpolate_phase = true FLAG_sub_sample = false FLAG_normalize_profile = true FLAG_use_multiple_sub_carriers = false __FLAG_use_magic_mac = false
## Visualization
All the data files pertaining to visualization are generated in the **debug** directory by default. The visualization scripts can be found in the **scripts directory**. The following data are visualized:
1. WiFi signal phase : This plot can greatly simply debugging.
2. Packet distriution along robots's displacement: Shows if the WiFi packets are distributed uniformly during robot motion or whether there are substntial packet loss
3. Angle-of-Arrival profile
An example of the above plots is show in the [wiki here]()
1. To visualize the latest data generated in the debug directory use the following
bash ./scripts/viz_data.sh
1. TX_neighbor robot ids: tx0, tx2, tx3 etc.
2. displacement type: 2D , 3D
3. backend visualizer : matplotlib (default), matlab
For example to visualize the data for tx2, tx3 and tx4 (as per the details in the config file) using python matplotlib, run the following command
e.g. ./scripts/viz_data.sh debug/ 'tx2 tx3 tx4' 2D
To use matlab visualizer (recommended for offline testing), run the following script instead
./scripts/viz_data.sh debug/ 'tx2 tx3 tx4' 2D matlab
Note :If the matlab viewer is used for visualizing the AOA profile, then make sure that the matlab api for python has be installed ([reference](https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html)).
### Testing Trajectory data
Go to the scripts directory
1. Optitrack Mocap data
python3 main.py --f ../data/mocap_data_a.txt_2020-02-29_171359.txt --mocap_id 102 --parser_type optitrack
2. T265 data
python3 main.py --f ../data/mocap_data_a.txt_2020-02-29_171359.txt --parser_type t265