Skip to content
Snippets Groups Projects
Commit d5f27c12 authored by Hoa Ben The Nguyen's avatar Hoa Ben The Nguyen
Browse files

change: more precise calculation of relativity of lidar vs real world map

parent c3b9961f
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding = true
}
}
dependencies {
......
......@@ -10,19 +10,15 @@ METER = (1 / ((2 * pi / 360) * EARTH)) / 1000 # 1 meter in degree
# p - area using real world coordinate
# l - area using lidar coordinate(pointcloud)
# max_limit - maximum area limit of a lidar scann in real world coordinates
def position_relative_to_pointcloud(l1, l2, p1, p2, center_l, center_p, max_lim):
def position_relative_to_pointcloud(l1, l2, p1, p2, center_p, max_lim):
center_l = tuple((a+b)/2 for a, b in zip(max_lim[0],max_lim[1]))
return [
((center_p[0] - p1[0]) * ((l1[0] - l2[0]) / (max_lim[1][0] - max_lim[3][0])) + center_l[0],
(center_p[1] - p1[1]) * ((l1[1] - l2[1]) / (max_lim[1][1] - max_lim[3][1])) + center_l[1]),
((center_p[0] - p2[0]) * ((l1[0] - l2[0]) / (max_lim[1][0] - max_lim[3][0])) + center_l[0],
(center_p[1] - p2[1]) * ((l1[1] - l2[1]) / (max_lim[1][1] - max_lim[3][1])) + center_l[1])
(center_p[1] - p2[1]) * ((l1[1] - l2[1]) / (max_lim[1][1] - max_lim[3][1])) + center_l[1]),
((center_p[0] - p1[0]) * ((l1[0] - l2[0]) / (max_lim[1][0] - max_lim[3][0])) + center_l[0],
(center_p[1] - p1[1]) * ((l1[1] - l2[1]) / (max_lim[1][1] - max_lim[3][1])) + center_l[1])
]
#return [(((min[0] - max[0]) * ((start[0] - limit[1][0]) / (limit[1][0] - limit[3][0]))) + center[0],
# (((min[1] - max[1]) * ((start[1] - limit[1][0]) / (limit[1][1] - limit[3][1]))) + center[1])),
# ((((min[0] - max[0]) * ((end[0] - limit[1][0]) / (limit[1][0] - limit[3][0]))) + center[0],
# (((min[1] - max[1]) * ((end[1] - limit[1][0]) / (limit[1][1] - limit[3][1])))) + center[1]))]
print(position_relative_to_pointcloud((-5,5), (-2,2), (1.2,1.6), (1.8,1.4), (-3.5,3.5), (1.5,1.5), [(0,0),(1,2),(0,0),(2,1)]))
print(position_relative_to_pointcloud((-20,30), (-10,20), (1,3), (2,2), (1.5,2.5), [(0,0),(0,5),(0,0),(5,0)]))
# check if lidar points is within range of the area selected
def inArea(position, areaRange):
......
......@@ -98,7 +98,7 @@ def calculate_area_data(center, body_of_water):
#test data
# zone coordinates sett to be relative to the lidar data's point cloud
areazone = position_relative_to_pointcloud(min_point, max_point, start, end, center, area_limit)
print("area",areazone)
# calculate map zones height
ys, xs = start
ye, xe = end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment