-
Notifications
You must be signed in to change notification settings - Fork 119
/
run.py
168 lines (151 loc) · 7.73 KB
/
run.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/python3
#-*-coding:utf-8-*-
import os
import sys
import signal
import time
import globalConfig
from subprocess import Popen
if __name__=="__main__":
#long distance loam
command_loam="roslaunch input_data input_data.launch input_bag_file:="+\
globalConfig.bag_input_filename + " output_track_file:="+\
globalConfig.slamTrackLongTmp +\
" total_distance:="+ str(globalConfig.totalLongDistance)+\
" overlap_distance:="+ "0.0;"
print("command loam is: ", command_loam)
pLoam= Popen(command_loam, shell= True)
globalConfig.pidList[0]= pLoam.pid
pLoam.wait()
if(pLoam.returncode):
globalConfig.function_end()
#Get Long Distance Track Num
trackNum= globalConfig.loam_file_search(globalConfig.slamTrackLongTmp)
print ("long distance loam track file num is: ", trackNum)
itrackNum= 1
while(itrackNum<= trackNum):
#Speed-Weight-Coeficient Calculation
command_icp_weight_speed="roslaunch icp_weight_coe icp_weight_coe.launch"+\
" coe_sort:="+ "1"+\
" slam_track_file:="+ globalConfig.slamTrackLongTmp+ str(itrackNum)+\
" gps_track_file:="+ "No_Need_File"+\
" icp_track_file:="+ "No_Need_File"+\
" weight_coe_file:="+ globalConfig.weightSpeedTmp+ str(itrackNum)+ "; "
print("command icp weight speed is: ", command_icp_weight_speed)
pICPWeightSpeed= Popen(command_icp_weight_speed, shell= True)
globalConfig.pidList[1]= pICPWeightSpeed.pid
pICPWeightSpeed.wait()
if(pICPWeightSpeed.returncode):
globalConfig.function_end()
#Speed-LOAM-Weighted ICP
command_segmentation_icp= "roslaunch long_distance_track_process long_distance_track_process.launch"+\
" gps_track_file:="+ globalConfig.gps_input_filename+\
" loam_track_file:="+ globalConfig.slamTrackLongTmp+ str(itrackNum)+\
" gps_enu_file:="+ globalConfig.enuOriTmp+ str(itrackNum)+\
" loam_enu_file:="+ globalConfig.enuProcessedTmp+ str(itrackNum)+\
" icp_weight_file:="+ globalConfig.weightSpeedTmp+ str(itrackNum)+ \
" icp_type:="+ "1"+ ";"
print("command segmentation icp is: ", command_segmentation_icp)
pSegICPProcess= Popen(command_segmentation_icp, shell= True)
globalConfig.pidList[2]= pSegICPProcess.pid
pSegICPProcess.wait()
if(pSegICPProcess.returncode):
globalConfig.function_end()
for i in range(globalConfig.maxIterNum):
#Speed And Weight-GPS-Reliable
command_icp_weight_gps="roslaunch icp_weight_coe icp_weight_coe.launch"+\
" coe_sort:="+ "2"+\
" slam_track_file:="+ globalConfig.slamTrackLongTmp+ str(itrackNum)+\
" gps_track_file:="+ globalConfig.enuOriTmp+ str(itrackNum)+\
" icp_track_file:="+ globalConfig.enuProcessedTmp+ str(itrackNum)+\
" weight_coe_file:="+ globalConfig.weightGPSTmp+ str(itrackNum)+"; "
print("command icp weight is: ", command_icp_weight_gps)
pICPWeightGPS= Popen(command_icp_weight_gps, shell= True)
globalConfig.pidList[3]= pICPWeightGPS.pid
pICPWeightGPS.wait()
if(pICPWeightGPS.returncode):
globalConfig.function_end()
#Speed And Weighted-GPS ICP
command_segmentation_icp= "roslaunch long_distance_track_process long_distance_track_process.launch"+\
" gps_track_file:="+ globalConfig.gps_input_filename+\
" loam_track_file:="+ globalConfig.enuProcessedTmp+ str(itrackNum)+\
" gps_enu_file:="+ globalConfig.enuOriTmp+ str(itrackNum)+\
" loam_enu_file:="+ globalConfig.enuProcessedTmp+ str(itrackNum)+\
" icp_weight_file:="+ globalConfig.weightGPSTmp+ str(itrackNum)+\
" icp_type:="+ "1"+ ";"
print("command segmentation icp is: ", command_segmentation_icp)
pSegICPProcess= Popen(command_segmentation_icp, shell= True)
globalConfig.pidList[4]= pSegICPProcess.pid
pSegICPProcess.wait()
if(pSegICPProcess.returncode):
globalConfig.function_end()
itrackNum+=1
#Merge GPS Data And Weight Data
command_merge_xyztw= "rosrun data_preprocess data_preprocess_node "+\
globalConfig.enuOriTmp+ " "+\
globalConfig.weightGPSTmp+ " "+\
globalConfig.EWMergeTmp+" "+ str(trackNum);
print("command merge xyztw is: ", command_merge_xyztw)
pMergeData= Popen(command_merge_xyztw, shell= True)
globalConfig.pidList[5]= pMergeData.pid
pMergeData.wait()
if(pMergeData.returncode):
globalConfig.function_end()
#short distance loam
command_loam="roslaunch input_data input_data.launch input_bag_file:=" +\
globalConfig.bag_input_filename+ " output_track_file:="+\
globalConfig.slamTrackShortTmp +\
" total_distance:=" + str(globalConfig.totalShortDistance)+\
" overlap_distance:="+ str(globalConfig.opDistance)+ ";"
print("command loam is: ", command_loam)
pLoam= Popen(command_loam, shell= True)
globalConfig.pidList[6]= pLoam.pid
pLoam.wait()
if(pLoam.returncode):
globalConfig.function_end()
#Get Short Distance Track Num
trackNum= globalConfig.loam_file_search(globalConfig.slamTrackShortTmp)
print ("short distance loam track file num is: ", trackNum)
#Short Distance Track ICP With GPS Track
command_segmentation_icp= " rosrun short_distance_track_icp short_distance_track_icp_node "+\
globalConfig.slamTrackShortTmp+" "+\
globalConfig.EWMergeTmp+" "+ str(trackNum)
print("command segmentation icp is: ", command_segmentation_icp)
pSegICPProcess= Popen(command_segmentation_icp, shell= True)
globalConfig.pidList[7]= pSegICPProcess.pid
pSegICPProcess.wait()
if(pSegICPProcess.returncode):
globalConfig.function_end()
#Merge Short Distance Results Data
command_merge_results= "rosrun results_merge results_merge_node "+\
str(trackNum)+" "+ globalConfig.enuProcessedFinal
print("command merge results is: ", command_merge_results)
pMergeResults= Popen(command_merge_results, shell= True)
globalConfig.pidList[8]= pMergeResults.pid
pMergeResults.wait()
if(pMergeResults.returncode):
globalConfig.function_end()
#Original GPS Track: ENU->KML
command_enu_to_gps= "./devel/local_to_GPS "+ globalConfig.EWMergeTmp+ " "+\
globalConfig.ctm+ " "+\
globalConfig.gdt+ " "+\
"0"+ " "+ globalConfig.gps_original_filename+ "; "
print("command enu to gps is: ", command_enu_to_gps)
pENUToGPS= Popen(command_enu_to_gps, shell= True)
globalConfig.pidList[9]= pENUToGPS.pid
pENUToGPS.wait()
if(pENUToGPS.returncode):
globalConfig.function_end()
#Processed GPS Track: ENU->KML
command_enu_to_gps= "./devel/local_to_GPS "+ globalConfig.enuProcessedFinal+ " "+\
globalConfig.ctm+ " "+\
globalConfig.gdt+ " "+\
"1"+ " "+ globalConfig.gps_improved_filename+ "; "
print("command enu to gps is: ", command_enu_to_gps)
pENUToGPS= Popen(command_enu_to_gps, shell= True)
globalConfig.pidList[10]= pENUToGPS.pid
pENUToGPS.wait()
if(pENUToGPS.returncode):
globalConfig.function_end()
#Clean Up The Enviroment
globalConfig.clear_eviriment()