WaypointReplacement.xml

Page auto-generated from XML file.

Failure

The generated TethysL source could not be parsed, likely due to source XML not being well-formed.

Below is the compile error at the TethysL level, as well as the source XML.

The TethysL file name shown below does not necessarily indicate the file exists, but hints about the actual corresponding .xml file.

Syntax error:
   --> lrauv-application/Missions/Deprecated/BehaviorScripts/WaypointReplacement.xml:11:46
    | 
  7 | # -   Export Administration Act of 1979 (Title 50, U.S.C., App. 2401 et seq.), as
  8 | # -   amended. Violations of these export laws are subject to severe civil and/or
  9 | # -   criminal penalties.
 10 | 
 11 | # NOTE: DefineBehavior NOT handled by TethysL
Unexpected: end-of-input
One of the following is possible:
  aggregate
  mission
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# -   Copyright (c) 2024 MBARI
# -   MBARI Proprietary Information. Confidential. All Rights Reserved
# -   Unauthorized copying or distribution of this file via any medium is strictly
# -   prohibited.
# -
# -   WARNING - This file contains information whose export is restricted by the
# -   Export Administration Act of 1979 (Title 50, U.S.C., App. 2401 et seq.), as
# -   amended. Violations of these export laws are subject to severe civil and/or
# -   criminal penalties.

# NOTE: DefineBehavior NOT handled by TethysL
  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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
<?xml version="1.0" encoding="UTF-8"?>
<!--
-   Copyright (c) 2024 MBARI
-   MBARI Proprietary Information. Confidential. All Rights Reserved
-   Unauthorized copying or distribution of this file via any medium is strictly
-   prohibited.
-
-   WARNING - This file contains information whose export is restricted by the
-   Export Administration Act of 1979 (Title 50, U.S.C., App. 2401 et seq.), as
-   amended. Violations of these export laws are subject to severe civil and/or
-   criminal penalties.
-->

<DefineBehavior xmlns="Tethys"
       xmlns:Control="Tethys/Control"
       xmlns:Guidance="Tethys/Guidance" 
       xmlns:Units="Tethys/Units"
       xmlns:Universal="Tethys/Universal"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="Tethys http://okeanids.mbari.org/tethys/Xml/Tethys.xsd
                           Tethys/Control http://okeanids.mbari.org/tethys/Xml/Control.xsd
                           Tethys/Guidance http://okeanids.mbari.org/tethys/Xml//Guidance.xsd
                           Tethys/Units http://okeanids.mbari.org/tethys/Xml/Units.xsd
                           Tethys/Universal http://okeanids.mbari.org/tethys/Xml/Universal.xsd"
       Name="Waypoint" Language="Lua">

    <Description>
        Simple example replacement for Waypoint behavior. Only takes two
        settings: latitude and longitude
    </Description>

    <DefineSetting Name="latitudeSet">
        <Guidance:Waypoint.latitude/>
        <Description>
            Goal latitude.
        </Description><Units:radian/>
        <DefaultValue>NaN</DefaultValue>
    </DefineSetting>

    <DefineSetting Name="longitudeSet">
        <Guidance:Waypoint.longitude/>
        <Description>
            Goal longitude.
        </Description><Units:radian/>
        <DefaultValue>NaN</DefaultValue>
    </DefineSetting>

    <Construct>
        <Description>
            Define functions for use in the behavior
        </Description>
        <Script><![CDATA[
           function GetBearing( lat0, lon0, lat1, lon1 )
               local y = math.sin( lon1 - lon0 ) * math.cos( lat1 )
               local x = math.cos( lat0 ) * math.sin( lat1 ) - math.sin( lat0 ) * math.cos( lat1 ) * math.cos( lon1 - lon0 )
               return math.atan2( y, x )
           end
           return "Constructed Waypoint", "IMPORTANT"
        ]]></Script>
    </Construct>

    <Initialize>
        <Input Name="latitude"><Universal:latitude/><Units:radian/><DefaultValue>NaN</DefaultValue></Input>
        <Input Name="longitude"><Universal:longitude/><Units:radian/><DefaultValue>NaN</DefaultValue></Input>
        <Script><![CDATA[
           if latitudeSet==latitudeSet then 
               goalLat = latitudeSet
           else 
               goalLat = latitude
           end
           if longitudeSet==longitudeSet then 
               goalLon = longitudeSet
           else 
               goalLon = longitude
           end
           goalBear = GetBearing(latitude,longitude,goalLat,goalLon)
           if goalLat ~= latitude then
               perpendicularSlope = -( goalLon - longitude ) / ( goalLat - latitude )
               startOverLine = latitude > ( goalLat + ( ( longitude - goalLon ) * perpendicularSlope ) )
           else
               perpendicularSlope = nil
               startOverLine = longitude > goalLon
           end
        ]]></Script>
    </Initialize>

    <Run>
        <Output><Control:HorizontalControl.horizontalMode/><Units:enum/></Output>
        <Output><Control:HorizontalControl.latitudeCmd/><Units:radian/></Output>
        <Output><Control:HorizontalControl.longitudeCmd/><Units:radian/></Output>
        <Output><Control:HorizontalControl.bearingCmd/><Units:radian/></Output>
        <Script><![CDATA[
           return 1.0, goalLat, goalLon, goalBear;
        ]]></Script>
    </Run>

    <IsSatisfied>
        <Input Name="latitude"><Universal:latitude/><Units:radian/><DefaultValue>NaN</DefaultValue></Input>
        <Input Name="longitude"><Universal:longitude/><Units:radian/><DefaultValue>NaN</DefaultValue></Input>
        <Script><![CDATA[
           if perpendicularSlope ~= nil then
               isOverLine = latitude > (goalLat
                             + ( ( longitude - goalLon ) * perpendicularSlope))
           else
               isOverLine = longitude > goalLon;
           end
           return isOverLine ~= startOverLine
        ]]></Script>
    </IsSatisfied>

</DefineBehavior>