User Tools

Site Tools


creating_datasets_for_fingerprinting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
creating_datasets_for_fingerprinting [2022/10/24 17:04] christiandccreating_datasets_for_fingerprinting [2022/11/09 12:15] (current) christiandc
Line 1: Line 1:
 +#Creating a dataset for fingerprinting
 +
 +The objective of this tutorial is to create a non biased dataset for transmitter identification. By fixing the reciever on a robot, the distance and the canal is constantly and randomly changing, forcing the deep learning process to learn on the RF fingerprints. This tutorial explains how to use FIT/Cortexlab to create this dataset. 
 +
 +Requirement : An access to the CortexLab to start the robot.
 +
 ## Create your docker image ## Create your docker image
  
-Using docker, we will enable the nodes to use Gnuradio 3.7. The codes used are written in this version (waiting for an updtae). In order to do that, we will create an image containing theGnuradio 3.7 version and the python/C++ files used for the dataset creation.+With docker, we will enable the nodes to use Gnuradio 3.7. The codes used are written in this version (waiting for an update). In order to do that, we will create an image containing theGnuradio 3.7 version and the python/C++ files used for the dataset creation.
  
 First you have to get the python codes used. Download the following folder :  First you have to get the python codes used. Download the following folder : 
- 
  
 https://github.com/Inria-Maracas/gr-txid https://github.com/Inria-Maracas/gr-txid
- 
  
 Then, let us create a dockerfile in your home, giving the files instructions we want to use :  Then, let us create a dockerfile in your home, giving the files instructions we want to use : 
- 
  
 <code> <code>
Line 18: Line 21:
 WORKDIR /root WORKDIR /root
  
-COPY ./docker /root+COPY ./<python_folder_name> /root
  
-RUN chmod -R 777 ./gr-txid-master+RUN chmod -R 777 ./<python_subfolder_name>
  
 </code> </code>
  
    
-In this dockerfile, the first line download the 3.7 Gnuradio version. Then it adds the python files used for the dataset and gives the rights to the folder.+In this dockerfile, the first line download the 3.7 Gnuradio version. Then it adds the python files used for the dataset creation and finally it gives the execution rights to the folder
 + 
 +Before building the image, take the node list used by the code which is in the scheduler.py file. This node list will be used in the scenario.
  
-We can now build our image and then access to it with an ssh command : +We can now build our image and then access into it with an ssh command : 
  
  
Line 38: Line 43:
 </code> </code>
  
-Then let us compile the C++ code. Go inside the first folder having the first Cmake. file and launch the compilation : +Then let us compile the C++ code in the container. Go inside the first folder having the Cmake. file and launch the compilation : 
  
  
 <code> <code>
  
-you@yourpc:~$ cmake . +root@containerID:~$ cmake . 
-you@yourpc:~$ make +root@containerID:~$ make 
-you@yourpc:~$ make install+root@containerID:~$ make install
  
 </code> </code>
  
- The following line might be necessary in case of unfound error : +The following lines might be necessary in case of unfound file error : 
  
 <code> <code>
- +root@containerID:~$ mv /<locationofthisfolder>/examples/src/tmp/home/cxlbuser/tasks/task/* /<locationofthisfolder>/examples/src/ 
-you@yourpc:~$ mv /<locationofthisfolder>/examples/src/tmp/home/cxlbuser/tasks/task/* /<locationofthisfolder>/examples/src/ +root@containerID:~$ rm -rf /<locationofthisfolder>/examples/src/tmp
-you@yourpc:~$ rm -rf /<locationofthisfolder>/examples/src/tmp +
 </code> </code>
  
- 
-It moves the folders to an other location. 
 To finish the config, execute : To finish the config, execute :
- 
- 
  
 <code> <code>
  
-you@yourpc:~$ ldconfig+root@containerID:~$ ldconfig
  
 </code> </code>
  
-For you to be sure the config has been done properly, you can launch the emitter or recevier command (used then to create the dataset). +To be sure the config has been done properly, you can launch the emitter or recevier command (used then to create the dataset). 
  
  
 <code> <code>
- +root@containerID:~$ ./gr_txid/examples/src/emitter.py -T 0 -P 3580 -G 8 -R 0 -f 2
-you@yourpc:~$ ./gr_txid/examples/src/emitter.py -T 0 -P 3580 -G 8 -R 0 -f 2 +
 </code> </code>
  
 At this point the only message error should be this one : empty devices services. Meaning that there is no USRP available on your laptop. At this point the only message error should be this one : empty devices services. Meaning that there is no USRP available on your laptop.
-The image is ready to be used, we have noax to push it on Dockerhub. The nodes will have access to it through internet. + 
 +The image is ready to be used, we have now to push it on Dockerhub. The nodes will have access to it through internet. (you first need to create a docker account)
  
 <code> <code>
Line 88: Line 86:
 you@yourpc:~$ docker login  you@yourpc:~$ docker login 
 you@yourpc:~$ docker push [DOCKER USERNAME]/[NEW IMAGE NAME]  you@yourpc:~$ docker push [DOCKER USERNAME]/[NEW IMAGE NAME] 
- 
 </code> </code>
  
-You can check your pushed on internet, on dockerhub website. +You can check your pushed image on internet, on dockerhub website. 
  
  
 ## Create your airlock scenario ## Create your airlock scenario
  
-We have now to create the scenario read by minus on the airlock. Create a .sh file and a .yaml file. +We have now to create the scenario read by minus on the airlock. Create a .sh file and a .yaml file inside a folder (cortexbot)
-The .sh file wille execute the commands submitting the task with minus. The .yaml file is the scenario ypou will modifie to create your experiments.+The .sh file will execute the commands submitting the task with minus. The .yaml file is the scenario you will modifie to create your experiments.
  
 The file tree should look like that: The file tree should look like that:
Line 110: Line 107:
 </code> </code>
  
-Concerning the bash file :+The bash file for the execution :
  
 <code> <code>
- 
 #!/bin/bash #!/bin/bash
  
Line 119: Line 115:
  
 echo "Tasks creation and submission" echo "Tasks creation and submission"
- 
 echo "Reading scenario my_task" echo "Reading scenario my_task"
 echo "Creating my_task.task" echo "Creating my_task.task"
Line 147: Line 142:
  
 echo "Tasks finished" echo "Tasks finished"
- 
 </code> </code>
  
 And the scenario file : And the scenario file :
- 
  
 <code> <code>
- 
-# Example scenario description file 
-# 
-# All lines starting with "#" and empty lines are ignored 
- 
- 
-# Scenario textual description 
-#   simple string (a one liner) 
 description: Base scenario for TXid dataset generation description: Base scenario for TXid dataset generation
- 
-# Experiment maximum duration 
-#   Time after which the experiment is forced to stop 
-#   integer (seconds) 
  
 duration: 3600 duration: 3600
- 
-# Node list 
-# 
-#   format: 
-# 
-#   (machine): 
-#   entry (entry point script relative to the task root) 
-#   exit (exit point script relative to the task root. Use "none" for none) 
- 
  
 #list of scheduler nodes= = [3, 4, 6, 7, 8, 9, 13, 14, 16, 17, 18, 23, 24, 25, 27, 28, 32, 33, 34, 35, 37]  #list of scheduler nodes= = [3, 4, 6, 7, 8, 9, 13, 14, 16, 17, 18, 23, 24, 25, 27, 28, 32, 33, 34, 35, 37] 
- 
  
 nodes: nodes:
Line 190: Line 161:
       - image: <[DOCKER USERNAME]/[NEW IMAGE NAME]>:latest        - image: <[DOCKER USERNAME]/[NEW IMAGE NAME]>:latest 
         command: bash -lc "python /root/gr-txid-master/examples/src/scheduler.py "         command: bash -lc "python /root/gr-txid-master/examples/src/scheduler.py "
- 
  
 #emitter nodes corresponding to the scheduler list #emitter nodes corresponding to the scheduler list
Line 215: Line 185:
  
  
-  node8: +#add as many nodes you want to use
-    container: +
-      - image: thomasbeligne/cortexbot2:latest  +
-        command: bash -lc "/root/gr-txid-master/examples/src/emitter.py -T 4 -P 3580 -G 8 -R 0 -f 0"   +
 </code> </code>
  
  
-You can add as many nodes as you want, but be sure they are in the scheduler list on your docker file. In your scenario yu have to check the transmitter identifiacation -T <value>. The value has to correspond to the rank of the nodes in the scheduler list.+You can add as many nodes as you want, but be sure they are in the scheduler list on your image docker. In your scenario you also have to check the transmitter identification "-T <value>". The value has to correspond to the rank of the nodes in the scheduler list.
  
-Once you have created this folder, send it to airlock and connect to airlock using ssh : :+Once you have created this folder, send it to airlock and connect to it using ssh : :
  
  
 <code> <code>
  
-you@yourpc:~$ scp -P 2269 -v -r /home/thomas/task1/gr_txid thomas@gw.cortexlab.fr:/cortexlab/homes/thomas/workspace/ +you@yourpc:~$ scp -P 2269 -v -r /home/username/task1/gr_txid username@gw.cortexlab.fr:/cortexlab/homes/username/workspace/
 you@yourpc:~$ ssh -X -v username@gw.cortexlab.fr you@yourpc:~$ ssh -X -v username@gw.cortexlab.fr
  
Line 248: Line 213:
  
 ## Config the Turtlebot ## Config the Turtlebot
 +
 ###Setup ###Setup
-Before the experiement, charge the TurtleBot at least one hour prior (to avoid overcharging and damaging the battery it is not recommended to charge overnight).+Before the experiement, charge the TurtleBot at least one hour prior
 +(//To avoid overcharging and damaging the battery it is not recommended to charge overnight//).
  
 Our TurtleBot is wired up in the following way : Our TurtleBot is wired up in the following way :
  
-{{ :img_6221.jpeg |}} +{{ :img_6221.jpeg?400 |}}
  
 We use a NVDIA Jetson to run the movement program and reception code : We use a NVDIA Jetson to run the movement program and reception code :
Line 261: Line 227:
  
  
-###Switting on the TurtleBot +###Switching on the TurtleBot 
-Switch on the base of the robot by pressing this switch on :+Switch on the base of the robot
 +(the green "//Status//" LED should be turned on, and not flash, nor be yellow. In that case the robot hasn't got enough battery.)
  
-{{ :img_6215.jpeg?400 |}} 
  
-(the green "//Status//" LED should be turned on, and not flash nor be yellow. In that case the robot hasn't got enough battery.)+To turn the computor on press the furthest button to the left, on the side of the computor : 
 +//(if turned on correctly a flat white LED should be on) 
 +//
  
 +{{ :img_6217.jpeg?600 |}}
  
-###+ 
 +###Launching the programs 
 +Plug in the computor to a monitor through an HDMI capble and plug in a keyboard and mouse. 
 +Login to the computor with the user : ''CorteXbot'' and the password : ''cxlbusr''
 + 
 +Transfer the first part python codes folder in the robot computer. 
 +To run the reciever code (from gr-txid) enter into the terminal : 
 + 
 +<code> 
 + 
 +.<file_path>/reciever.py -R re_00 -I im_00 
 + 
 +</code> 
 + 
 +The USRP should boot and the LED of the Tx/Rx port used should light up : 
 + 
 +{{ :img_6219.jpeg?400 |}} 
 + 
 +The results (''re_00_...'', ''im_00_...'') shall be put into the ''/home'' directory. 
 + 
 +Open two other terminals and in one launch minimal.launch : 
 + 
 +<code> 
 + 
 +source ~/ROS/catkin_ws/devel/setup.bash 
 +cd ~/ROS/catkin_ws/src/CorteXbot/launch 
 +roslaunch minimal.launch 
 + 
 +</code> 
 + 
 +The Turtle bot should beep. (Ignore the error messages if the robot beeps). 
 + 
 +In the other terminal run the random walk program :  
 +//(Be sure to disconnect the HDMI cable and keyboard/mouse when pressing enter). 
 +// 
 + 
 +<code> 
 + 
 +rosservice call /cortexbot/movement_on 
 + 
 +</code> 
 + 
 +#
  
  
Line 278: Line 289:
 <code> <code>
  
-thomas@srvairlock:~/workspace/cortexbot$ ~/workspace/experience/examples/generateData.sh+username@srvairlock:~/workspace/cortexbot$ ~/workspace/experience/examples/generateData.sh
  
 </code> </code>
  
-All the radios present in the scenario are succesivly sending packets to the robot. You can check thath everything is fine by doing : +All the radios present in the scenario are succesivly sending packets to the robot. You can check that everything is fine by doing : 
  
 <code> <code>
Line 295: Line 306:
  
 ## Gathering the results ## Gathering the results
 +To gather the results, at the end of the emissions we used a USB stick to collect the results directly from the computer of the robot. Copy and paste all the files under the format :
 +<code>
 +re_00_[number du node] and im_00_[number of node]</code>
 +
 +
 +Congratulations, you have succesfully generated a dataset with the FIT/Cortexlab.
creating_datasets_for_fingerprinting.1666623878.txt.gz · Last modified: 2022/10/24 17:04 by christiandc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki