Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ags_grabber
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
ags_grabber
Commits
be716c01
Commit
be716c01
authored
Sep 07, 2021
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edited includes
parent
5341a78b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
map_builder.py
map_builder.py
+3
-0
waypointGenerator.py
waypointGenerator.py
+70
-0
No files found.
map_builder.py
View file @
be716c01
...
@@ -19,6 +19,9 @@ import csv
...
@@ -19,6 +19,9 @@ import csv
import
os
import
os
import
glob
import
glob
from
pyproj
import
Transformer
,
Proj
,
transform
# import matlab.engine
# import matlab.engine
def
trim_extent
(
x_pts
,
y_pts
,
scaled_extent
):
def
trim_extent
(
x_pts
,
y_pts
,
scaled_extent
):
...
...
waypointGenerator.py
View file @
be716c01
import
math
from
pyproj
import
Transformer
,
Proj
,
transform
import
numpy
as
np
import
json
def
point_rotation
(
origin
,
pt
,
ang
):
# returns the pt rotated about the origin by ang (ang in degrees)
c
=
math
.
cos
(
math
.
radians
(
ang
))
s
=
math
.
sin
(
math
.
radians
(
ang
))
# translate to origin
pt_temp
=
[
pt
[
0
]
-
origin
[
0
],
pt
[
1
]
-
origin
[
1
]]
pt_spun
=
[
pt_temp
[
0
]
*
c
-
pt_temp
[
1
]
*
s
,
pt_temp
[
0
]
*
s
+
pt_temp
[
1
]
*
c
]
# translate back to frame
pt_spun
=
[
pt_spun
[
0
]
+
origin
[
0
],
pt_spun
[
1
]
+
origin
[
1
]]
return
pt_spun
def
meters2lat_lon
(
xs
,
ys
):
transformer
=
Transformer
.
from_crs
(
3857
,
4326
)
# meters -> lat lon
ll_pts
=
transformer
.
transform
(
xs
,
ys
)
return
ll_pts
def
lat_lon2meters
(
lats
,
lons
):
transformer
=
Transformer
.
from_crs
(
4326
,
3857
)
# lat lon -> meters
xy_pts
=
transformer
.
transform
(
lats
,
lons
)
return
xy_pts
if
__name__
==
"__main__"
:
anchor_point
=
(
37.223125
,
-
80.432731
)
rotation
=
45
altitude
=
2
filename
=
"musical_drones.json"
ap_meters
=
lat_lon2meters
(
anchor_point
[
0
],
anchor_point
[
1
])
# xy offsets, in meters, from center point...
center_offsets
=
[
[
-
12
,
-
12
],
[
12
,
-
12
],
[
12
,
12
],
[
6
,
6
],
[
-
6
,
6
],
[
-
6
,
-
6
],
[
-
1
,
-
1
],
[
1
,
-
1
],
[
1
,
1
],
[
12
,
-
12
],
]
waypoint_dict
=
{}
waypoint_dict_flip
=
{}
for
i
,
pt
in
enumerate
(
center_offsets
):
rotated_pt
=
point_rotation
([
0
,
0
],
pt
,
rotation
)
rotated_pt_flip
=
point_rotation
([
0
,
0
],
pt
,
180
-
rotation
)
wps
=
meters2lat_lon
(
rotated_pt
[
0
]
+
ap_meters
[
0
],
rotated_pt
[
1
]
+
ap_meters
[
1
])
wps_flip
=
meters2lat_lon
(
rotated_pt_flip
[
0
]
+
ap_meters
[
0
],
rotated_pt_flip
[
1
]
+
ap_meters
[
1
])
waypoint_dict
.
update
({
"waypoint_{}"
.
format
(
i
)
:
[
wps
[
0
],
wps
[
1
],
altitude
]})
waypoint_dict_flip
.
update
({
"waypoint_{}"
.
format
(
i
)
:
[
wps_flip
[
0
],
wps_flip
[
1
],
altitude
]})
# print(waypoint_dict)
robot_dict
=
{
"robot_list"
:
{
"robot_0"
:
waypoint_dict
,
"robot_1"
:
waypoint_dict_flip
}}
with
open
(
filename
,
"w"
)
as
f
:
json
.
dump
(
robot_dict
,
f
)
print
(
robot_dict
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment