-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.py
48 lines (33 loc) · 1.49 KB
/
test.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
# Copyright 2019 Jariullah Safi
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import numpy as np
from karto_scanmatcher import LocalizedRangeScan, LaserScanConfig, Pose2
from karto_scanmatcher import Wrapper, ScanMatcherConfig
def main():
config = ScanMatcherConfig()
mw = Wrapper(config)
config = LaserScanConfig(-1.0, 1.0, np.deg2rad(0.5), 0, 10, 5, "")
base = [
LocalizedRangeScan(config, [3.0] * 230, Pose2(0, 0, 0), Pose2(0, 0, 0),
0, 0.0)
]
query = LocalizedRangeScan(config, [3.0] * 230, Pose2(1.0, 0, 1.57),
Pose2(1.0, 0, 1.57), 1, 0.0)
print(query.corrected_pose)
res = mw.match_scan(query, base, True, True)
print(res.best_pose)
query.corrected_pose = res.best_pose
print(np.array(res.covariance))
print(query.corrected_pose)
if __name__ == '__main__':
main()
print('ran')