= Tournament game example !#1 = [[TOC(DSC*,depth=2)]] == Objective == Use an OEDL script to execute a competitive-style game (similar to what will occur in the Wildcard and Preliminary matches). The example game involves a simple house bot, and the teams provide their own radio script. Teams may modify this script to use other radio bots of their own design in place of the house bot. The example OEDL script can use four different topological configurations for team nodes: dsc-teamA, dsc-teamB, dsc-teamC, and dsc-teamD (the actual topology descriptions are '''system:topo:dsc-team{A,B,C,D}'''). The configurations should be considered to be fixed for the purpose of the games, and teams simply choose which node-pair topology (A, B, C, or D) to place their image on. In the case described in this example, the first team is being placed in the '''A''' topology while the second team is placed in topology '''C'''. Also, we are using a house bot for both teams so that the example can be tested as-is. Teams should note that they should replace dsc-bot.ndz with their respective team-image.ndz. == Hardware / Software Resources Used == 1. Four grid nodes with USRP N210s (two for each team). 2. ''dsc-bot.ndz'': house bot disk image loaded onto one pair of nodes. This image has all the prerequisite software to configure the USRPs and execute a house radio bot. 3. ''team-image.ndz'': disk image that contains the team's radio. In the explanation that follows, we use the house bot as the team's radio, effectively placing house bot against house bot. 4. Scoring packet server: This is the server that resides on the grid console (for the practice) and is used by the source nodes to send data packets over the air via USRP as well as by the sink nodes to submit received packets for scoring. 5. [attachment:dsc-wildcard.rb]: this is the OEDL experiment script to execute the game. == Setting up the nodes == * To get started, first make a reservation on the [https://www.orbit-lab.org/loginService/ControlPanel Orbit Scheduler] for using the Grid. * After logging into grid console, make sure all nodes are turned off (in the example below, turn off all the nodes in the grid): {{{ username@console.grid:~$ omf tell -a offh -t system:topo:all }}} * Verify state of node before continuing. Make sure nodes are in the POWEROFF state. {{{ username@console.grid:~$ omf stat }}} * Image the two nodes to be used for the first team's radios (team A nodes): {{{ username@console.grid:~$ omf load -i dsc-bot.ndz -t system:topo:dsc-teamA }}} * Image the two nodes to be used for the second team's radios (in this case team C nodes): {{{ username@console.grid:~$ omf load -i dsc-bot.ndz -t system:topo:dsc-teamC }}} * Turn nodes back on and verify they are in POWERON state {{{ username@console.grid:~$ omf tell -a on -t system:topo:teamA username@console.grid:~$ omf tell -a on -t system:topo:teamC }}} * Download the [attachment:dsc-wildcard.rb OEDL experiment script for this tutorial] to your local directory. {{{ username@console.grid:~$ wget http://www.orbit-lab.org/raw-attachment/wiki/DSC/dc_trial2/dsc-wildcard.rb }}} == Running the experiment script == By default, the experiment script will execute '''/root/gnuradio/gr-digital/examples/narrowband/bot1_tx.py''' and '''/root/gnuradio/gr-digital/examples/narrowband/bot1_rx.py''' on the source and sink respectively, for both the house bot and the team's bot. In the example described above, where the house bot is competing against another house bot, each team will use a separate set of parameters for a very simple bot: a brute-force radio that sends a random number of packets at random intervals. The sender module draws packets from a packet server, while the sink module delivers packets to the same packet server. The code is based on the same benchmark radio that was used for Hurdle 3. * Type to following command to run the experiment. This will start the packet server, start the source and sink for both teams and release the packet source. The actual transmission/reception will run for 100 seconds (which can be adjusted with the property at the top of the script) or until one radio successfully transmits the file. {{{ username@console.grid:~$ omf exec dsc-wildcard.rb -- --team1 dsc-teamA --team2 dsc-teamC }}} * The output should look similar to the following: {{{ username@console.grid:~# omf exec dsc-wildcard.rb -- --team1 dsc-teamA --team2 dsc-teamC INFO NodeHandler: OMF Experiment Controller 5.4 (git 578791f) INFO NodeHandler: Slice ID: default_slice (default) INFO NodeHandler: Experiment ID: default_slice-2013-06-25t15.36.33.467-04.00 INFO NodeHandler: Message authentication is disabled INFO Experiment: load system:exp:stdlib INFO property.resetDelay: resetDelay = 230 (Fixnum) INFO property.resetTries: resetTries = 1 (Fixnum) INFO Experiment: load system:exp:eventlib INFO Experiment: load system:exp:winlib INFO Experiment: load dsc-wildcard.rb INFO property.team1: team1 = "dsc-teamA" (String) INFO property.team2: team2 = "dsc-teamC" (String) INFO property.freq: freq = "1700000000" (String) INFO property.server: server = "localhost" (String) INFO property.port: port = "5123" (String) INFO property.runtime: runtime = 100 (Fixnum) INFO Topology: Loaded topology 'system:topo:dsc-teamA'. INFO Topology: Loaded topology 'system:topo:dsc-teamC'. INFO stdlib: Waiting for nodes (Up/Down/Total): 1/3/4 - (still down: node2-1.grid.orbit-lab.org,node20-19.grid.orbit-lab.org,node1-1.grid.orbit-lab.org) [0 sec.] INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks. INFO exp: Give machines some time to warm up INFO exp: Request from Experiment Script: Wait for 1s.... INFO exp: Start packet server INFO 15:36:49.402 (main.cpp:661) - Sending Random data INFO 15:36:49.403 (main.cpp:766) - Starting the server at INFO 15:36:49.405 (main.cpp:515) - Starting TCP sender server at 5123 INFO 15:36:49.405 (main.cpp:539) - Starting UDP sender server at 5124 INFO 15:36:49.405 (main.cpp:588) - Starting report server at 5127 INFO 15:36:49.405 (main.cpp:574) - Starting UDP receiver server at 5126 INFO 15:36:49.405 (main.cpp:554) - Starting TCP receiver server at 5125 INFO 15:36:49.405 (main.cpp:604) - Starting start signal server at 5128 INFO exp: Request from Experiment Script: Wait for 2s.... INFO exp: Start benchmark_rx,tx INFO exp: Request from Experiment Script: Wait for 5s.... INFO 15:36:51.674 (main.cpp:566) - Rx Thread count: 1 INFO 15:36:51.778 (main.cpp:566) - Rx Thread count: 2 INFO 15:36:53.195 (main.cpp:531) - Tx Thread count: 1 INFO 15:36:53.195 (main.cpp:122) - Team Number: 2 INFO 15:36:53.227 (main.cpp:531) - Tx Thread count: 2 INFO 15:36:53.227 (main.cpp:122) - Team Number: 1 INFO exp: send signal to packet server to start serving packets Sending start signal INFO exp: Request from Experiment Script: Wait for 100s.... INFO 15:36:56.647 (main.cpp:491) - gStartSignal: 1 INFO 15:37:11.686 (main.cpp:386) - TEAM 1 t=15000(ms) rx/tx bytes=1391040/1870560 success=74.3649% INFO 15:37:11.686 (main.cpp:386) - TEAM 2 t=15000(ms) rx/tx bytes=194400/1152000 success=16.875% INFO 15:37:26.686 (main.cpp:386) - TEAM 1 t=30000(ms) rx/tx bytes=2797920/3598560 success=77.7511% INFO 15:37:26.686 (main.cpp:386) - TEAM 2 t=30000(ms) rx/tx bytes=361440/2160000 success=16.7333% INFO 15:37:41.686 (main.cpp:386) - TEAM 1 t=45000(ms) rx/tx bytes=4187520/5330880 success=78.5521% INFO 15:37:41.686 (main.cpp:386) - TEAM 2 t=45000(ms) rx/tx bytes=398880/3168000 success=12.5909% INFO 15:37:56.686 (main.cpp:386) - TEAM 1 t=60000(ms) rx/tx bytes=5493600/7198560 success=76.3153% INFO 15:37:56.686 (main.cpp:386) - TEAM 2 t=60000(ms) rx/tx bytes=398880/4176000 success=9.55172% INFO 15:38:11.686 (main.cpp:386) - TEAM 1 t=75000(ms) rx/tx bytes=6962400/8926560 success=77.9965% INFO 15:38:11.686 (main.cpp:386) - TEAM 2 t=75000(ms) rx/tx bytes=398880/5184000 success=7.69444% INFO 15:38:26.686 (main.cpp:386) - TEAM 1 t=90000(ms) rx/tx bytes=8311680/10660320 success=77.9684% INFO 15:38:26.686 (main.cpp:386) - TEAM 2 t=90000(ms) rx/tx bytes=413280/6192000 success=6.67442% INFO exp: Stop eveything INFO exp: Request from Experiment Script: Wait for 2s.... DEBUG 15:38:38.990 (main.cpp:282) - Connection closed INFO 15:38:38.990 (main.cpp:340) - Rx Thread count: 1 DEBUG 15:38:39.163 (main.cpp:282) - Connection closed INFO 15:38:39.163 (main.cpp:340) - Rx Thread count: 0 INFO exp: Finish it. INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks. INFO NodeHandler: INFO NodeHandler: Shutting down experiment, please wait... INFO NodeHandler: INFO run: Experiment default_slice-2013-06-25t15.36.33.467-04.00 finished after 2:6 username@console.grid:~# INFO 15:38:41.686 (main.cpp:366) - 105 sec timeout reached - closing connection INFO 15:38:41.686 (main.cpp:371) - TEAM 1 t=105000(ms) rx/tx bytes=9411840/12526560 success=75.1351% INFO 15:38:41.686 (main.cpp:371) - TEAM 2 t=105000(ms) rx/tx bytes=452160/7200000 success=6.28% username@console.grid:~# }}} * Turn the nodes off {{{ username@console.grid:~$ omf tell -a offh -t system:topo:all }}} NOTES: * Please note that actual Wildcard and Tournament games will be longer than 100 seconds. * As noted earlier, this example uses dsc-bot.ndz for both teams; if the teams want onto test their own designs, they need to load their image to one pair of nodes and adjust the script (if their script name/path is different from what the bot image is using).