forked from ethz-asl/rovio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRun_EuRoC.py
executable file
·82 lines (61 loc) · 3.56 KB
/
Run_EuRoC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This script is to run all the experiments in one program
import os
import subprocess
import time
import signal
# SeqNameList = ['V2_02_medium'];
# SeqNameList = ['V1_03_difficult', 'V2_02_medium', 'V2_03_difficult'];
SeqNameList = ['MH_01_easy', 'MH_02_easy', 'MH_03_medium', 'MH_04_difficult', 'MH_05_difficult', 'V1_01_easy', 'V1_02_medium', 'V1_03_difficult', 'V2_01_easy', 'V2_02_medium', 'V2_03_difficult'];
Result_root = '/mnt/DATA/tmp/EuRoC/rovio_Mono_Baseline/'
Number_GF_List = [25];
Num_Repeating = 10 # 20 # 5 #
SleepTime = 5
#----------------------------------------------------------------------------------------------------------------------
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
ALERT = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
for ri, num_gf in enumerate(Number_GF_List):
Experiment_prefix = 'ObsNumber_' + str(int(num_gf))
for iteration in range(0, Num_Repeating):
Experiment_dir = Result_root + Experiment_prefix + '_Round' + str(iteration + 1)
cmd_mkdir = 'mkdir ' + Experiment_dir
subprocess.call(cmd_mkdir, shell=True)
for sn, sname in enumerate(SeqNameList):
print bcolors.ALERT + "====================================================================" + bcolors.ENDC
SeqName = SeqNameList[sn] #+ '_blur_9'
print bcolors.ALERT + "Round: " + str(iteration + 1) + "; Seq: " + SeqName
File_rosbag = '/mnt/DATA/Datasets/EuRoC_dataset/BagFiles/' + SeqName + '.bag'
cmd_slam = str('roslaunch rovio euroc_node.launch')
cmd_rosbag = 'rosbag play ' + File_rosbag # + ' -u 30' # + ' -r 0.3'
cmd_timelog = str('cp /mnt/DATA/tmpLog.txt ' + Experiment_dir + '/' + SeqName + '_Log.txt')
cmd_tracklog = str('cp /mnt/DATA/tmpTrack.txt ' + Experiment_dir + '/' + SeqName + '_AllFrameTrajectory.txt')
print bcolors.WARNING + "cmd_slam: \n" + cmd_slam + bcolors.ENDC
print bcolors.WARNING + "cmd_rosbag: \n" + cmd_rosbag + bcolors.ENDC
print bcolors.WARNING + "cmd_timelog: \n" + cmd_timelog + bcolors.ENDC
print bcolors.WARNING + "cmd_tracklog: \n" + cmd_tracklog + bcolors.ENDC
print bcolors.OKGREEN + "Launching SLAM" + bcolors.ENDC
proc_slam = subprocess.Popen(cmd_slam, shell=True)
# proc_slam = subprocess.Popen("exec " + cmd_slam, stdout=subprocess.PIPE, shell=True)
print bcolors.OKGREEN + "Sleeping for a few secs to wait for rovio init" + bcolors.ENDC
time.sleep(SleepTime)
print bcolors.OKGREEN + "Launching rosbag" + bcolors.ENDC
proc_bag = subprocess.call(cmd_rosbag, shell=True)
print bcolors.OKGREEN + "Finished rosbag playback, kill the process" + bcolors.ENDC
subprocess.call('rosnode kill /rovio', shell=True)
# subprocess.call('pkill roslaunch', shell=True)
# subprocess.call('pkill svo_node', shell=True)
print bcolors.OKGREEN + "Sleeping for a few secs to wait for msckf_vio quit" + bcolors.ENDC
time.sleep(SleepTime)
print bcolors.OKGREEN + "Copy the time log to result folder" + bcolors.ENDC
subprocess.call(cmd_timelog, shell=True)
print bcolors.OKGREEN + "Copy the track to result folder" + bcolors.ENDC
subprocess.call(cmd_tracklog, shell=True)
# proc_rec.terminate()
# outs, errs = proc_rec.communicate()
# proc_slam.kill()