User Tools

Site Tools


playground:playground

Differences

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

Link to this comparison view

Next revision
Previous revision
playground:playground [2015/02/24 21:33] – external edit 127.0.0.1playground:playground [2022/10/24 11:05] (current) christiandc
Line 1: Line 1:
 ====== PlayGround ====== ====== PlayGround ======
  
 +
 +
 +## 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.
 +
 +First you have to get the python codes used. Download the following folder : 
 +
 +
 +https://github.com/Inria-Maracas/gr-txid
 +
 +
 +Then, let us create a dockerfile in your home, giving the files instructions we want to use : 
 +
 +
 +<code>
 +
 +FROM m1mbert/cxlb-gnuradio-3.7:1.0 
 +
 +WORKDIR /root
 +
 +COPY ./docker /root
 +
 +RUN chmod -R 777 ./gr-txid-master
 +
 +</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.
 +
 +We can now build our image and then access to it with an ssh command : 
 +
 +
 +<code>
 +
 +you@yourpc:~$ docker build -t <nameofimage> 
 +you@yourpc:~$ docker run -d -p 2222:2222 <nameofimage>
 +you@yourpc:~$ ssh -Xp 2222 root@localhost 
 +
 +</code>
 +
 +Then let us compile the C++ code. Go inside the first folder having the first Cmake. file and launch the compilation : 
 +
 +
 +<code>
 +
 +you@yourpc:~$ cmake .
 +you@yourpc:~$ make
 +you@yourpc:~$ make install
 +
 +</code>
 +
 + The following line might be necessary in case of unfound error : 
 +
 +<code>
 +
 +you@yourpc:~$ mv /<locationofthisfolder>/examples/src/tmp/home/cxlbuser/tasks/task/* /<locationofthisfolder>/examples/src/
 +you@yourpc:~$ rm -rf /<locationofthisfolder>/examples/src/tmp
 +
 +</code>
 +
 +
 +It moves the folders to an other location.
 +To finish the config, execute :
 +
 +
 +
 +<code>
 +
 +you@yourpc:~$ ldconfig
 +
 +</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). 
 +
 +
 +<code>
 +
 +you@yourpc:~$ ./gr_txid/examples/src/emitter.py -T 0 -P 3580 -G 8 -R 0 -f 2
 +
 +</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.
 +The image is ready to be used, we have noax to push it on Dockerhub. The nodes will have access to it through internet. 
 +
 +<code>
 +you@yourpc:~$ docker ps -a 
 +you@yourpc:~$ docker commit [CONTAINER ID] [NEW IMAGE NAME] 
 +you@yourpc:~$ docker tag [NEW IMAGE NAME] [DOCKER USERNAME]/[NEW IMAGE NAME] 
 +you@yourpc:~$ docker login 
 +you@yourpc:~$ docker push [DOCKER USERNAME]/[NEW IMAGE NAME] 
 +
 +</code>
 +
 +You can check your pushed on internet, on dockerhub website. 
 +
 +
 +## 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.
 +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 file tree should look like that:
 +
 +<code>
 +...
 +├── cortexbot
 +│   ├── generate.sh
 +│   ├── my_task
 +        ├──scenario.yaml
 +...
 +</code>
 +
 +Concerning the bash file :
 +
 +<code>
 +
 +#!/bin/bash
 +
 +# Creating the task
 +
 +echo "Tasks creation and submission"
 +
 +echo "Reading scenario my_task"
 +echo "Creating my_task.task"
 +
 +minus task create my_task
 +
 +echo "Submiting my_task.task"
 +
 +minus task submit my_task.task
 +
 +# Delete node folders and tasks
 +
 +rm -rf my_task.task
 +
 +echo "Wait for tasks to finish"
 +
 +loop=True
 +value=$(minus testbed status | grep "(none)" | wc -l)
 +while [ $loop = 'True' ]
 +do
 + if [ $value = '1' ]
 + then loop=False
 + else sleep 10 && echo "."
 + fi
 + value=$(minus testbed status | grep "(none)" | wc -l)
 +done
 +
 +echo "Tasks finished"
 +
 +</code>
 +
 +And the scenario file :
 +
 +
 +<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
 +
 +# Experiment maximum duration
 +#   Time after which the experiment is forced to stop
 +#   integer (seconds)
 +
 +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] 
 +
 +
 +nodes:
 +
 +#scheduler node
 +
 +  node5:
 +    container:
 +      - image: <[DOCKER USERNAME]/[NEW IMAGE NAME]>:latest 
 +        command: bash -lc "python /root/gr-txid-master/examples/src/scheduler.py "
 +
 +
 +#emitter nodes corresponding to the scheduler list
 +
 +  node3:
 +    container:
 +      - image: thomasbeligne/cortexbot2:latest 
 +        command: bash -lc "/root/gr-txid-master/examples/src/emitter.py -T 0 -P 3580 -G 8 -R 0 -f 0"
 +
 +  node4:
 +    container:
 +      - image: thomasbeligne/cortexbot2:latest 
 +        command: bash -lc "/root/gr-txid-master/examples/src/emitter.py -T 1 -P 3580 -G 8 -R 0 -f 0"
 +
 +  node6:
 +    container:
 +      - image: thomasbeligne/cortexbot2:latest 
 +        command: bash -lc "/root/gr-txid-master/examples/src/emitter.py -T 2 -P 3580 -G 8 -R 0 -f 0"
 +
 +  node7:
 +    container:
 +      - image: thomasbeligne/cortexbot2:latest 
 +        command: bash -lc "/root/gr-txid-master/examples/src/emitter.py -T 3 -P 3580 -G 8 -R 0 -f 0"
 +
 +
 +  node8:
 +    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>
 +
 +
 +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.
 +
 +Once you have created this folder, send it to airlock and connect to airlock using ssh : :
 +
 +
 +<code>
 +
 +you@yourpc:~$ scp -P 2269 -v -r /home/thomas/task1/gr_txid thomas@gw.cortexlab.fr:/cortexlab/homes/thomas/workspace/
 +
 +you@yourpc:~$ ssh -X -v username@gw.cortexlab.fr
 +
 +</code>
 +
 +Once your connected, give the rights to the bash file and book the testbed : 
 +
 +<code>
 +
 +you@srvairlock:~$ chmod +x ~/workspace/cortexbot/generateData.sh
 +you@srvairlock:~$ oarsub -l nodes=BEST,walltime=2:00:00 -r '2022-10-11 09:00:00'
 +
 +</code>
 +
 +The airlock config is now done. Let's now prepare the Turtlebot
 +
 +## Config the Turtlebot
 +
 +
 +## Launch the experiment
 +
 +The robot is moving in the Cortexlab and ready to recieve the Data. Go now on your airlock servor and launch the bash file :
 +
 +<code>
 +
 +thomas@srvairlock:~/workspace/cortexbot$ ~/workspace/experience/examples/generateData.sh
 +
 +</code>
 +
 +All the radios present in the scenario are succesivly sending packets to the robot. You can check thath everything is fine by doing : 
 +
 +<code>
 +username@srvairlock:~$ minus testbed status
 +</code>
 +
 +and abort the task
 +
 +<code>
 +username@srvairlock:~$ minus task abort <id_task>
 +</code>
 +
 +## Gathering the results
playground/playground.1424809986.txt.gz · Last modified: 2015/02/24 21:33 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki