├── docs ├── images │ ├── unreal_error.PNG │ ├── suite_vertical.png │ ├── suite_horizontal.png │ ├── end_to_end_simulation.pdf │ ├── end_to_end_simulation.png │ └── BP_PIP_depth_map_modification.PNG └── read_me │ ├── FAQs.md │ ├── profiling.md │ ├── running.md │ └── building.md ├── test_benches ├── scripts │ ├── trigger.exe │ ├── signal_char_to_move.py │ ├── data_clct_conf_class.py │ ├── control_unreal.py │ ├── trigger.cpp │ ├── manipulate_json.py │ ├── run_games.py │ ├── clct_data.py │ └── clct_data_diff_cores_freq.py └── configs │ ├── wcui_config_tx2.json │ ├── run_games_config.json │ ├── scaling_tx2.json │ ├── scaling_x86_upstairs.json │ ├── scaling_xavier.json │ ├── scaling_x86_downstairs.json │ ├── helloworld_config.json │ ├── scaling.json │ ├── wcui_config_desktop.json │ └── behzad_config.json ├── pre_requisits.bash ├── .gitmodules └── README.md /docs/images/unreal_error.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/unreal_error.PNG -------------------------------------------------------------------------------- /docs/images/suite_vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/suite_vertical.png -------------------------------------------------------------------------------- /docs/images/suite_horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/suite_horizontal.png -------------------------------------------------------------------------------- /test_benches/scripts/trigger.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/test_benches/scripts/trigger.exe -------------------------------------------------------------------------------- /docs/images/end_to_end_simulation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/end_to_end_simulation.pdf -------------------------------------------------------------------------------- /docs/images/end_to_end_simulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/end_to_end_simulation.png -------------------------------------------------------------------------------- /docs/images/BP_PIP_depth_map_modification.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-edge/MAVBench/HEAD/docs/images/BP_PIP_depth_map_modification.PNG -------------------------------------------------------------------------------- /pre_requisits.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt-get update &&\ 3 | apt-get install -y wget vim sudo unzip devscripts build-essential apt-utils ssh-client autoconf rsync 4 | 5 | -------------------------------------------------------------------------------- /test_benches/scripts/signal_char_to_move.py: -------------------------------------------------------------------------------- 1 | import os 2 | file_to_write_to = "C:\\Users\\Behzad\\Documents\\AirSim\\companion_comp_msgs.txt" 3 | 4 | try: 5 | os.remove(file_to_write_to) 6 | except: 7 | print "file not found" 8 | blah = raw_input("tell me when to terminate") 9 | open(file_to_write_to, "w").close() 10 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/darknet"] 2 | path = src/darknet 3 | url = https://github.com/pjreddie/darknet.git 4 | [submodule "src/AirSim"] 5 | path = src/AirSim 6 | url = https://github.com/hngenc/AirSim.git 7 | branch = future_darwing_dev 8 | [submodule "src/opencv"] 9 | path = src/opencv 10 | url = https://github.com/daveselinger/opencv 11 | branch = 3.1.0-with-cuda8 12 | [submodule "src/pcl"] 13 | path = src/pcl 14 | url = https://github.com/PointCloudLibrary/pcl.git 15 | [submodule "src/MAV_apps"] 16 | path = src/MAV_apps 17 | url = https://github.com/MAVBench/MAV_apps.git 18 | branch = refactor 19 | -------------------------------------------------------------------------------- /test_benches/scripts/data_clct_conf_class.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import sys 3 | import json 4 | 5 | class DataClctConf: 6 | def __init__(self, input_file_addr): 7 | self.input_file_addr = input_file_addr #input file to parse 8 | self.set_config_data(); 9 | 10 | def set_config_data(self): 11 | if not(os.path.isfile(self.input_file_addr)): 12 | print("file:" + self.input_file_addr+ " doesn't exist") 13 | sys.exit() 14 | with open(self.input_file_addr) as data_file: 15 | jstring = data_file.read().replace('nan', 'NaN') 16 | data = json.loads(jstring) 17 | self.config_data = data 18 | 19 | def get_config_data(self): 20 | return self.config_data; 21 | -------------------------------------------------------------------------------- /test_benches/configs/wcui_config_tx2.json: -------------------------------------------------------------------------------- 1 | { 2 | "user_setting":{ 3 | "game_path" : "C:\\Users\\Behzad\\Desktop\\Fo\\WindowsNoEditor\\Blocks.exe", 4 | "usr_name": "nvidia" , 5 | "pass_code": "nvidia", 6 | "host_to_cnct_to": "10.145.2.182", 7 | "catkin_dir": "/home/nvidia/catkin_ws", 8 | "mav_bench_dir" : "/home/nvidia/catkin_ws/src/mav-bench/", 9 | "stats_dir_on_host": "C:\\Users\\Behzad\\Documents\\AirSim", 10 | "stats_file_on_comp_computer": "stats.json" 11 | }, 12 | "experiment_setting_list": [ 13 | { 14 | "application": "mapping", 15 | "number_of_runs": 2, 16 | "max_run_time":9000 17 | 18 | } 19 | 20 | ] 21 | } 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test_benches/scripts/control_unreal.py: -------------------------------------------------------------------------------- 1 | import os 2 | from subprocess import call, Popen, PIPE 3 | 4 | def messages_dir(): 5 | return os.path.expanduser("~\Documents\AirSim"); 6 | 7 | def start_game(path, in_editor=False): 8 | if in_editor: 9 | print("Not impolemented yet") 10 | else: 11 | Popen(path, stdin=PIPE) 12 | def stop_game(): 13 | f = open(os.path.join(messages_dir(), "exit"), "w"); 14 | f.close() 15 | 16 | def change_level(level): 17 | path = os.path.join(messages_dir(), "change_level.txt") 18 | f = open(path, "w"); 19 | f.write(level) 20 | f.close() 21 | try: 22 | os.remove(os.path.join(messages_dir(), "change_level")) 23 | except OSError: 24 | pass 25 | os.rename(path, os.path.join(messages_dir(), "change_level")) 26 | 27 | def restart_level(): 28 | f = open(os.path.join(messages_dir(), "restart"), "w"); 29 | f.close() 30 | -------------------------------------------------------------------------------- /test_benches/configs/run_games_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "nvidia" , 4 | "pass_code": "nvidia", 5 | "host_ip": "10.243.49.241", 6 | "base_dir": "/home/nvidia/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.45, 22 | "mapping_resolution": 0.45 23 | }, 24 | "number_of_runs": 1, 25 | "max_run_time":200, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/scaling_tx2.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "nvidia" , 4 | "pass_code": "nvidia", 5 | "host_ip": "10.243.49.242", 6 | "base_dir": "/home/nvidia/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.15 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":300, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/scaling_x86_upstairs.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "wcui" , 4 | "pass_code": "111", 5 | "host_ip": "10.243.49.245", 6 | "base_dir": "/home/wcui/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.15 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":300, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/scaling_xavier.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "nvidia" , 4 | "pass_code": "nvidia", 5 | "host_ip": "10.243.49.175", 6 | "base_dir": "/home/nvidia/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.15 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":300, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/scaling_x86_downstairs.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "reddi-rtx" , 4 | "pass_code": "rur3dd1", 5 | "host_ip": "10.243.53.19", 6 | "base_dir": "/home/reddi-rtx/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.15 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":300, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/helloworld_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "nvidia" , 4 | "pass_code": "nvidia", 5 | "host_ip": "10.16.0.180", 6 | "base_dir": "/home/nvidia/tx2_new", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "scanning", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.1 23 | }, 24 | "number_of_runs": 1, 25 | "max_run_time":200, 26 | "processor_frequency":2035200, 27 | "map_name": "scanning_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test_benches/configs/scaling.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "wcui" , 4 | "pass_code": "111", 5 | "host_ip": "10.243.49.245", 6 | "base_dir": "/home/wcui/MAVBench_base", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "package_delivery", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.15 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":300, 26 | "processor_frequency":2035200, 27 | "map_name": "package_delivery_simple" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /docs/read_me/FAQs.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | ### host computer build: 3 | If uppon running host_root_setup.cmd (while in running in "Start x64 Native Tools Command Prompt for VS 2017" shell), you get the following error "The C compiler identification is unknown": 4 | - open up the aformentioned shell in admin mode (right click->Run as an Administrator) 5 | - Proceed to the folder that normaly loads when running "x64 Native Tools Command Prompt for VS 2017" asan user (e.g. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community). start from step 3 again 6 | Note: that if you want to run as a user, you need to give access to the Community folder (in admin mode) using "icacls "./Community" /grant $your_user_name:M /T) 7 | 8 | Uppon running Unreal, if you get the follow error: 9 | 10 | ![alt text](https://github.com/MAVBench/MAVBench/blob/master/docs/images/unreal_error.PNG) 11 | - right click the game solution from your solution explorer and select the option "Set as StartUp Project" and that should highlight the game solution. Cntrl-F5 will then work 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/read_me/profiling.md: -------------------------------------------------------------------------------- 1 | Various mission metrics such mission-time, energy, etc. and compute metrics such as various processes' throughput can be profiled using our toolset. This document descirbes steps toward this end. 2 | 3 | Open the Developer Command Prompt for VS 2017 4 | 1. Setting up environment variables. 5 | ```bash 6 | cd MAVBench_base_dir\build_scripts 7 | host_setup_env_var.cmd 8 | cd MAVBench_base_dir\1test_benches\configs 9 | ``` 10 | 2. Modify the json config file as you like to invoke the desired package, application and relevant parameters. 11 | ```bash 12 | cd MAVBench_base_dir\test_benches 13 | python scripts\clct_data.py --config configs\${your_config_file}; #example: python scripts\clct_data.py --config configs\helloworld_config.json 14 | ``` 15 | 16 | # Interpreting the Results 17 | The results will be saved in the data/$pkg_name in a jason file/format that is 18 | sef explanatory. 19 | 20 | Note: For follow the leader (you can trigger the person (leader) to start moving by pressing r. This time can also be set using 21 | the config file) 22 | 23 | 24 | -------------------------------------------------------------------------------- /test_benches/scripts/trigger.cpp: -------------------------------------------------------------------------------- 1 | // ConsoleApplication2.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | 4 | #include "pch.h" 5 | #include 6 | 7 | 8 | #define WINVER 0x0500 9 | #include 10 | 11 | int main() 12 | { 13 | // This structure will be used to create the keyboard 14 | // input event. 15 | INPUT ip; 16 | 17 | // Pause for 5 seconds. 18 | int time_to_trigger; 19 | std::cin >> time_to_trigger; 20 | Sleep(time_to_trigger*1000); 21 | 22 | // Set up a generic keyboard event. 23 | ip.type = INPUT_KEYBOARD; 24 | ip.ki.wScan = 0; // hardware scan code for key 25 | ip.ki.time = 0; 26 | ip.ki.dwExtraInfo = 0; 27 | 28 | // Press the "r" key 29 | ip.ki.wVk = 0x52; // virtual-key code for the "a" key 30 | ip.ki.dwFlags = 0; // 0 for key press 31 | SendInput(1, &ip, sizeof(INPUT)); 32 | Sleep(100); 33 | // Release the "r" key 34 | ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release 35 | SendInput(1, &ip, sizeof(INPUT)); 36 | 37 | // Exit normally 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /test_benches/configs/wcui_config_desktop.json: -------------------------------------------------------------------------------- 1 | { 2 | "user_setting":{ 3 | "game_path" : "C:\\Users\\Behzad\\Desktop\\Fo\\WindowsNoEditor\\Blocks.exe", 4 | "usr_name": "wcui" , 5 | "pass_code": "rur3dd1", 6 | "host_to_cnct_to": "10.157.90.62", 7 | "catkin_dir": "/home/wcui/catkin_ws", 8 | "mav_bench_dir" : "/home/wcui/catkin_ws/src/mav-bench/", 9 | "AirSim_dir": "C:\\Users\\Behzad\\Documents\\AirSim", 10 | "stats_file_on_comp_computer": "stats.json", 11 | "platform": "desktop" 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "mapping", 16 | "ros_params": { 17 | "sensor_max_range": 7, 18 | "nbvp/gain/range": 6.5, 19 | "nbvp/tree/extension_range": 6, 20 | "coverage_threshold": 85, 21 | "planning_resolution":0.15, 22 | "mapping_resolution": 0.1 23 | }, 24 | "number_of_runs": 10, 25 | "max_run_time":2700, 26 | "processor_frequency":2035200, 27 | "map_name": "mapping_high_featured" 28 | } 29 | ] 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /test_benches/configs/behzad_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "companion_setting":{ 3 | "usr_name": "nvidia" , 4 | "pass_code": "nvidia", 5 | "host_ip": "10.16.0.180", 6 | "base_dir": "/home/nvidia/tx2_new", 7 | "stats_file_on_comp_computer": "stats.json", 8 | "platform": "tx2" 9 | }, 10 | "host_setting":{ 11 | "in_editor":false 12 | }, 13 | "experiment_setting_list": [ 14 | { 15 | "application": "sar", 16 | "time_to_trigger_object": "25", 17 | "ros_params": { 18 | "sensor_max_range": 7, 19 | "nbvp/gain/range": 6.5, 20 | "nbvp/tree/extension_range": 6, 21 | "coverage_threshold": 85, 22 | "planning_resolution":0.05, 23 | "mapping_resolution": 0.1 24 | }, 25 | "number_of_runs": 1, 26 | "max_run_time":500, 27 | "processor_frequency":2035200, 28 | "map_name": "sar_simple" 29 | }, 30 | { 31 | "application": "package_delivery", 32 | "ros_params": { 33 | "sensor_max_range": 7, 34 | "nbvp/gain/range": 6.5, 35 | "nbvp/tree/extension_range": 6, 36 | "coverage_threshold": 85, 37 | "planning_resolution":0.15, 38 | "mapping_resolution": 0.1 39 | }, 40 | "number_of_runs": 1, 41 | "max_run_time":200, 42 | "processor_frequency":2035200, 43 | "map_name": "sar_simple" 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /test_benches/scripts/manipulate_json.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import sys 3 | from data_clct_conf_class import * 4 | #from scp import SCPClient 5 | #import paramiko 6 | import sys 7 | from shutil import copy 8 | import time 9 | import traceback 10 | import json 11 | 12 | #data_clct_conf_file_addr = "stats.json" 13 | def generate_csv(data_clct_conf_file_addr): 14 | data_clct_conf_obj = DataClctConf(data_clct_conf_file_addr) 15 | data = data_clct_conf_obj.get_config_data() 16 | """ 17 | if not 'experiments_0' in data: 18 | print 'Cannot find 1st experiment named experiments_0. Json file might be broken.' 19 | exit(0) 20 | 21 | if len(data.get('experiments_0')) <= 0: 22 | print 'experiments_0 does not have valid data. Json file might be broken.' 23 | exit(0) 24 | """ 25 | 26 | stat_keys = data.get(data.keys()[0])[0].keys() 27 | try: 28 | stat_keys.remove('topic_statistics') 29 | except: 30 | print "topic_stats" 31 | stat_keys.sort() 32 | fstring = '' 33 | fstring = fstring + ','.join(stat_keys) + '\n' 34 | print ','.join(stat_keys) 35 | 36 | for experiment_key in data: 37 | #print json.dumps(data.get(experiments)) 38 | experiments = data.get(experiment_key) 39 | for experiment in experiments: 40 | line = [] 41 | for k in stat_keys: 42 | if k in experiment: 43 | line.append(str(experiment[k])) 44 | else: 45 | line.append('NaN') 46 | print ','.join(line) 47 | fstring = fstring + ','.join(line) + '\n' 48 | print "---" 49 | pass 50 | 51 | #stat_file_addr = data_clct_conf_obj.get_config_data()["mav_bench_dir"] + "data/"+ data_clct_conf_obj.get_config_data()["application"]+ "/"+"stats.csv" 52 | stat_file_addr = "stats.csv" 53 | 54 | #--- dump the dictionary in a csv file 55 | with open(stat_file_addr, 'w') as file: 56 | file.write(fstring) 57 | return 58 | 59 | #combine the two jsons and write it into json1 60 | def combine_json(file_list): 61 | head = [] 62 | result = {} 63 | with open("result.json", "w") as outfile: 64 | for f in file_list: 65 | with open(f, 'rb') as infile: 66 | file_data = json.load(infile) 67 | head = head + (file_data.values()[0]) 68 | main_key = file_data.keys()[0] 69 | 70 | result[main_key] = head; 71 | json.dump(result, outfile) 72 | copy("result.json", file_list[0]) 73 | 74 | 75 | def main(): 76 | #copy first 77 | # combine_json(["../config/test_data.json", "../config/test_data2.json"]) 78 | generate_csv("./stats.json") 79 | #sys.exit(0) 80 | #copy back 81 | #remove all the temps 82 | 83 | if __name__ == "__main__": 84 | main() 85 | 86 | -------------------------------------------------------------------------------- /docs/read_me/running.md: -------------------------------------------------------------------------------- 1 | This document describes the steps necessary for running the MAVBench toolset. 2 | # Companion Computer 3 | 4 | ## Running It 5 | 1. Set the host_ip in companion_setup_env_var.sh to the host IP. 6 | 2. Source the relevant files. 7 | ```bash 8 | cd MAVBench_base; 9 | source build_scripts/companion_setup_env_var.sh; 10 | source catkin_ws/devel/setup.bash; 11 | ``` 12 | 3.Use roslaunch to interact with the individual applications: 13 | ```bash 14 | roslaunch $pkg_name $application.launch #example: roslaunch package_delivery scanning.launch; 15 | ``` 16 | Note that for the application to communicate with the game, the game needs to be running on the host computer (so follow the instruction on the host at this point to get the game running). 17 | 18 | 4.At this point, you can interact with the applications 19 | 4(alternative). you can use our pre-defined missions (encapsulating a set of initial interactions) to prime the drone for a specific goal. These pre-defined missions are provided for each application in a file called pre_mission_cmds.sh: 20 | ```bash 21 | #example: ./MAVbench_base/src/MAV_apps/pre_mission/package_delivery/pre_mission_cmds.sh | roslaunch package_delivery package_delivery.launch 22 | ./MAVbench_base/src/MAV_apps/pre_mission/$application_name/pre_mission_cmds.sh; | roslaunch $pkg_name $application.launch; 23 | ``` 24 | 25 | 26 | ### Running Notes: 27 | - If the user has manually built our ROS packages, they need to set all the variables in the companion_setup_env_var.sh accordingly. 28 | 29 | - Note (for internal developers): "c" needs to be pressed always after all the processes(nodes) are loaded, so e.g. if it takes a long time for the object detection to get loaded, pressing "c" needs to be postponed accordingly. 30 | 31 | # Host Computer 32 | 33 | ## Running it 34 | **For the lazy yet happy** (method 1): 35 | 36 | Open the Developer Command Prompt for VS 2017 37 | 1. Switch to the appropriate directory. 38 | ```bash 39 | cd MAVBench_base_dir\test_benches\configs 40 | ``` 41 | 2.Modify the json config file as you like to invoke the desired game for the application of interest. 42 | Note: you only need to set the map_name in the json file (we have provided 5 maps, 1 for each application. The names are ${application_name}_simple, so for example for package delivery set the map_name to package_delivery_simple). 43 | 44 | 3. start the game 45 | ```bash 46 | cd MAVBench_base_dir\test_benches; 47 | python scripts\run_games.py --config configs\${your_config_file} #example: python scripts\run_games.py --config configs\run_games_config.json 48 | ``` 49 | **For the reckless with no life** (method 2): 50 | Follow the instruction provided by Microsoft (https://github.com/Microsoft/AirSim/blob/master/docs/build_windows.md). Follow the **How to Use Airsim** Section. 51 | 52 | 53 | # Running Hello World 54 | You can run the hello world with: 55 | ```basH 56 | ./MAVbench_base/src/MAV_apps/control_drone/pre_mission_cmds.sh | roslaunch control_drone control_drone.launch. 57 | ``` 58 | while running, you shoud see the drone navigating a square around a warehouse, returning to initial coordinates and land. 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/read_me/building.md: -------------------------------------------------------------------------------- 1 | This document describes the steps necessary for building MAVBench toolset. 2 | Note: Please read until the end before setting up your system. 3 | Note: Please setup the companion computer before the host. 4 | 5 | [comment]:

6 | # Companion Computer 7 | 8 | This computer is responsible for running the compute intensive workloads. 9 | 10 | ## System Requirements 11 | **Hardware**: 12 | + Jetson TX2 13 | 14 | **Software**: 15 | + Ubuntu: 16.04 16 | + JetPack (Nvidia SDK): 3.2 (We have only tested our setup with 3.2 but we suspect, it'll work with higher versions as well) 17 | 18 | ## Building It 19 | The following steps, clone our repo and sub repos (AirSim, pointcloud, ...) and build them all; 20 | ```bash 21 | git clone --recursive https://github.com/harvard-edge/MAVBench.git MAVBench_base; 22 | cd MAVBench_base; 23 | source build_scripts/companion_setup_env_var.sh; 24 | sudo ./build_scripts/companion_root_setup.bash; 25 | ./build_scripts/companion_usr_setup.bash; 26 | ``` 27 | 28 | ### Build Notes : 29 | - If the user wants to manually build some of our ROS (robotic operating system) packages using catkin, they need to make sure to source setup_var_env.sh first. 30 | 31 | # Host Computer 32 | This computer is responsible for running the drone/environment simulators + autopilot subsystem). 33 | 34 | ## System Requirements 35 | **Hardware**: 36 | + A system with powerful CPU + GPU (Our tested setup uses an Intel Core i7 CPU and a high-end NVIDIA GTX 1080 Ti GPU). 37 | 38 | **Software**: 39 | + Windows 10, 64 bit (at this moment, we only support windows for the host) 40 | + Python 2 (also make sure pip is installed) 41 | + Visual Studio (optional: only if you want to build from scratch) (tested with visual studio 15.8, 2017 community edition) 42 | + Unreal (optional: only if you want to build from scratch) ( tested with 4.18) 43 | 44 | 45 | ## Building It. 46 | open Developer Command Prompt for VS 2017 47 | 1. Clone our repository 48 | ``` bash 49 | git clone --recursive https://github.com/harvard-edge/MAVBench.git MAVBench_base 50 | ``` 51 | **For the lazy yet happy**: We have provided a set of games (environments drone can fly within) that can be simply executed by the user. To do so: 52 | 2. Install some required python libraries; download our games; 53 | ```bash 54 | cd MAVBench_base/build_scripts 55 | host_setup_env_var.cmd 56 | host_root_setup.cmd 57 | ``` 58 | **For the reckless with no life** (most likely you won't fall within this group): 59 | 2. Install some required python libraries and build airsim 60 | ```bash 61 | mkdir MAVBench_base; 62 | cd MAVBench_base/build_scripts; 63 | host_setup_env_var.cmd; 64 | host_root_setup_from_src.cmd; 65 | ``` 66 | At this point, you should have a ready to use plugin in MAVBench_base/src/AirSim/Unreal/Plugins folder that can be dropped into any Unreal project. Follow along with the AirSim instructions provided by Microsoft https://github.com/Microsoft/AirSim/blob/master/docs/build_windows.md) to do so. 67 | 68 | ### Build Notes : 69 | for internal developers: 70 | If you decided to make your own executable and upload to google drive, use windows to zip and windows to unzip (you can use tar in windows now). I had issues with using tar for unziping. The generated executable was erroring out.A folder with the name of game/WindowsNoEditor need to be zipped to the google cloud. 71 | 72 | ### Fixing AirSim's Depth Map Issue 73 | Fix a Depth image bug by following this issue: https://github.com/Microsoft/AirSim/issues/491. 74 | 1. Press "Play" 75 | 2. Press F8 and click on the drone 76 | 3. Under the "World Outliner" tab: select "BP_PIPCamera". Right click "BP_PIPCamera" and select "Edit BP_PIPCamera", then the BP_PIPCamera editor opens up. 77 | 4. In BP_PIPCamera editor, click on DepthPlannerCaptureComponent (on the left hand side under "Components" tab). Then in the "Details" window, click on “post process Materials” and change the material to “DepthMapMaterial” 78 | (If you don't have the "Component Tab", select "Window" and check mark the "Component"). 79 | 80 | ![alt text](https://github.com/MAVBench/MAVBench/blob/master/docs/images/BP_PIP_depth_map_modification.PNG) 81 | 82 | 83 | 84 | ## Building Games (mainly for internal developers): 85 | Steps to create, upload and deploy games: (for internal developers): 86 | 1. Make a game in unreal. 87 | 2. Package it. 88 | 3. Zip it (I usually right "click->send to->compressed" (zipped) folder. I believe 7zip should work too, but further investigation is required). 89 | 4. Uploaded it to the google drive. 90 | 5. Get a shareable link and paste the id (what's after "id" in the shared link before the next "/") to host_setup_env_var.sh game_fileid variable. 91 | 92 | 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to MAVBench 2 | This README explains how to setup and use MAVBench, A benchmark and a simulator for Micro Aerial Vehicles. 3 | 4 | 5 | **What is MAVBench?** 6 | MAVBench is a framework targeting design and development of Micro Aerial Vehicles for hardware/software designers and roboticists. It consists of a closed-loop simulator and an end-to-end application 7 | benchmark suite. A closed-loop simulation platform is needed to probe and understand the intra-system (application data flow) and inter-system (system and environment) interactions in MAV applications 8 | to pinpoint bottlenecks and identify opportunities for hardware and software co-design and optimization. In addition to the simulator, MAVBench provides a benchmark suite, the first of its kind, 9 | consisting of a variety of MAV applications designed to enable computer architects to perform characterization and develop future aerial computing systems. This work is built on top of a host of open source software. 10 | A big shout out to Microsoft and ETH Zurich University. 11 | 12 | **Why MAVBench?** 13 | We developed MAVBench to accurately model the drone's system and its environment. We identify two main ingredients toward this end. 14 | 15 | 16 | 1. Simulator: Autonomous drones similar to other autonomous machines require a new breed of architectural simulators. Unlike traditional machines (desktops, servers, cellphones and others), information flows in a loop for an autonomous machine . Such flow starts from the machine's environment via sensors, gets processed by the computing subsystem, and flows back out into the environment via actuators. 17 | This means, unlike traditional simulators, autonomous machines require a tightly coupled closed-loop feedback simulator for architectural investigation. 18 | Our simulator has three core components as shown in the figure bellow. The drone's environments, sensors, and actuators are simulated using a game engine called Unreal augmented with AirSim libraries (top). By using a physics engine, they provide the ability to simulate the drone's behavior, its environment and the interaction between the two such as accurate collision detection. 19 | Flight controller (flight stack and the autopilot hardware) is responsible for the drone's stabilization (bottom right). We use a software-simulated flight controller provided by AirSim. However, AirSim also supports other flight controllers, such as the Pixhawk. Much of the drone's perception and trajectory planning is done using an onboard computer, which is generally 20 | responsible for running any compute-intensive workloads (bottom left). 21 | We used an NVIDIA Jetson TX2, although our setup allows for swapping this embedded board with other platforms like a RISC-V based platform. 22 | 23 | 24 | 25 | 2. Benchmark Suite: To quantify the power and performance demands of typical MAV applications, we created a set of workloads that we compiled into a benchmark suite. Our benchmarks run on top of our closed-loop simulation environment. The suite aims to cover a wide range of representative applications. Each workload is an end-to-end application that allows us to study the kernels' impact on the whole application as well as to investigate the interactions and dependencies between kernel. 26 | By providing holistic end-to-end applications instead of only focusing on individual kernels, MAVBench allows for the examination of kernels' impacts and their optimization at the application level. This is a lesson learned from Amdahl's law, which recognizes that the true impact of a component's improvement needs to be evaluated globally rather than locally. 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | ## Youtube Channel 36 | [Please visit our youtube channel.](https://www.youtube.com/channel/UC_bNkXcP5BHSRcNJ4R4GTvg) 37 | 38 | 39 | ## Building 40 | [Instructions to build MAVBench.](https://github.com/MAVBench/MAVBench/blob/master/docs/read_me/building.md) 41 | 42 | 43 | ## Running 44 | [Instruction to run MAVBench.](https://github.com/MAVBench/MAVBench/blob/master/docs/read_me/running.md) 45 | 46 | ## Profiling 47 | [Instruction to profile and interpret the results.](https://github.com/MAVBench/MAVBench/blob/master/docs/read_me/building.md) 48 | 49 | ## Directory Structure 50 | ```bash 51 | . 52 | ├── build_scripts # Scripts for building our repo and subrepos 53 | ├── docs # Documents 54 | │   ├── images 55 | │   └── read_me 56 | ├── src # All the src code 57 | │   ├── AirSim 58 | │   ├── darknet 59 | │   ├── mav-bench-apps 60 | │   ├── opencv 61 | │   └── pcl 62 | └── test_benches # Test benches allowing the user to 1.use pre-defined missions 63 | # 2. profile 64 | ├── configs # Pre-defined missions (you can change this according to your 65 | need) 66 | └── scripts # Scripts to load test benches and profile 67 | ``` 68 | 69 | ## Paper 70 | More technical details are available in our paper published in Micro 2018.(https://d.pr/f/fqspYT); 71 | 72 | ## Contribute 73 | MAVBench aims at brining the robotics, software and hardware community together. We welcome any contributions such as new sensor/actuator models, new kernels/applications and new hardware setups. 74 | 75 | ## Contributors 76 | Behzad Boroujerdian (UT Austin, Harvard, SiFive) 77 | Hassan Genc (UC Berkeley) 78 | Srivatsan Krishnan (Harvard) 79 | Wenzhi Cui (Google) 80 | Marcelino Almeida (UT Austin) 81 | kayvan Mansoorshahi (UT Austin) 82 | Aleksandra Faust (Google Brain) 83 | Vijay Janapa Reddi (UT Austin, Harvard, Google) 84 | 85 | 86 | ## Current Maintainers 87 | behzadboro@gmail.com 88 | hngenc@berkeley.edu 89 | 90 | ## FAQ 91 | -------------------------------------------------------------------------------- /test_benches/scripts/run_games.py: -------------------------------------------------------------------------------- 1 | #import spur 2 | import os 3 | #import win32gui, win32con 4 | import time 5 | from os import sys 6 | from data_clct_conf_class import * 7 | from control_unreal import * 8 | import traceback 9 | import signal 10 | #from scp import SCPClient 11 | import paramiko 12 | import sys 13 | from shutil import copy 14 | import time 15 | from multiprocessing import Process 16 | import signal 17 | import sys 18 | 19 | import argparse 20 | 21 | def get_host_base(): 22 | file_path=sys.argv[0] 23 | file_dir=os.path.dirname(file_path) 24 | file_dir_abs_path = os.path.abspath(file_dir+"\\..\\..\\") 25 | return file_dir_abs_path 26 | 27 | 28 | parser = argparse.ArgumentParser(description='DARwing collect data.') 29 | parser.add_argument('--config', metavar='c', type=str, 30 | default=get_host_base()+"\test_benches\configs\hello-world-config.json", 31 | help='config json file path') 32 | 33 | args = parser.parse_args() 34 | data_clct_conf_file_addr = args.config 35 | data_clct_conf_obj = DataClctConf(data_clct_conf_file_addr) #parse config file and instantiate a 36 | companion_setting = data_clct_conf_obj.get_config_data()["companion_setting"] 37 | host_setting = data_clct_conf_obj.get_config_data()["host_setting"] 38 | 39 | mavbench_apps_base_dir = companion_setting["base_dir"]+"/catkin_ws/src/MAV_apps" 40 | 41 | 42 | def creat_ssh_client(companion_setting, host_base_dir): 43 | 44 | # paramiko 45 | ssh_client=paramiko.SSHClient() 46 | ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 47 | 48 | ssh_client.connect(companion_setting["host_ip"], 49 | 22, 50 | companion_setting["usr_name"], 51 | companion_setting["pass_code"]) 52 | return ssh_client 53 | 54 | def start_unreal(host_setting, host_base_dir): 55 | if host_setting["in_editor"]: 56 | return 57 | else: 58 | game_path = host_base_dir + "\\test_benches\\games\\WindowsNoEditor\\Blocks.exe" 59 | if not(os.path.isfile(game_path)): 60 | print("file:" + game_path + " doesn't exist") 61 | sys.exit() 62 | 63 | start_game(game_path); 64 | return 65 | 66 | 67 | def get_ros_cmd(experiment_setting): 68 | application = experiment_setting["application"] 69 | ros_params = experiment_setting["ros_params"] 70 | args = "" 71 | for key in ros_params.keys(): 72 | args += " " + str(key) + ":=" + str(ros_params[key]) 73 | if (application == "package_delivery"): 74 | return "roslaunch package_delivery package_delivery.launch" + args 75 | #return "roslaunch package_delivery y.launch" 76 | elif (application == "scanning"): 77 | return "roslaunch package_delivery scanning.launch" + args 78 | elif (application == "mapping"): 79 | return "roslaunch mapping_and_sar mapping.launch" + args 80 | elif (application == "sar"): 81 | return "roslaunch mapping_and_sar sar.launch" + args 82 | elif (application == "follow_the_leader"): 83 | return "roslaunch follow_the_leader follow_the_leader.launch" + args 84 | else: 85 | print("this application not defined") 86 | sys.exit() 87 | 88 | def get_supervisor_cmd(companion_setting, experiment_setting): 89 | termination = experiment_setting["max_run_time"] 90 | app = experiment_setting["application"] 91 | return "python "+\ 92 | mavbench_apps_base_dir+"/run_time/supervisor.py" +\ 93 | " " + mavbench_apps_base_dir +\ 94 | " " + app +\ 95 | " " + str(termination) 96 | 97 | 98 | def get_pre_mission_cmd(application): 99 | return mavbench_apps_base_dir+"/pre_mission/"+application+"/pre_mission_cmds.sh" 100 | 101 | 102 | 103 | def signal_start_moving(file_to_write_to): 104 | time.sleep(30) 105 | open(file_to_write_to, "w").close() 106 | 107 | def get_bind_node_cmd(platform): 108 | if (platform == "tx2"): 109 | return "python " + mavbench_apps_base_dir+"/run_time/bind_nodes.py" 110 | else: 111 | return "echo platform not supported" 112 | 113 | 114 | def trigger_obj_motion(host_base_dir, experiment_setting): 115 | trigger_exe_path = host_base_dir + "\\test_benches\\scripts\\trigger.exe" 116 | p = Popen(trigger_exe_path, stdin=PIPE) 117 | p.stdin.write(experiment_setting["time_to_trigger_object"]) 118 | #p.communicate()[0] 119 | time.sleep(.4) 120 | p.stdin.close() 121 | 122 | def schedule_tasks(companion_setting, experiment_setting, ssh_client, host_base_dir): 123 | if (experiment_setting["application"] == "follow_the_leader"): 124 | trigger_obj_motion(host_base_dir, experiment_setting) 125 | #--- cmds to schedul e 126 | src_ros_cmd = "source " + companion_setting["base_dir"] + "/catkin_ws/devel/setup.sh" 127 | src_companion_setup= "source " + companion_setting['base_dir'] + "/build_scripts/companion_setup_env_var.sh" 128 | ros_launch_cmd = get_ros_cmd(experiment_setting) 129 | run_time_supervisor_cmd = get_supervisor_cmd(companion_setting, experiment_setting) 130 | #run_time_supervisor_cmd = ""#get_supervisor_cmd(companion_setting, experiment_setting) 131 | pre_mission_cmds = get_pre_mission_cmd(experiment_setting["application"]) 132 | platform = companion_setting["platform"] 133 | all_cmds = src_ros_cmd + ";" + src_companion_setup + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd + "|" + get_bind_node_cmd(platform) 134 | #all_cmds = src_ros_cmd + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd 135 | 136 | 137 | #--- pramiko 138 | stdin,stdout,stderr= ssh_client.exec_command(all_cmds, get_pty=True) 139 | outlines = stdout.readlines() 140 | result=''.join(outlines) 141 | 142 | #if (experiment_setting["application"] == "follow_the_leader"): 143 | # p.join() 144 | # errlines = stderr.readlines() 145 | # resp_err=''.join(errlines) 146 | # print(resp_err) 147 | return result 148 | """ 149 | def copy_results_over(data_clct_conf_obj, ssh_client): 150 | mavbench_apps_base_dir = data_clct_conf_obj.get_config_data()["mav_bench_dir"] 151 | application = data_clct_conf_obj.get_config_data()["application"] 152 | stats_file_name_on_comp_computer = data_clct_conf_obj.get_config_data()["stats_file_on_comp_computer"] 153 | stats_dir_on_host = data_clct_conf_obj.get_config_data()["stats_dir_on_host"] 154 | data_addr = mavbench_apps_base_dir +"/data/"+application+"/" + stats_file_name_on_comp_computer 155 | 156 | scp_client = SCPClient(ssh_client.get_transport()) 157 | scp_client.get(data_addr) 158 | copy(stats_file_name_on_comp_computer, stats_dir_on_host); 159 | """ 160 | 161 | def restart_unreal(): 162 | restart_level(); 163 | 164 | def stop_unreal(): 165 | stop_game(); 166 | 167 | def parse_results(result): 168 | return 169 | 170 | def minimize_the_window(): 171 | time.sleep(5); 172 | Minimize = win32gui.GetForegroundWindow() 173 | win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE) 174 | 175 | """ 176 | def signal_handler(signal, frame): 177 | print('You pressed Ctrl+C!') 178 | restart_unreal() 179 | stop_unreal() 180 | sys.exit(0) 181 | """ 182 | 183 | def write_to_stats_file(stat_file_addr, string_to_write, companion_setting, ssh_client): 184 | python_file_to_run = mavbench_apps_base_dir + "/common/python_files/write_to_file.py" 185 | cmd = "python" + " " + python_file_to_run + " " + stat_file_addr + " " + string_to_write 186 | stdin,stdout,stderr= ssh_client.exec_command(cmd, get_pty=True) 187 | outlines = stdout.readlines() 188 | result=''.join(outlines) 189 | print(result) 190 | # errlines = stderr.readlines() 191 | # resp_err=''.join(errlines) 192 | # print(resp_err) 193 | return result 194 | 195 | 196 | def mk_data_dir(ssh_client): 197 | cmd = "cd "+mavbench_apps_base_dir + ";" + "mkdir -p data/package_delivery data/scanning data/mapping data/sar data/follow_the_leader" 198 | stdin,stdout,stderr= ssh_client.exec_command(cmd, get_pty=True) 199 | outlines = stdout.readlines() 200 | result=''.join(outlines) 201 | print(result) 202 | # errlines = stderr.readlines() 203 | # resp_err=''.join(errlines) 204 | # print(resp_err) 205 | print result 206 | return result 207 | 208 | 209 | def modify_freq(freq, ssh_client): 210 | print freq 211 | stdin,stdout,stderr= ssh_client.exec_command("echo nvidia | sudo -S python "+ mavbench_apps_base_dir+"/misc/set_freq_for_all.py " + str(freq), get_pty=True) #we need the following two statement to make it block, otherwise it won;t # have an effect for some reason 212 | outlines = stdout.readlines() 213 | result=''.join(outlines) 214 | print(result) 215 | 216 | 217 | def signal_handler(sig, frame): 218 | restart_unreal(); 219 | sys.exit(0) 220 | 221 | 222 | def main(): 223 | signal.signal(signal.SIGINT, signal_handler) 224 | host_base_dir= get_host_base(); 225 | try: 226 | #companion_setting = data_clct_conf_obj.get_config_data()["companion_setting"] 227 | experiment_setting_list = data_clct_conf_obj.get_config_data()["experiment_setting_list"] 228 | time.sleep(3) #there needs to be a sleep between restart and change_level 229 | start_unreal(host_setting, host_base_dir) 230 | time.sleep(7) #there needs to be a sleep between restart and change_level 231 | experiment_setting = experiment_setting_list[0] 232 | application = experiment_setting["application"] 233 | #ros_params = experiment_setting["ros_params"] 234 | #stat_file_addr = mavbench_apps_base_dir+"/data/"+application+ "/"+"stats.json" 235 | if ("map_name" in experiment_setting.keys()): 236 | change_level(experiment_setting["map_name"]) 237 | else: 238 | restart_unreal() 239 | except Exception as e: 240 | pass 241 | print(traceback.format_exception(*sys.exc_info())) 242 | 243 | while(1): 244 | print("hello") 245 | time.sleep(3) #there needs to be a sleep between restart and change_level 246 | 247 | if __name__ == "__main__": 248 | main() 249 | -------------------------------------------------------------------------------- /test_benches/scripts/clct_data.py: -------------------------------------------------------------------------------- 1 | #import spur 2 | import os 3 | #import win32gui, win32con 4 | import time 5 | from os import sys 6 | from data_clct_conf_class import * 7 | from control_unreal import * 8 | import traceback 9 | import signal 10 | #from scp import SCPClient 11 | import paramiko 12 | import sys 13 | from shutil import copy 14 | import time 15 | from multiprocessing import Process 16 | 17 | import argparse 18 | 19 | def get_host_base(): 20 | file_path=sys.argv[0] 21 | file_dir=os.path.dirname(file_path) 22 | file_dir_abs_path = os.path.abspath(file_dir+"\\..\\..\\") 23 | return file_dir_abs_path 24 | 25 | 26 | parser = argparse.ArgumentParser(description='DARwing collect data.') 27 | parser.add_argument('--config', metavar='c', type=str, 28 | default=get_host_base()+"\test_benches\configs\hello-world-config.json", 29 | help='config json file path') 30 | 31 | args = parser.parse_args() 32 | data_clct_conf_file_addr = args.config 33 | data_clct_conf_obj = DataClctConf(data_clct_conf_file_addr) #parse config file and instantiate a 34 | companion_setting = data_clct_conf_obj.get_config_data()["companion_setting"] 35 | host_setting = data_clct_conf_obj.get_config_data()["host_setting"] 36 | 37 | mavbench_apps_base_dir = companion_setting["base_dir"]+"/catkin_ws/src/MAV_apps" 38 | 39 | 40 | def creat_ssh_client(companion_setting, host_base_dir): 41 | 42 | # paramiko 43 | ssh_client=paramiko.SSHClient() 44 | ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 45 | 46 | ssh_client.connect(companion_setting["host_ip"], 47 | 22, 48 | companion_setting["usr_name"], 49 | companion_setting["pass_code"]) 50 | return ssh_client 51 | 52 | def start_unreal(host_setting, host_base_dir): 53 | if host_setting["in_editor"]: 54 | return 55 | else: 56 | game_path = host_base_dir + "\\test_benches\\games\\WindowsNoEditor\\Blocks.exe" 57 | if not(os.path.isfile(game_path)): 58 | print("file:" + game_path + " doesn't exist") 59 | sys.exit() 60 | 61 | start_game(game_path); 62 | return 63 | 64 | 65 | def get_ros_cmd(experiment_setting): 66 | application = experiment_setting["application"] 67 | ros_params = experiment_setting["ros_params"] 68 | args = "" 69 | for key in ros_params.keys(): 70 | args += " " + str(key) + ":=" + str(ros_params[key]) 71 | if (application == "package_delivery"): 72 | return "roslaunch package_delivery package_delivery.launch" + args 73 | #return "roslaunch package_delivery y.launch" 74 | elif (application == "scanning"): 75 | return "roslaunch package_delivery scanning.launch" + args 76 | elif (application == "mapping"): 77 | return "roslaunch mapping_and_sar mapping.launch" + args 78 | elif (application == "sar"): 79 | return "roslaunch mapping_and_sar sar.launch" + args 80 | elif (application == "follow_the_leader"): 81 | return "roslaunch follow_the_leader follow_the_leader.launch" + args 82 | else: 83 | print("this application not defined") 84 | sys.exit() 85 | 86 | def get_supervisor_cmd(companion_setting, experiment_setting): 87 | termination = experiment_setting["max_run_time"] 88 | app = experiment_setting["application"] 89 | return "python "+\ 90 | mavbench_apps_base_dir+"/run_time/supervisor.py" +\ 91 | " " + mavbench_apps_base_dir +\ 92 | " " + app +\ 93 | " " + str(termination) 94 | 95 | 96 | def get_pre_mission_cmd(application): 97 | return mavbench_apps_base_dir+"/pre_mission/"+application+"/pre_mission_cmds.sh" 98 | 99 | 100 | 101 | def signal_start_moving(file_to_write_to): 102 | time.sleep(30) 103 | open(file_to_write_to, "w").close() 104 | 105 | def get_bind_node_cmd(platform): 106 | if (platform == "tx2"): 107 | return "python " + mavbench_apps_base_dir+"/run_time/bind_nodes.py" 108 | else: 109 | return "echo platform not supported" 110 | 111 | 112 | def trigger_obj_motion(host_base_dir, experiment_setting): 113 | trigger_exe_path = host_base_dir + "\\test_benches\\scripts\\trigger.exe" 114 | p = Popen(trigger_exe_path, stdin=PIPE) 115 | p.stdin.write(experiment_setting["time_to_trigger_object"]) 116 | #p.communicate()[0] 117 | time.sleep(.4) 118 | p.stdin.close() 119 | 120 | def schedule_tasks(companion_setting, experiment_setting, ssh_client, host_base_dir): 121 | if (experiment_setting["application"] == "follow_the_leader"): 122 | trigger_obj_motion(host_base_dir, experiment_setting) 123 | #--- cmds to schedul e 124 | src_ros_cmd = "source " + companion_setting["base_dir"] + "/catkin_ws/devel/setup.sh" 125 | src_companion_setup= "source " + companion_setting['base_dir'] + "/build_scripts/companion_setup_env_var.sh" 126 | ros_launch_cmd = get_ros_cmd(experiment_setting) 127 | run_time_supervisor_cmd = get_supervisor_cmd(companion_setting, experiment_setting) 128 | #run_time_supervisor_cmd = ""#get_supervisor_cmd(companion_setting, experiment_setting) 129 | pre_mission_cmds = get_pre_mission_cmd(experiment_setting["application"]) 130 | platform = companion_setting["platform"] 131 | all_cmds = src_ros_cmd + ";" + src_companion_setup + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd + "|" + get_bind_node_cmd(platform) 132 | #all_cmds = src_ros_cmd + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd 133 | 134 | 135 | #--- pramiko 136 | stdin,stdout,stderr= ssh_client.exec_command(all_cmds, get_pty=True) 137 | outlines = stdout.readlines() 138 | result=''.join(outlines) 139 | 140 | #if (experiment_setting["application"] == "follow_the_leader"): 141 | # p.join() 142 | # errlines = stderr.readlines() 143 | # resp_err=''.join(errlines) 144 | # print(resp_err) 145 | return result 146 | """ 147 | def copy_results_over(data_clct_conf_obj, ssh_client): 148 | mavbench_apps_base_dir = data_clct_conf_obj.get_config_data()["mav_bench_dir"] 149 | application = data_clct_conf_obj.get_config_data()["application"] 150 | stats_file_name_on_comp_computer = data_clct_conf_obj.get_config_data()["stats_file_on_comp_computer"] 151 | stats_dir_on_host = data_clct_conf_obj.get_config_data()["stats_dir_on_host"] 152 | data_addr = mavbench_apps_base_dir +"/data/"+application+"/" + stats_file_name_on_comp_computer 153 | 154 | scp_client = SCPClient(ssh_client.get_transport()) 155 | scp_client.get(data_addr) 156 | copy(stats_file_name_on_comp_computer, stats_dir_on_host); 157 | """ 158 | 159 | def restart_unreal(): 160 | restart_level(); 161 | 162 | def stop_unreal(): 163 | stop_game(); 164 | 165 | def parse_results(result): 166 | return 167 | 168 | def minimize_the_window(): 169 | time.sleep(5); 170 | Minimize = win32gui.GetForegroundWindow() 171 | win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE) 172 | 173 | def signal_handler(signal, frame): 174 | print('You pressed Ctrl+C!') 175 | stop_unreal() 176 | sys.exit(0) 177 | 178 | def write_to_stats_file(stat_file_addr, string_to_write, companion_setting, ssh_client): 179 | python_file_to_run = mavbench_apps_base_dir + "/common/python_files/write_to_file.py" 180 | cmd = "python" + " " + python_file_to_run + " " + stat_file_addr + " " + string_to_write 181 | stdin,stdout,stderr= ssh_client.exec_command(cmd, get_pty=True) 182 | outlines = stdout.readlines() 183 | result=''.join(outlines) 184 | print(result) 185 | # errlines = stderr.readlines() 186 | # resp_err=''.join(errlines) 187 | # print(resp_err) 188 | return result 189 | 190 | 191 | def mk_data_dir(ssh_client): 192 | cmd = "cd "+mavbench_apps_base_dir + ";" + "mkdir -p data/package_delivery data/scanning data/mapping data/sar data/follow_the_leader" 193 | stdin,stdout,stderr= ssh_client.exec_command(cmd, get_pty=True) 194 | outlines = stdout.readlines() 195 | result=''.join(outlines) 196 | print(result) 197 | # errlines = stderr.readlines() 198 | # resp_err=''.join(errlines) 199 | # print(resp_err) 200 | print result 201 | return result 202 | 203 | 204 | def modify_freq(freq, ssh_client): 205 | print freq 206 | stdin,stdout,stderr= ssh_client.exec_command("echo nvidia | sudo -S python "+ mavbench_apps_base_dir+"/misc/set_freq_for_all.py " + str(freq), get_pty=True) #we need the following two statement to make it block, otherwise it won;t # have an effect for some reason 207 | outlines = stdout.readlines() 208 | result=''.join(outlines) 209 | print(result) 210 | 211 | 212 | 213 | 214 | 215 | def main(): 216 | host_base_dir= get_host_base(); 217 | try: 218 | #companion_setting = data_clct_conf_obj.get_config_data()["companion_setting"] 219 | experiment_setting_list = data_clct_conf_obj.get_config_data()["experiment_setting_list"] 220 | total_run_ctr = 0 221 | experiment_set_ctr = 0 222 | #write_to_stats_file(stat_file_addr, "{", companion_setting, ssh_client) 223 | #--- removing the file that triggers the char (only usefull for follow_the_leader) 224 | """ 225 | try: 226 | os.remove(companion_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt") 227 | except: 228 | print "companion_com_msg doesn't exist to remove. This might be ok" 229 | """ 230 | time.sleep(3) #there needs to be a sleep between restart and change_level 231 | 232 | start_unreal(host_setting, host_base_dir) 233 | time.sleep(7) #there needs to be a sleep between restart and change_level 234 | for experiment_setting in experiment_setting_list: 235 | num_of_runs = experiment_setting["number_of_runs"] 236 | application = experiment_setting["application"] 237 | ros_params = experiment_setting["ros_params"] 238 | proc_freq = experiment_setting["processor_frequency"] 239 | stat_file_addr = mavbench_apps_base_dir+"/data/"+application+ "/"+"stats.json" 240 | if ("map_name" in experiment_setting.keys()): 241 | change_level(experiment_setting["map_name"]) 242 | else: 243 | restart_unreal() 244 | ssh_client = creat_ssh_client(companion_setting, host_base_dir) 245 | mk_data_dir(ssh_client) 246 | modify_freq(proc_freq, ssh_client) 247 | 248 | #--- preparting the result file 249 | write_to_stats_file(stat_file_addr, '\t\\"experiment_set_'+ str(experiment_set_ctr) +'\\":', companion_setting, ssh_client) 250 | write_to_stats_file(stat_file_addr, '[', companion_setting, ssh_client) 251 | experiment_set_ctr +=1 252 | #minimize_the_window() 253 | #--- start collecting data 254 | for experiment_run_ctr in range(0, num_of_runs): 255 | 256 | total_run_ctr += 1 257 | result = schedule_tasks(companion_setting, experiment_setting, ssh_client, host_base_dir) 258 | print(result) 259 | restart_unreal() 260 | time.sleep(7) #there needs to be a sleep between restart and change_level 261 | write_to_stats_file(stat_file_addr, '\t'+'\\"app\\":\\"'+str(application)+'\\",', companion_setting, ssh_client) 262 | write_to_stats_file(stat_file_addr, '\t'+'\\"processor_freq\\":\\"'+str(proc_freq)+'\\",', companion_setting, ssh_client) 263 | for param in ros_params.keys(): 264 | write_to_stats_file(stat_file_addr, '\t\\"'+param + '\\":\\"'+str(ros_params[param])+'\\",', companion_setting, ssh_client) 265 | 266 | write_to_stats_file(stat_file_addr, '\t\\"experiment_number\\":'+str(total_run_ctr), companion_setting, ssh_client) 267 | if (experiment_run_ctr < num_of_runs - 1): 268 | write_to_stats_file(stat_file_addr, "},", companion_setting, ssh_client) 269 | #restart_unreal() 270 | 271 | write_to_stats_file(stat_file_addr, "}],", companion_setting, ssh_client) 272 | 273 | #write_to_stats_file(stat_file_addr, '\\"experiment_number\\":'+str(experiment_run_ctr)+"}", companion_setting, ssh_client) 274 | #write_to_stats_file(stat_file_addr, "]}", companion_setting, ssh_client) 275 | 276 | stop_unreal() 277 | except Exception as e: 278 | pass 279 | print(traceback.format_exception(*sys.exc_info())) 280 | 281 | if __name__ == "__main__": 282 | main() 283 | -------------------------------------------------------------------------------- /test_benches/scripts/clct_data_diff_cores_freq.py: -------------------------------------------------------------------------------- 1 | #import spur 2 | import os 3 | #import win32gui, win32con 4 | import time 5 | from os import sys 6 | from data_clct_conf_class import * 7 | from control_unreal import * 8 | import traceback 9 | import signal 10 | from scp import SCPClient 11 | import paramiko 12 | import sys 13 | from shutil import copy 14 | import time 15 | from multiprocessing import Process 16 | 17 | import argparse 18 | parser = argparse.ArgumentParser(description='DARwing collect data.') 19 | parser.add_argument('--config', metavar='c', type=str, 20 | default="..\config\data_clct_conf.json", 21 | help='config json file path') 22 | 23 | args = parser.parse_args() 24 | data_clct_conf_file_addr = args.config 25 | 26 | 27 | def creat_ssh_client(user_setting): 28 | 29 | # paramiko 30 | ssh_client=paramiko.SSHClient() 31 | ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 32 | 33 | ssh_client.connect(user_setting["host_to_cnct_to"], 34 | 22, 35 | user_setting["usr_name"], 36 | user_setting["pass_code"]) 37 | return ssh_client 38 | 39 | def start_unreal(user_setting): 40 | game_path = user_setting["game_path"] 41 | if not(os.path.isfile(game_path)): 42 | print("file:" + game_path + " doesn't exist") 43 | sys.exit() 44 | 45 | start_game(game_path); 46 | return 47 | 48 | 49 | def get_ros_cmd(experiment_setting): 50 | application = experiment_setting["application"] 51 | ros_params = experiment_setting["ros_params"] 52 | args = "" 53 | for key in ros_params.keys(): 54 | args += " " + str(key) + ":=" + str(ros_params[key]) 55 | if (application == "package_delivery"): 56 | return "roslaunch package_delivery package_delivery.launch" + args 57 | #return "roslaunch package_delivery y.launch" 58 | elif (application == "scanning"): 59 | return "roslaunch package_delivery scanning.launch" + args 60 | elif (application == "mapping"): 61 | return "roslaunch mapping_and_sar mapping.launch" + args 62 | elif (application == "sar"): 63 | return "roslaunch mapping_and_sar sar.launch" + args 64 | elif (application == "follow_the_leader"): 65 | return "roslaunch follow_the_leader follow_the_leader.launch" + args 66 | else: 67 | print("this application not defined") 68 | sys.exit() 69 | 70 | def get_supervisor_cmd(user_setting, experiment_setting): 71 | mav_bench_dir = user_setting["mav_bench_dir"] 72 | termination = experiment_setting["max_run_time"] 73 | app = experiment_setting["application"] 74 | return "python "+\ 75 | mav_bench_dir+"run_time/supervisor.py" +\ 76 | " " + mav_bench_dir +\ 77 | " " + app +\ 78 | " " + str(termination) 79 | 80 | 81 | def get_pre_mission_cmd(application): 82 | return "./catkin_ws/src/MAV_apps/pre_mission/"+application+"/pre_mission_cmds.sh" 83 | 84 | def check_start_moving(user_setting, experiment_setting): 85 | time_to_move = False 86 | file_to_write_to = user_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt" 87 | time.sleep(12) 88 | file_to_write_to_handle.open(file_to_write_to, "w") 89 | file_to_write_to_handle.close() 90 | sys.exit(0) 91 | """ 92 | while(not(time_to_move)): 93 | stdout = ssh_client.exec_command("python " + user_setting["mav_bench_dir"]+ 94 | "/misc/check_start_moving.py") 95 | print stdout 96 | if stdout == "true": 97 | time_to_move = True 98 | file_to_write_to_handle.open(file_to_write_to, "w") 99 | file_to_write_to_handle.write("move") 100 | time.sleep(2) 101 | """ 102 | 103 | def signal_start_moving(file_to_write_to): 104 | time.sleep(130) 105 | open(file_to_write_to, "w").close() 106 | 107 | def get_bind_node_cmd(platform): 108 | if (platform == "tx2"): 109 | return "python ./catkin_ws/src/MAV_apps/run_time/bind_nodes.py" 110 | else: 111 | return "echo hello" 112 | 113 | def schedule_tasks(user_setting, experiment_setting, ssh_client): 114 | #--- cmds to schedul e 115 | src_ros_cmd = "source " + user_setting["catkin_dir"]+"/devel/setup.bash" 116 | ros_launch_cmd = get_ros_cmd(experiment_setting) 117 | run_time_supervisor_cmd = get_supervisor_cmd(user_setting, experiment_setting) 118 | #run_time_supervisor_cmd = ""#get_supervisor_cmd(user_setting, experiment_setting) 119 | pre_mission_cmds = get_pre_mission_cmd(experiment_setting["application"]) 120 | platform = user_setting["platform"] 121 | #all_cmds = src_ros_cmd + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd + "|" + get_bind_node_cmd(platform) 122 | all_cmds = src_ros_cmd + ";" + run_time_supervisor_cmd + "& " + pre_mission_cmds + "|" + ros_launch_cmd 123 | p = Process(target= signal_start_moving, args=(user_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt",)) 124 | if (experiment_setting["application"] == "follow_the_leader"): 125 | p.start() 126 | #--- pramiko 127 | stdin,stdout,stderr= ssh_client.exec_command(all_cmds, get_pty=True) 128 | outlines = stdout.readlines() 129 | result=''.join(outlines) 130 | 131 | print(result) 132 | 133 | if (experiment_setting["application"] == "follow_the_leader"): 134 | p.join() 135 | # errlines = stderr.readlines() 136 | # resp_err=''.join(errlines) 137 | # print(resp_err) 138 | return result 139 | """ 140 | def copy_results_over(data_clct_conf_obj, ssh_client): 141 | mav_bench_dir = data_clct_conf_obj.get_config_data()["mav_bench_dir"] 142 | application = data_clct_conf_obj.get_config_data()["application"] 143 | stats_file_name_on_comp_computer = data_clct_conf_obj.get_config_data()["stats_file_on_comp_computer"] 144 | stats_dir_on_host = data_clct_conf_obj.get_config_data()["stats_dir_on_host"] 145 | data_addr = mav_bench_dir +"/data/"+application+"/" + stats_file_name_on_comp_computer 146 | 147 | scp_client = SCPClient(ssh_client.get_transport()) 148 | scp_client.get(data_addr) 149 | copy(stats_file_name_on_comp_computer, stats_dir_on_host); 150 | """ 151 | 152 | def restart_unreal(): 153 | restart_level(); 154 | 155 | def stop_unreal(): 156 | stop_game(); 157 | 158 | def parse_results(result): 159 | return 160 | 161 | def minimize_the_window(): 162 | time.sleep(5); 163 | Minimize = win32gui.GetForegroundWindow() 164 | win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE) 165 | 166 | def signal_handler(signal, frame): 167 | print('You pressed Ctrl+C!') 168 | stop_unreal() 169 | sys.exit(0) 170 | 171 | def write_to_stats_file(stat_file_addr, string_to_write, user_setting, ssh_client): 172 | python_file_to_run = user_setting["mav_bench_dir"]+ "common/python_files/write_to_file.py" 173 | cmd = "python" + " " + python_file_to_run + " " + stat_file_addr + " " + string_to_write 174 | stdin,stdout,stderr= ssh_client.exec_command(cmd, get_pty=True) 175 | outlines = stdout.readlines() 176 | result=''.join(outlines) 177 | print(result) 178 | # errlines = stderr.readlines() 179 | # resp_err=''.join(errlines) 180 | # print(resp_err) 181 | return result 182 | 183 | def modify_freq(freq, ssh_client, num_of_core=6): 184 | print freq 185 | #stdin,stdout,stderr= ssh_client.exec_command("echo nvidia | sudo -S python /home/nvidia/catkin_ws/src/MAV_apps/misc/assign_all.py " + str(freq), get_pty=True) 186 | stdin,stdout,stderr= ssh_client.exec_command("echo nvidia | sudo -S python /home/nvidia/catkin_ws/src/MAV_apps/misc/setup_system.py " + str(num_of_core) + " " + str(freq), get_pty=True) 187 | #we need the following two statement to make it block, otherwise it won;t 188 | # have an effect for some reason 189 | outlines = stdout.readlines() 190 | result=''.join(outlines) 191 | #print(result) 192 | def get_v_max(n_core, freq): 193 | ctr = 0 194 | v_max_l = [1.0, 1.2, 1.3, 1.5, 1.6, 1.7, 1.8, 2.0, 2.2] 195 | for freq_el in [806400, 1574400, 2035200]: 196 | for core_el in [2,3,4]: 197 | if (n_core == core_el) and (freq == freq_el): 198 | return v_max_l[ctr] 199 | ctr +=1 200 | 201 | def main(): 202 | try: 203 | data_clct_conf_obj = DataClctConf(data_clct_conf_file_addr) #parse config file and instantiate a 204 | user_setting = data_clct_conf_obj.get_config_data()["user_setting"] 205 | experiment_setting_list = data_clct_conf_obj.get_config_data()["experiment_setting_list"] 206 | total_run_ctr = 0 207 | experiment_set_ctr = 0 208 | #write_to_stats_file(stat_file_addr, "{", user_setting, ssh_client) 209 | #--- removing the file that triggers the char (only usefull for follow_the_leader) 210 | """ 211 | try: 212 | os.remove(user_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt") 213 | except: 214 | print "companion_com_msg doesn't exist to remove. This might be ok" 215 | """ 216 | time.sleep(3) #there needs to be a sleep between restart and change_level 217 | 218 | for experiment_setting in experiment_setting_list: 219 | for n_core in [4,3,2] : 220 | for freq in [2035200, 1574400, 806400]: 221 | num_of_runs = experiment_setting["number_of_runs"] 222 | application = experiment_setting["application"] 223 | ros_params = experiment_setting["ros_params"] 224 | if (application == "mapping" or application == "sar"): 225 | ros_params["v_max"] = get_v_max(n_core, freq) 226 | #proc_freq = experiment_setting["processor_frequency"] 227 | proc_freq = freq 228 | num_of_core = n_core 229 | stat_file_addr = user_setting["mav_bench_dir"]+"data/"+application+ "/"+"stats.json" 230 | 231 | try: 232 | os.remove(user_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt") 233 | except: 234 | print "companion_com_msg doesn't exist to remove. This might be ok" 235 | if ("map_name" in experiment_setting.keys()): 236 | change_level(experiment_setting["map_name"]) 237 | else: 238 | restart_unreal() 239 | 240 | #start_unreal(user_setting) 241 | ssh_client = creat_ssh_client(user_setting) 242 | modify_freq(proc_freq, ssh_client, num_of_core) 243 | 244 | #--- preparting the result file 245 | write_to_stats_file(stat_file_addr, '\t\\"experiment_set_'+ str(experiment_set_ctr) +'\\":', user_setting, ssh_client) 246 | write_to_stats_file(stat_file_addr, '[', user_setting, ssh_client) 247 | experiment_set_ctr +=1 248 | #minimize_the_window() 249 | 250 | #--- start collecting data 251 | for experiment_run_ctr in range(0, num_of_runs): 252 | total_run_ctr += 1 253 | result = schedule_tasks(user_setting, experiment_setting, ssh_client) 254 | 255 | try: 256 | os.remove(user_setting["AirSim_dir"]+ "\\"+ "companion_comp_msgs.txt") 257 | except: 258 | print "companion_com_msg doesn't exist to remove. This might be ok" 259 | restart_unreal() 260 | time.sleep(3) #there needs to be a sleep between restart and change_level 261 | write_to_stats_file(stat_file_addr, '\t'+'\\"app\\":\\"'+str(application)+'\\",', user_setting, ssh_client) 262 | write_to_stats_file(stat_file_addr, '\t'+'\\"processor_freq\\":\\"'+str(proc_freq)+'\\",', user_setting, ssh_client) 263 | for param in ros_params.keys(): 264 | write_to_stats_file(stat_file_addr, '\t\\"'+param + '\\":\\"'+str(ros_params[param])+'\\",', user_setting, ssh_client) 265 | 266 | write_to_stats_file(stat_file_addr, '\t\\"experiment_number\\":'+str(total_run_ctr)+',', user_setting, ssh_client) 267 | write_to_stats_file(stat_file_addr, '\t\\"num_of_cores\\":'+str(num_of_core), user_setting, ssh_client) 268 | if (experiment_run_ctr < num_of_runs - 1): 269 | write_to_stats_file(stat_file_addr, "},", user_setting, ssh_client) 270 | 271 | write_to_stats_file(stat_file_addr, "}],", user_setting, ssh_client) 272 | #stop_unreal() 273 | #write_to_stats_file(stat_file_addr, '\\"experiment_number\\":'+str(experiment_run_ctr)+"}", user_setting, ssh_client) 274 | #write_to_stats_file(stat_file_addr, "]}", user_setting, ssh_client) 275 | except Exception as e: 276 | pass 277 | print(traceback.format_exception(*sys.exc_info())) 278 | #stop_unreal() 279 | 280 | if __name__ == "__main__": 281 | main() 282 | --------------------------------------------------------------------------------