Skip to content

Commit

Permalink
Devel for 1.1 (#47)
Browse files Browse the repository at this point in the history
* Mission takeoff fix (#46)

* patch for takeoff wp write error

* Path tree (#50)

* added pathTree subclass

* working integrated pathTree

* Or export (#51)

* exporting some data for OR tools

* added at method to survey

* clean up on metaTree creation

* added timeouut for cvx

* switched smt to sat, thanks MK

* Kml (#53)

* added kml parser to Areas class

* Priority Point (#55)

* Queue sort (#56)

* simple queue sort to avoid islands

* syntax shooogar

* K2shah patch 1 (#57)

* Update python-app.yml

* hard coded values are bad

* relinking after changing route parameters (#58)

* relinking after changing route parameters

* guard against small graphs

* fixed view with new solver api

Co-authored-by: jadenvc <[email protected]>
  • Loading branch information
k2shah and jadenvc authored Aug 8, 2022
1 parent e4af342 commit 9e22497
Show file tree
Hide file tree
Showing 26 changed files with 1,540 additions and 220 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: build

on:
push:
branches: [ master, devel ]
branches: [master]
pull_request:
branches: [ master, devel ]
branches: [master, devel ]

jobs:
build:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class

# unknown
.DS_Store

# C extensions
*.so

Expand Down
Binary file added docs/.DS_Store
Binary file not shown.
Binary file added example/.DS_Store
Binary file not shown.
37 changes: 19 additions & 18 deletions example/stanford.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from wadl.lib.route import RouteParameters
from wadl.mission import MissionParameters

# suvey design script
# survey design script
# get file name
# files are assumed geofences (ID, lat, long)
file = "data/stanford.csv"
Expand All @@ -22,24 +22,25 @@
}
survey.setKeyPoints(keyPoints)

# route paramters
# route parameters
routeParams = RouteParameters()
routeParams["limit"] = 30*60, # s
routeParams["limit"] = 30*60 # s
routeParams["speed"] = 5 # m/s
routeParams["altitude"] = 50.0 # m
# add the tasks

survey.addTask(file,
step=100,
home=["oval", "MSL"],
home=["MSL", "oval"],
routeParameters=routeParams,
)

# solver parameters
solverParams = SolverParameters()
solverParams["subGraph_size"] = 20
solverParams["SATBound_offset"] = 4
solverParams["timeout"] = 30
solverParams["SATBound_offset"] = 2
solverParams["timeout"] = 10
solverParams["stitch"] = "milp"

# set the solver parameters
survey.setSolverParamters(solverParams)
Expand All @@ -51,22 +52,22 @@
survey.view()
else:
# run path solver to plan paths and write output
survey.plan()
survey.plan(write=False, showPlot=True)
# survey.plot()

# make mission
# mission paramters
missionParams = MissionParameters()
missionParams["N_bands"] = 3
missionParams["autoland"] = False
# mission parameters
# missionParams = MissionParameters()
# missionParams["N_bands"] = 3
# missionParams["autoland"] = False

missionParams["assign"] = "sequence"
# missionParams["assign"] = "sequence"

missionParams["offset_takeoff_dist"] = 10
missionParams["offset_land_dist"] = 10
# missionParams["offset_takeoff_dist"] = 10
# missionParams["offset_land_dist"] = 10


mission = Mission(missionParams)
mission.fromSurvey(survey, showPlot=True)
mission.setVersion(4, 0, 187)
mission.write()
# mission = Mission(missionParams)
# mission.fromSurvey(survey, showPlot=True)
# mission.setVersion(4, 0, 187)
# mission.write()
Binary file modified example/stanford/routes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Shapely>=1.7.0
tqdm>=4.46.1
utm>=0.5.0
z3-solver>=4.8.8.0
cvxopt>=1.2.5
cvxpy>=1.1.7
lxml>=4.6.3
fastkml>=0.11
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from setuptools import setup, find_packages

requirements = ['numpy', 'matplotlib', 'scipy', 'tqdm',
'shapely', 'z3-solver', 'networkx', 'utm']
'shapely', 'networkx', 'utm', 'fastkml', 'lxml',
'z3-solver', 'cvxpy', 'cvxopt']

setup_requirements = ['pytest-runner', ]

Expand Down
152 changes: 152 additions & 0 deletions tests/data/HMR_tree_polygon_v2/8FCD70AEBABB4DBF958BF447B4088ADE.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:variable name="ignoreFieldNames" select="'|OBJECTID|Shape|Shape_Length|Shape_Area|ATTACHMENTID|REL_OBJECTID|CONTENT_TYPE|ATT_NAME|DATA_SIZE|DATA|'"/>
<xsl:variable name="headerRowColor" select="'#9CBCE2'"/>
<xsl:variable name="alternateRowColor" select="'#D4E4F3'"/>
<xsl:template match="/">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
</head>
<body style="margin:0px 0px 0px 0px;overflow:auto;background:#FFFFFF;">
<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-collapse:collapse;padding:3px 3px 3px 3px">
<tr style="text-align:center;font-weight:bold;background:{$headerRowColor}">
<td>
<xsl:value-of select="FieldsDoc/Title" />
</td>
</tr>
<xsl:apply-templates select="FieldsDoc/Attachments" />
<tr>
<td>
<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px">
<xsl:choose>
<xsl:when test="FieldsDoc/Fields/Field/FieldName">
<xsl:apply-templates select="FieldsDoc/Fields/Field/FieldName[not(contains($ignoreFieldNames, concat(concat('|', text()), '|')))]/.." />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="FieldsDoc/Fields/Field" />
</xsl:otherwise>
</xsl:choose>
</table>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>

<xsl:template match="Attachments">
<xsl:variable name="imageCount" select="count(Attachment/ContentType[contains(., 'image')])"/>
<xsl:variable name="attachmentCount" select="count(Attachment)"/>
<tr bgcolor="{$headerRowColor}">
<td>
<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px">
<xsl:variable name="imageSrc" select="Attachment/ContentType[contains(., 'image')]/../FilePath"/>
<xsl:if test="$imageSrc">
<tr align="center">
<td>
<a target="_blank" href="{$imageSrc}">
<img src="{$imageSrc}" width="275px" border="0"/>
</a>
</td>
</tr>
<tr align="center">
<td>
<xsl:value-of select="Attachment/ContentType[contains(., 'image')]/../Name" />
</td>
</tr>
</xsl:if>
<xsl:if test="($attachmentCount &gt; $imageCount) or not($imageCount = 1)">
<tr align="center">
<td>
<table style="font-family:Arial,Verdana,Times;font-size:12px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px">
<xsl:for-each select="Attachment[position() mod 2 = 1]">
<tr align="left" bgcolor="white">
<xsl:if test="(position() +1) mod 2">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$alternateRowColor"/>
</xsl:attribute>
</xsl:if>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="FilePath"/>
</xsl:attribute>
<xsl:value-of select="Name" />
</a>
</td>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="following-sibling::Attachment/FilePath"/>
</xsl:attribute>
<xsl:value-of select="following-sibling::Attachment/Name" />
</a>
</td>
</tr>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</xsl:template>

<xsl:template match="Field">
<tr>
<xsl:if test="(position() +1) mod 2">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$alternateRowColor"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FieldName">
<td>
<xsl:value-of select="FieldName"/>
</td>
</xsl:if>
<td>
<xsl:choose>
<xsl:when test="FieldValue[starts-with(., 'www.')]">
<a target="_blank">
<xsl:attribute name="href">http://<xsl:value-of select="FieldValue"/>
</xsl:attribute>
<xsl:value-of select="FieldValue"/>
</a>
</xsl:when>
<xsl:when test="FieldValue[starts-with(., 'http:')]">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="FieldValue"/>
</xsl:attribute>
<xsl:value-of select="FieldValue"/>
</a>
</xsl:when>
<xsl:when test="FieldValue[starts-with(., 'https:')]">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="FieldValue"/>
</xsl:attribute>
<xsl:value-of select="FieldValue"/>
</a>
</xsl:when>
<xsl:when test="FieldValue[starts-with(., '\\')]">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="FieldValue"/>
</xsl:attribute>
<xsl:value-of select="FieldValue"/>
</a>
</xsl:when>
<xsl:when test="FieldValue[starts-with(., '&lt;img ')]">
<xsl:value-of select="FieldValue" disable-output-escaping="yes" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="FieldValue"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
Loading

0 comments on commit 9e22497

Please sign in to comment.