27
27
28
28
# init data
29
29
yaw_offs_init = 0
30
- yaw_offs_inits = []
31
30
32
31
# ransac variables
33
32
ransac_pairs = []
@@ -69,21 +68,19 @@ def height_callback(height):
69
68
global lsy , ransac_complete
70
69
if ransac_complete is False and lsy is not None and last_yaw is not None :
71
70
ransac_pairs .append ((height .data , lsy ))
72
- # yaw_offs_inits.append(last_yaw - lsyaw)
73
- yaw_offs_inits .append (last_yaw )
74
71
75
72
if len (ransac_pairs ) < 50 :
76
73
print ("Collecting data for ransac. Frames: %d" % len (ransac_pairs ))
77
74
else :
78
- perform_ransac (0.3 , 5000 )
75
+ perform_ransac (0.2 , 5000 )
79
76
print ("SLAM RANSAC error: %f" % ransac_err )
80
77
81
- if ransac_err <= 0.2 :
78
+ if ransac_err <= 0.3 :
82
79
global yaw_offs_init
83
80
print ("RANSAC scale: %f su/m" % ransac_m_k )
84
81
85
82
# determine yaw offset
86
- yaw_offs_init = sum ( yaw_offs_inits ) / len ( yaw_offs_inits )
83
+ yaw_offs_init = lsyaw
87
84
print ("Yaw offset: %f deg" % ((yaw_offs_init * 180 ) / np .pi ))
88
85
89
86
ransac_complete = True
@@ -92,7 +89,7 @@ def height_callback(height):
92
89
93
90
94
91
def pose_callback (pose ):
95
- global ransac_pairs , lsyaw , yaw_offs_init , yaw_offs_inits , p_off_x , p_off_y , \
92
+ global ransac_pairs , lsyaw , yaw_offs_init , p_off_x , p_off_y , \
96
93
ransac_complete , ransac_err , ransac_m_k , lsx , lsz , lst , lsy
97
94
98
95
# reset estimator if invalid data
@@ -105,7 +102,6 @@ def pose_callback(pose):
105
102
p_off_x = None
106
103
p_off_y = None
107
104
yaw_offs_init = 0
108
- yaw_offs_inits = []
109
105
ransac_pairs = []
110
106
ransac_complete = False
111
107
ransac_err = 1
0 commit comments