####################################################################################################
#
# Invoking X3D model self-test:
#
#   $ python AmphibiousRaidWithCommunications.py
#
# Python package x3d.py package is available on PyPI for import.
#   This approach simplifies Python X3D deployment and use.
#   https://pypi.org/project/x3d
#
# Installation:
#       pip install x3d
# or
#       python -m pip install x3d
#
# Developer options for loading x3d package in other Python programs:
#
#    from x3d import *  # preferred approach, terser source that avoids x3d.* class prefixes
#
# or
#    import x3d         # traditional way to subclass x3d package, all classes require x3d.* prefix,
#                       # but python source is very verbose, for example x3d.Material x3d.Shape etc.
#                       # X3dToPython.xslt stylesheet insertPackagePrefix=true supports this option.
#
# Project home page:    # X3D Python Scene Access Interface Library (X3DPSAIL)
#                       # https://www.web3d.org/x3d/stylesheets/python/python.html
# Conversion generator: # https://www.web3d.org/x3d/stylesheets/X3dToPython.xslt
#
####################################################################################################

from x3d import *

newModel=X3D(profile='Immersive',version='3.0',
  head=head(
    children=[
    meta(content='AmphibiousRaidWithCommunications.x3d',name='title'),
    meta(content='Amphibious Raid shows an exemplar amphibious raid at Red Beach, Camp Pendleton California. It is the primary scenario for the SAVAGE group.',name='description'),
    meta(content='Don Brutzman, Curtis Blais, Jeff Weekley, Jane Wu, Shane Nicklaus, MIke Hunsberger',name='creator'),
    meta(content='9 April 2001',name='created'),
    meta(content='28 January 2024',name='modified'),
    meta(content='https://www.web3d.org/x3d/content/examples/Savage/Scenarios/AmphibiousRaidCampPendleton/AmphibiousRaidWithCommunications.x3d',name='identifier'),
    meta(content='https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolator.x3d',name='reference'),
    meta(content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit',name='generator'),
    meta(content='../../license.html',name='license')]),
  Scene=Scene(
    children=[
    Comment(' Prototype and external prototype declarations must precede scene definition '),
    WorldInfo(title='AmphibiousRaidWithCommunications.x3d'),
    ExternProtoDeclare(name='SuperCobra',url=["../../AircraftHelicopters/AH1SuperCobraUnitedStates/SuperCobraPrototype.x3d#SuperCobra","https://www.web3d.org/x3d/content/examples/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/SuperCobraPrototype.x3d#SuperCobra","../../AircraftHelicopters/AH1SuperCobraUnitedStates/SuperCobraPrototype.wrl#SuperCobra","https://www.web3d.org/x3d/content/examples/Savage/AircraftHelicopters/AH1SuperCobraUnitedStates/SuperCobraPrototype.wrl#SuperCobra"],
      field=[
      field(accessType='initializeOnly',name='tailBoomColor',type='SFNode'),
      field(accessType='initializeOnly',name='tailRotorDriveShaftColor',type='SFNode'),
      field(accessType='initializeOnly',name='horizontalStabilizerColor',type='SFNode'),
      field(accessType='initializeOnly',name='fuselageColor',type='SFNode'),
      field(accessType='initializeOnly',name='cockpitColor',type='SFNode'),
      field(accessType='initializeOnly',name='cowlingColor',type='SFNode'),
      field(accessType='initializeOnly',name='helicopterName',type='SFString'),
      field(accessType='inputOnly',name='inFlight',type='SFBool')]),
    ExternProtoDeclare(appinfo='Circular set of compass bearings that follow the active viewpoint set at 360/36 = 10 degree intervals. North = +X axis East = +Z axis up = +Y axis.',name='CameraCompass36',url=["../../../Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.x3d#CameraCompass36","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.x3d#CameraCompass36","../../../Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.wrl#CameraCompass36","https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/CameraCompassPrototypes.wrl#CameraCompass36"],
      field=[
      field(accessType='inputOutput',name='enabled',type='SFBool'),
      field(accessType='inputOutput',name='positionOffsetFromCamera',type='SFVec3f'),
      field(accessType='inputOutput',name='markerColor',type='SFColor'),
      field(accessType='inputOutput',name='labelColor',type='SFColor')]),
    ExternProtoDeclare(appinfo='Hidden viewpoint becomes active (binds) upon pointer selection to reveal an interesting view with an optionally label',name='HiddenViewpoint',url=["../../../Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/HiddenViewpointPrototype.x3d#HiddenViewpoint","../../../Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/HiddenViewpointPrototype.wrl#HiddenViewpoint"],
      field=[
      field(accessType='inputOutput',name='position',type='SFVec3f'),
      field(accessType='inputOutput',name='rotation',type='SFRotation'),
      field(accessType='initializeOnly',name='sensorRadius',type='SFFloat'),
      field(accessType='inputOutput',name='label',type='MFString'),
      field(accessType='inputOutput',name='labelOffset',type='SFVec3f'),
      field(accessType='initializeOnly',name='labelFontSize',type='SFFloat'),
      field(accessType='inputOutput',name='labelColor',type='SFColor'),
      field(accessType='inputOnly',name='activate',type='SFBool')]),
    ExternProtoDeclare(appinfo='Omnidirectional hemispherical receiver.',name='OmniReceiver',url=["../../CommunicationsAndSensors/OmniDirectional/OmniReceiverPrototype.x3d#OmniReceiver","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/OmniDirectional/OmniReceiverPrototype.x3d#OmniReceiver","../../CommunicationsAndSensors/OmniDirectional/OmniReceiverPrototype.wrl#OmniReceiver","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/OmniDirectional/OmniReceiverPrototype.wrl#OmniReceiver"],
      field=[
      field(accessType='initializeOnly',appinfo='units Hertz',name='frequency',type='SFInt32'),
      field(accessType='inputOutput',name='transparency',type='SFFloat'),
      field(accessType='inputOutput',name='emissiveColor',type='SFColor'),
      field(accessType='inputOutput',name='ambientIntensity',type='SFFloat'),
      field(accessType='inputOutput',name='shininess',type='SFFloat'),
      field(accessType='inputOutput',name='diffuseColor',type='SFColor')]),
    ExternProtoDeclare(appinfo='Omnidirectional hemispherical transmitter.',name='OmniTransmitter',url=["../../CommunicationsAndSensors/OmniDirectional/OmniTransmitterPrototype.x3d#OmniTransmitter","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/OmniDirectional/OmniTransmitterPrototype.x3d#OmniTransmitter","../../CommunicationsAndSensors/OmniDirectional/OmniTransmitterPrototype.wrl#OmniTransmitter","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/OmniDirectional/OmniTransmitterPrototype.wrl#OmniTransmitter"],
      field=[
      field(accessType='initializeOnly',appinfo='units Hertz',name='frequency',type='SFInt32'),
      field(accessType='inputOutput',name='transparency',type='SFFloat'),
      field(accessType='inputOutput',name='emissiveColor',type='SFColor'),
      field(accessType='inputOutput',name='ambientIntensity',type='SFFloat'),
      field(accessType='inputOutput',name='shininess',type='SFFloat'),
      field(accessType='inputOutput',name='diffuseColor',type='SFColor')]),
    ExternProtoDeclare(appinfo='SatellitePair consists of two TRC170 dishes for long range (up to 100 mile) point-to-point communication. TRC170s can be used in 3 different settings. The first is a direct link of up to 30 miles. The second is a defraction setting over an obstruction in the path. The third is a tropospheric scatter shot of up to 100 miles in which the signal is bounced off the troposphere. This PROTO allows specification for the initial placement of each TSSR. It automatically calculates the correct angle to complete the link.',name='SatellitePair',url=["../../CommunicationsAndSensors/Satellite/SatellitePairPrototype.x3d#SatellitePair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Satellite/SatellitePairPrototype.x3d#SatellitePair","../../CommunicationsAndSensors/Satellite/SatellitePairPrototype.wrl#SatellitePair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/Satellite/SatellitePairPrototype.wrl#SatellitePair"],
      field=[
      field(accessType='initializeOnly',name='GroundLocation',type='SFVec3f'),
      field(accessType='initializeOnly',name='SatelliteLocation',type='SFVec3f')]),
    ExternProtoDeclare(name='TRC170Pair',url=["../../CommunicationsAndSensors/TRC170/TRC170PairPrototype.x3d#TRC170Pair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TRC170/TRC170PairPrototype.x3d#TRC170Pair","../../CommunicationsAndSensors/TRC170/TRC170PairPrototype.wrl#TRC170Pair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TRC170/TRC170PairPrototype.wrl#TRC170Pair"],
      field=[
      field(accessType='initializeOnly',name='TRC1Location',type='SFVec3f'),
      field(accessType='initializeOnly',name='TRC2Location',type='SFVec3f'),
      field(accessType='initializeOnly',name='OperatingMode',type='SFString')]),
    ExternProtoDeclare(name='TSSRPair',url=["../../CommunicationsAndSensors/TSSR/TSSRPairPrototype.x3d#TSSRPair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRPairPrototype.x3d#TSSRPair","../../CommunicationsAndSensors/TSSR/TSSRPairPrototype.wrl#TSSRPair","https://www.web3d.org/x3d/content/examples/Savage/CommunicationsAndSensors/TSSR/TSSRPairPrototype.wrl#TSSRPair"],
      field=[
      field(accessType='initializeOnly',name='TSSR1Location',type='SFVec3f'),
      field(accessType='initializeOnly',name='TSSR2Location',type='SFVec3f')]),
    ExternProtoDeclare(appinfo='ViewPositionOrientation provides provides console output of local position and orientation as user navigates',name='ViewPositionOrientation',url=["../../Tools/Authoring/ViewPositionOrientationPrototype.x3d#ViewPositionOrientation","https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/ViewPositionOrientationPrototype.x3d#ViewPositionOrientation","../../Tools/Authoring/ViewPositionOrientationPrototype.wrl#ViewPositionOrientation","https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/ViewPositionOrientationPrototype.wrl#ViewPositionOrientation"],
      field=[
      field(accessType='inputOutput',appinfo='Whether or not ViewPositionOrientation sends output to console.',name='enabled',type='SFBool'),
      field(accessType='initializeOnly',appinfo='Output internal trace messages for debugging this node - developer use only can be ignored.',name='traceEnabled',type='SFBool'),
      field(accessType='inputOnly',appinfo='Ability to turn output tracing on/off at runtime.',name='set_traceEnabled',type='SFBool'),
      field(accessType='outputOnly',appinfo='Output local position.',name='position_changed',type='SFVec3f'),
      field(accessType='outputOnly',appinfo='Output local orientation.',name='orientation_changed',type='SFRotation'),
      field(accessType='outputOnly',appinfo='MFString value of new Viewpoint',name='outputViewpointString',type='MFString')]),
    ExternProtoDeclare(appinfo='Reads waypoints and legSpeeds/legDurations/defaultSpeed to provide a customizable position/orientation interpolator.',name='WaypointInterpolator',url=["../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.x3d#WaypointInterpolator","../../../Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator","https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/WaypointInterpolatorPrototype.wrl#WaypointInterpolator"],
      # Priority of use: legSpeeds (m/sec), legDurations (seconds), defaultSpeed (m/sec)

      field(accessType='initializeOnly',appinfo='Short description of what is animated by this WaypointInterpolator.',name='description',type='SFString'),
      field(accessType='initializeOnly',appinfo='Waypoints being traversed with interpolation of intermediate positions and orientations.',name='waypoints',type='MFVec3f'),
      field(accessType='inputOnly',appinfo='Add another single waypoint to array of waypoints recalculate interpolator values.',name='add_waypoint',type='SFVec3f'),
      field(accessType='inputOnly',appinfo='Replace all waypoints recalculate interpolator values.',name='set_waypoints',type='MFVec3f'),
      field(accessType='initializeOnly',appinfo='Whether to pitch child geometry (such as a vehicle) up or down to match vertical slope',name='pitchUpDownForVerticalWaypoints',type='SFBool'),
      field(accessType='initializeOnly',appinfo='Units m/sec. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints.',name='legSpeeds',type='MFFloat'),
      field(accessType='initializeOnly',appinfo='Units in seconds. If used array lengths for legSpeeds and legDurations must be one less than number of waypoints.',name='legDurations',type='MFTime'),
      field(accessType='initializeOnly',appinfo='Units m/sec.',name='defaultSpeed',type='SFFloat'),
      field(accessType='initializeOnly',appinfo='turningRate (degrees/second) also determines standoff distance prior to waypoint where turn commences. If 0 turns are instantaneous.',name='turningRate',type='SFFloat'),
      field(accessType='outputOnly',appinfo='Output calculation summing all leg durations, useful for setting TimeSensor cycleInterval. Units in seconds.',name='totalDuration',type='SFTime'),
      # interpolation fields

      field(accessType='inputOnly',appinfo='exposed PositionInterpolator and OrientationInterpolator setting',name='set_fraction',type='SFFloat'),
      field(accessType='outputOnly',appinfo='exposed PositionInterpolator setting',name='position_changed',type='SFVec3f'),
      field(accessType='outputOnly',appinfo='exposed OrientationInterpolator setting',name='orientation_changed',type='SFRotation'),
      # display-related fields

      field(accessType='inputOutput',appinfo='default color for non-active line segments',name='lineColor',type='SFColor'),
      field(accessType='inputOutput',appinfo='active segment highlight color',name='highlightSegmentColor',type='SFColor'),
      field(accessType='inputOutput',appinfo='1.0 is completely transparent, 0.0 is completely opaque.',name='transparency',type='SFFloat'),
      field(accessType='initializeOnly',appinfo='allowed values: none; waypoints (produce labels at each waypoint); or interpolation (produce single moving label at interpolator time course speed location)',name='labelDisplayMode',type='SFString'),
      field(accessType='initializeOnly',appinfo='allowed values: altitude depth (negate Y value) none',name='heightLabel',type='SFString'),
      field(accessType='initializeOnly',appinfo='heightLabel relative location',name='labelOffset',type='SFVec3f'),
      field(accessType='initializeOnly',appinfo='heightLabel text size',name='labelFontSize',type='SFFloat'),
      field(accessType='initializeOnly',appinfo='heightLabel text color',name='labelColor',type='SFColor'),
      field(accessType='initializeOnly',appinfo='enable console output to trace script computations and prototype progress',name='traceEnabled',type='SFBool'),
      field(accessType='initializeOnly',appinfo='Output the number of waypoints totalDistance and totalDuration to console upon initialization',name='outputInitializationComputations',type='SFBool'),
      field(accessType='inputOutput',appinfo='default color for vertical drop-line segments',name='verticalDropLineColor',type='SFColor'),
      field(accessType='inputOutput',appinfo='1.0 is completely transparent, 0.0 is completely opaque.',name='verticalDropLineTransparency',type='SFFloat')]),
    Comment(' ================= '),
    NavigationInfo(avatarSize=[2,2,2],speed=100,visibilityLimit=60000),
    Viewpoint(description='Amphibious raid - full scenario seen from above',orientation=(-0.557,-0.799,-0.229,0.9506),position=(-600,10000,25000)),
    Viewpoint(description='1000m elevation view',orientation=(0,1,0,-0.78),position=(-200,1000,22000)),
    Viewpoint(description='high above comm',orientation=(0,-1,0,.2865),position=(14946.4,6632,28678.4)),
    Transform(rotation=(0,0,1,.1),
      children=[
      Viewpoint(description='Waypoint',orientation=(0,1,0,1.57),position=(9451,20,14935)),
      Viewpoint(description='waypoint 2',orientation=(0,1,0,1.57),position=(11217.2,10.0,13996.6))]),
    Comment(' ViewPositionOrientation is a prototype lets us find good viewpoints for inclusion in the scene '),
    ProtoInstance(DEF='ConsoleOutputViewPositionOrientation',name='ViewPositionOrientation',
      fieldValue=[
      fieldValue(name='enabled',value=True)]),
    ProtoInstance(name='CameraCompass36',
      fieldValue=[
      fieldValue(name='enabled',value=True),
      fieldValue(name='positionOffsetFromCamera',value=(0,5,0)),
      fieldValue(name='markerColor',value=(0.9,0.9,0.9)),
      fieldValue(name='labelColor',value=(0.9,0.9,0.9))]),
    ProtoInstance(DEF='CobraCapStartingPoint',name='HiddenViewpoint',
      fieldValue=[
      fieldValue(name='position',value=(6530,18,16800)),
      fieldValue(name='rotation',value=(0,1,0,-0.1)),
      fieldValue(name='sensorRadius',value=100),
      fieldValue(name='label',value=["Cobra CAP","starting point","","6530 11.5 16800"]),
      fieldValue(name='labelOffset',value=(0,-2,0)),
      fieldValue(name='labelFontSize',value=0.5),
      fieldValue(name='labelColor',value=(1,0.5,0))]),
    ProtoInstance(DEF='CobraCapInitialClimb',name='HiddenViewpoint',
      fieldValue=[
      fieldValue(name='position',value=(6530,500,16800)),
      fieldValue(name='rotation',value=(0,1,0,-0.4)),
      fieldValue(name='sensorRadius',value=100),
      fieldValue(name='label',value=["Cobra CAP","initial climb point","","6530 500 16800"]),
      fieldValue(name='labelOffset',value=(0,1,0)),
      fieldValue(name='labelFontSize',value=0.5),
      fieldValue(name='labelColor',value=(1,0.5,0))]),
    ProtoInstance(DEF='SouthernCapTurnPoint',name='HiddenViewpoint',
      fieldValue=[
      fieldValue(name='position',value=(25400,500,19100)),
      fieldValue(name='rotation',value=(0,1,0,0.4)),
      fieldValue(name='sensorRadius',value=200),
      fieldValue(name='label',value=["Cobra CAP","Southern Turn Point","","25400 500 191000"]),
      fieldValue(name='labelOffset',value=(0,1,0)),
      fieldValue(name='labelFontSize',value=0.5),
      fieldValue(name='labelColor',value=(1,0.5,0))]),
    ProtoInstance(DEF='NorthernCapTurnPoint',name='HiddenViewpoint',
      fieldValue=[
      fieldValue(name='position',value=(5100,500,700)),
      fieldValue(name='rotation',value=(0,1,0,-2.3)),
      fieldValue(name='sensorRadius',value=200),
      fieldValue(name='label',value=["Cobra CAP","Northern Turn Point","","5100 500 700"]),
      fieldValue(name='labelOffset',value=(0,1,0)),
      fieldValue(name='labelFontSize',value=0.5),
      fieldValue(name='labelColor',value=(1,0.5,0))]),
    Switch(whichChoice=0,
      children=[
      Comment(' Main group with all players. '),
      Group(DEF='EntireScene',
        children=[
        Comment(' ==================== Land terrain ==================== '),
        Transform(
          children=[
          Inline(url=["../../Locations/CampPendletonCalifornia/CampPendletonOperatingAreasExample.x3d","https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/CampPendletonOperatingAreasExample.x3d","../../Locations/CampPendletonCalifornia/CampPendletonOperatingAreasExample.wrl","https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/CampPendletonOperatingAreasExample.wrl"])]),
        Comment(' ==================== Ships ==================== '),
        Comment(' LPD is anchored and not moving. '),
        Transform(DEF='LPD',translation=(6600,10,16800),
          children=[
          Inline(url=["../../ShipsMilitary/LandingPlatformDockLPD/LPD.x3d","https://www.web3d.org/x3d/content/examples/Savage/ShipsMilitary/LandingPlatformDockLPD/LPD.x3d","../../ShipsMilitary/LandingPlatformDockLPD/LPD.wrl","https://www.web3d.org/x3d/content/examples/Savage/ShipsMilitary/LandingPlatformDockLPD/LPD.wrl"]),
          Transform(scale=(50,50,50),translation=(-30,14,0),
            children=[
            ProtoInstance(name='OmniTransmitter',
              fieldValue=[
              fieldValue(name='frequency',value=40000)])]),
          Transform(translation=(30,14,0),
            children=[
            ProtoInstance(name='SatellitePair',
              fieldValue=[
              fieldValue(name='GroundLocation',value=(0,0,0)),
              fieldValue(name='SatelliteLocation',value=(6500000,42000000,-12500000))])])]),
        Comment(' ==================== Amphibious vehicles ==================== '),
        Comment(' Most entity transforms will get converted to DIS-Java-VRML EspduTransforms when creating a networked DIS version. '),
        Transform(DEF='AAAV-Location',translation=(6600,0,16800),
          children=[
          Viewpoint(description='Triple AAAV Raid',orientation=(0,1,0,-1.57),position=(-40,2,0)),
          Viewpoint(description='Triple AAAV Raid',orientation=(0,1,0,1.57),position=(50,12,0)),
          Transform(translation=(0,-4,0),
            children=[
            Inline(DEF='AAAV',url=["../../AmphibiousVehicles/AAAV/AAAV.x3d","https://www.web3d.org/x3d/content/examples/Savage/AmphibiousVehicles/AAAV/AAAV.x3d","../../AmphibiousVehicles/AAAV/AAAV.wrl","https://www.web3d.org/x3d/content/examples/Savage/AmphibiousVehicles/AAAV/AAAV.wrl"]),
            Transform(scale=(10,10,10),translation=(-2,5,1.5),
              children=[
              ProtoInstance(name='OmniReceiver',
                fieldValue=[
                fieldValue(name='frequency',value=40000)])]),
            Transform(rotation=(0,1,0,1.57),scale=(2,2,2),translation=(-2,5,-1.5),
              children=[
              ProtoInstance(name='OmniTransmitter',
                fieldValue=[
                fieldValue(name='frequency',value=35000000)])])]),
          Group(
            children=[
            Transform(translation=(-15,-4,-17.5),
              children=[
              Transform(DEF='AAAV-3',
                children=[
                Inline(USE='AAAV'),
                PositionInterpolator(DEF='AAV-3PATH',key=[0.00,0.07,0.13,0.22,0.36,0.47,0.55,0.625,0.66,0.72,0.80,0.85,0.99],keyValue=[(0.0,0.0,0.0),(1.0,0.96,1.0),(1.5,0.21,2.25),(2.0,0.46,2.66),(3.0,-0.25,3.0),(2.5,0.96,3.0),(1.75,0.41,3.0),(1.0,0.96,3.0),(3.0,0.0,3.0),(2.0,0.46,2.0),(1.0,0.4,1.5),(0.0,0.46,1.0),(0.0,0.0,0.0)]),
                Transform(scale=(2,2,2),translation=(-2,5,-1.5),
                  children=[
                  ProtoInstance(name='OmniReceiver',
                    fieldValue=[
                    fieldValue(name='frequency',value=35000000)])])])]),
            Transform(translation=(-15,-4,15),
              children=[
              Transform(DEF='AAAV-2',
                children=[
                Inline(USE='AAAV'),
                PositionInterpolator(DEF='AAV-2PATH',key=[0.00,0.11,0.17,0.22,0.33,0.44,0.50,0.55,0.66,0.77,0.83,0.88,0.99],keyValue=[(0.0,0.0,0.0),(1.0,0.96,1.0),(1.5,0.21,1.5),(2.0,0.96,2.0),(3.0,0.0,3.0),(2.5,0.96,3.0),(1.75,0.41,3.0),(1.0,0.96,3.0),(3.0,0.0,3.0),(2.0,0.46,2.0),(1.0,0.4,1.5),(0.0,0.46,1.0),(0.0,0.0,0.0)]),
                Transform(scale=(2,2,2),translation=(-2,5,-1.5),
                  children=[
                  ProtoInstance(name='OmniReceiver',
                    fieldValue=[
                    fieldValue(name='frequency',value=35000000)])])])])])]),
        Comment(' AAAV-1 Block '),
        ProtoInstance(DEF='AAAV_1_WaypointInterpolator',name='WaypointInterpolator',
          children=[
          Comment(' need to improve elevations on beach (final waypoint) '),
          fieldValue(name='description',value='AAAV_1_WaypointInterpolator'),
          fieldValue(name='waypoints',value=[(6802,1,16343),(7685.0,1.0,15873.7),(8568.1,1.0,15404.4),(9451.1,1.0,14935.2),(10334.2,1.0,14465.9),(11217.2,1.0,13996.6),(12100.3,1.0,13527.3),(12983.3,1.0,13058.0),(13866.4,1.0,12588.7),(14749.4,1.0,12119.5),(15632.5,1.0,11650.2),(16515.5,1.0,11180.9),(17398.6,1.0,10711.6),(18281.6,1.0,10242.3),(19164.7,1.0,9773.1),(19400.0,1.0,9648.0),(19782,1,9185),(20100,10,8800)]),
          Comment(' 1 knot = 0.514444444 meters/second '),
          fieldValue(name='defaultSpeed',value=50),
          fieldValue(name='lineColor',value=(0.8,0.8,0)),
          fieldValue(name='labelColor',value=(0.8,0.8,0)),
          fieldValue(name='labelOffset',value=(0,3,0)),
          fieldValue(name='labelFontSize',value=1.5),
          fieldValue(name='traceEnabled',value=False)]),
        TimeSensor(DEF='AAAV1_Clock',loop=True),
        Comment(' ==================== Helicopter 1 Block ==================== '),
        Transform(DEF='Helo-1',translation=(6530,11.5,16800),
          children=[
          ProtoInstance(DEF='HeloInstance1',name='SuperCobra',
            fieldValue=[
            fieldValue(name='helicopterName',value='Cobra CAP 1'),
            fieldValue(name='tailBoomColor',
              children=[
              Appearance(DEF='GREY_APPEARANCE',
                material=Material(diffuseColor=(0.5,0.5,0.5)))]),
            fieldValue(name='tailRotorDriveShaftColor',
              children=[
              Appearance(USE='GREY_APPEARANCE')]),
            fieldValue(name='horizontalStabilizerColor',
              children=[
              Appearance(
                material=Material(diffuseColor=(0.5,0.5,0.5)))]),
            fieldValue(name='fuselageColor',
              children=[
              Appearance(
                material=Material(diffuseColor=(0.6,0.6,0.6)))]),
            fieldValue(name='cockpitColor',
              children=[
              Appearance(
                material=Material(diffuseColor=(0.6,0.6,0.6)))]),
            fieldValue(name='cowlingColor',
              children=[
              Appearance(
                material=Material(diffuseColor=(0.5,0.5,0.5)))])])]),
        ProtoInstance(DEF='Helo_1_WaypointInterpolator',name='WaypointInterpolator',
          fieldValue=[
          fieldValue(name='description',value='Helo_1_WaypointInterpolator'),
          fieldValue(name='waypoints',value=[(6600,600,16800),(7592.6,600,16921.4),(8585.2,600,17042.9),(9577.8,600,17164.3),(10570.4,600,17285.7),(11563.0,600,17407.2),(12555.6,600,17528.6),(13548.2,600,17650.0),(14540.8,600,17771.5),(15533.4,600,17892.9),(16526.0,600,18014.4),(17518.6,600,18135.8),(18511.2,600,18257.2),(19503.8,600,18378.7),(20496.4,600,18500.1),(21489.0,600,18621.5),(22481.6,600,18743.0),(23474.2,600,18864.4),(24466.8,600,18985.8),(25400,600,19100),(24906.2,600,18230.4),(24412.4,600,17360.9),(23918.5,600,16491.3),(23424.7,600,15621.8),(22930.9,600,14752.2),(22437.1,600,13882.6),(21943.2,600,13013.1),(21449.4,600,12143.5),(20955.6,600,11273.9),(20800,600,11000),(20072.7,600,10313.7),(19345.4,600,9627.4),(18618.1,600,8941.0),(17890.8,600,8254.7),(17163.5,600,7568.4),(16436.2,600,6882.1),(15708.9,600,6195.7),(14981.6,600,5509.4),(14254.3,600,4823.1),(13700,600,4300),(12777.6,600,3913.9),(11855.1,600,3527.7),(10932.7,600,3141.6),(10010.2,600,2755.4),(9087.8,600,2369.3),(8165.4,600,1983.2),(7242.9,600,1597.0),(6320.5,600,1210.9),(5398.0,600,824.8),(5100,600,700),(5192.8,600,1695.7),(5285.5,600,2691.4),(5378.3,600,3687.1),(5471.1,600,4682.8),(5563.8,600,5678.4),(5656.6,600,6674.1),(5749.4,600,7669.8),(5842.1,600,8665.5),(5934.9,600,9661.2),(6027.7,600,10656.9),(6120.4,600,11652.6),(6213.2,600,12648.3),(6306.0,600,13643.9),(6398.7,600,14639.6),(6491.5,600,15635.3),(6584.3,600,16631.0),(6600,600,16800)]),
          Comment(' 1 knot = 0.514444444 meters/second '),
          fieldValue(name='defaultSpeed',value=100),
          fieldValue(name='pitchUpDownForVerticalWaypoints',value=False),
          fieldValue(name='lineColor',value=(0,0.8,0)),
          fieldValue(name='labelColor',value=(0,0.8,0)),
          fieldValue(name='labelOffset',value=(0,5,0)),
          fieldValue(name='labelFontSize',value=3),
          fieldValue(name='traceEnabled',value=False)]),
        TimeSensor(DEF='Helo1_Clock',loop=True),
        Comment(' ==================== Helicopter 2 Block ==================== '),
        Transform(DEF='Helo-2',translation=(6600,50,16800),
          children=[
          Transform(
            children=[
            ProtoInstance(DEF='HeloInstance2',name='SuperCobra',
              fieldValue=[
              fieldValue(name='helicopterName',value='Cobra CAP 2'),
              fieldValue(name='tailBoomColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.5,0.5,0.5)))]),
              fieldValue(name='tailRotorDriveShaftColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.5,0.5,0.5)))]),
              fieldValue(name='horizontalStabilizerColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.5,0.5,0.5)))]),
              fieldValue(name='fuselageColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.6,0.6,0.6)))]),
              fieldValue(name='cockpitColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.6,0.6,0.6)))]),
              fieldValue(name='cowlingColor',
                children=[
                Appearance(
                  material=Material(diffuseColor=(0.5,0.5,0.5)))])])])]),
        ProtoInstance(DEF='Helo_2_WaypointInterpolator',name='WaypointInterpolator',
          fieldValue=[
          fieldValue(name='description',value='Helo_2_WaypointInterpolator'),
          fieldValue(name='waypoints',value=[(6530,11.5,16800),(6530,500,16800),(6600,500,16800),(7592.6,500,16921.4),(8585.2,500,17042.9),(9577.8,500,17164.3),(10570.4,500,17285.7),(11563.0,500,17407.2),(12555.6,500,17528.6),(13548.2,500,17650.0),(14540.8,500,17771.5),(15533.4,500,17892.9),(16526.0,500,18014.4),(17518.6,500,18135.8),(18511.2,500,18257.2),(19503.8,500,18378.7),(20496.4,500,18500.1),(21489.0,500,18621.5),(22481.6,500,18743.0),(23474.2,500,18864.4),(24466.8,500,18985.8),(25400,500,19100),(24906.2,500,18230.4),(24412.4,500,17360.9),(23918.5,500,16491.3),(23424.7,500,15621.8),(22930.9,500,14752.2),(22437.1,500,13882.6),(21943.2,500,13013.1),(21449.4,500,12143.5),(20955.6,500,11273.9),(20800,500,11000),(20072.7,500,10313.7),(19345.4,500,9627.4),(18618.1,500,8941.0),(17890.8,500,8254.7),(17163.5,500,7568.4),(16436.2,500,6882.1),(15708.9,500,6195.7),(14981.6,500,5509.4),(14254.3,500,4823.1),(13700,500,4300),(12777.6,500,3913.9),(11855.1,500,3527.7),(10932.7,500,3141.6),(10010.2,500,2755.4),(9087.8,500,2369.3),(8165.4,500,1983.2),(7242.9,500,1597.0),(6320.5,500,1210.9),(5398.0,500,824.8),(5100,500,700),(5192.8,500,1695.7),(5285.5,500,2691.4),(5378.3,500,3687.1),(5471.1,500,4682.8),(5563.8,500,5678.4),(5656.6,500,6674.1),(5749.4,500,7669.8),(5842.1,500,8665.5),(5934.9,500,9661.2),(6027.7,500,10656.9),(6120.4,500,11652.6),(6213.2,500,12648.3),(6306.0,500,13643.9),(6398.7,500,14639.6),(6491.5,500,15635.3),(6584.3,500,16631.0),(6600,500,16800)]),
          Comment(' 1 knot = 0.514444444 meters/second '),
          fieldValue(name='defaultSpeed',value=200),
          fieldValue(name='lineColor',value=(0.8,0,0)),
          fieldValue(name='labelColor',value=(0.8,0,0)),
          fieldValue(name='labelOffset',value=(0,5,0)),
          fieldValue(name='labelFontSize',value=3),
          fieldValue(name='traceEnabled',value=False)]),
        TimeSensor(DEF='Helo2_Clock',loop=True),
        Comment(' ============== AAV7PA1 '),
        Transform(DEF='AAV7PA1Location',scale=(1.25,1.25,1.25),translation=(6620,-2,16900),
          children=[
          Inline(url=["../../AmphibiousVehicles/AAV/AAV.x3d","https://www.web3d.org/x3d/content/examples/Savage/AmphibiousVehicles/AAV/AAV.x3d","../../AmphibiousVehicles/AAV/AAV.wrl","https://www.web3d.org/x3d/content/examples/Savage/AmphibiousVehicles/AAV/AAV.wrl"])]),
        ProtoInstance(DEF='AAV7PA1WaypointInterpolator',name='WaypointInterpolator',
          fieldValue=[
          fieldValue(name='description',value='AAV7PA1WaypointInterpolator'),
          fieldValue(name='waypoints',value=[(6620,-1,16900),(6720,-1,16900),(6870,-1,19500),(7400,-1,19500),(8400,-1,16900),(6620,-1,16900)]),
          Comment(' 1 knot = 0.514444444 meters/second '),
          fieldValue(name='defaultSpeed',value=5),
          fieldValue(name='lineColor',value=(0.8,0,0.65)),
          fieldValue(name='labelColor',value=(0.8,0,0)),
          fieldValue(name='labelOffset',value=(0,5,0)),
          fieldValue(name='labelFontSize',value=3),
          fieldValue(name='traceEnabled',value=False)]),
        TimeSensor(DEF='AAV7PA1Clock',loop=True),
        Transform(DEF='TSSRPair-1',
          children=[
          ProtoInstance(name='TSSRPair',
            fieldValue=[
            fieldValue(name='TSSR1Location',value=(24000,70,8800)),
            fieldValue(name='TSSR2Location',value=(21105,228,700))])]),
        Transform(DEF='TSSRPair-2',
          children=[
          ProtoInstance(name='TSSRPair',
            fieldValue=[
            fieldValue(name='TSSR1Location',value=(27600,25,15390)),
            fieldValue(name='TSSR2Location',value=(25500,100,10000))])]),
        Transform(DEF='TRCPair-1',
          children=[
          ProtoInstance(name='TRC170Pair',
            fieldValue=[
            fieldValue(name='TRC1Location',value=(27000,17,15400)),
            fieldValue(name='TRC2Location',value=(21083.7,227.1,715.2)),
            fieldValue(name='OperatingMode',value='TROPOSCATTER')])]),
        Transform(DEF='TRCPair-2',
          children=[
          ProtoInstance(name='TRC170Pair',
            fieldValue=[
            fieldValue(name='TRC1Location',value=(65500,17,-75400)),
            fieldValue(name='TRC2Location',value=(21065.7,227.1,735.2)),
            fieldValue(name='OperatingMode',value='TROPOSCATTER')])]),
        Transform(DEF='SatellitePair-1',
          children=[
          ProtoInstance(name='SatellitePair',
            fieldValue=[
            fieldValue(name='GroundLocation',value=(21065.7,227.1,785.2)),
            fieldValue(name='SatelliteLocation',value=(6500000,42000000,-12500000))])])]),
      Comment(' hide things here until ready to bring them into the active scene '),
      Switch(whichChoice=0,
        children=[
        Comment(' Ocean bathymetry '),
        Transform(rotation=(0,1,0,1.57079),translation=(11900,0,6000),
          children=[
          Inline(url=["../../Locations/CampPendletonCalifornia/ChartletTranscribed.x3d","https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/ChartletTranscribed.x3d","../../Locations/CampPendletonCalifornia/ChartletTranscribed.wrl","https://www.web3d.org/x3d/content/examples/Savage/Locations/CampPendletonCalifornia/ChartletTranscribed.wrl"])]),
        Comment(' GeoVrml versions will be here someday '),
        Group(
          children=[
          Comment(' Southwest corner reference point: 33:12N 117:38W '),
          Comment(' GeoLocation and USE EntireScene to follow '),],)])]),
    Comment(' AAAV-1 Waypoint Routes '),
    ROUTE(fromField='totalDuration',fromNode='AAAV_1_WaypointInterpolator',toField='cycleInterval',toNode='AAAV1_Clock'),
    ROUTE(fromField='fraction_changed',fromNode='AAAV1_Clock',toField='set_fraction',toNode='AAAV_1_WaypointInterpolator'),
    ROUTE(fromField='position_changed',fromNode='AAAV_1_WaypointInterpolator',toField='set_translation',toNode='AAAV-Location'),
    ROUTE(fromField='orientation_changed',fromNode='AAAV_1_WaypointInterpolator',toField='set_rotation',toNode='AAAV-Location'),
    Comment(' Helo-1 Waypoint Routes '),
    ROUTE(fromField='isActive',fromNode='Helo1_Clock',toField='inFlight',toNode='HeloInstance1'),
    ROUTE(fromField='totalDuration',fromNode='Helo_1_WaypointInterpolator',toField='cycleInterval',toNode='Helo1_Clock'),
    ROUTE(fromField='fraction_changed',fromNode='Helo1_Clock',toField='set_fraction',toNode='Helo_1_WaypointInterpolator'),
    ROUTE(fromField='position_changed',fromNode='Helo_1_WaypointInterpolator',toField='set_translation',toNode='Helo-1'),
    ROUTE(fromField='orientation_changed',fromNode='Helo_1_WaypointInterpolator',toField='set_rotation',toNode='Helo-1'),
    Comment(' Helo-2 Waypoint Routes '),
    ROUTE(fromField='isActive',fromNode='Helo2_Clock',toField='inFlight',toNode='HeloInstance2'),
    ROUTE(fromField='totalDuration',fromNode='Helo_2_WaypointInterpolator',toField='cycleInterval',toNode='Helo2_Clock'),
    ROUTE(fromField='fraction_changed',fromNode='Helo2_Clock',toField='set_fraction',toNode='Helo_2_WaypointInterpolator'),
    ROUTE(fromField='position_changed',fromNode='Helo_2_WaypointInterpolator',toField='set_translation',toNode='Helo-2'),
    ROUTE(fromField='orientation_changed',fromNode='Helo_2_WaypointInterpolator',toField='set_rotation',toNode='Helo-2'),
    Comment(' Position Interpolators for AAAV Formation '),
    ROUTE(fromField='fraction_changed',fromNode='AAAV1_Clock',toField='set_fraction',toNode='AAV-2PATH'),
    ROUTE(fromField='fraction_changed',fromNode='AAAV1_Clock',toField='set_fraction',toNode='AAV-3PATH'),
    ROUTE(fromField='value_changed',fromNode='AAV-2PATH',toField='set_translation',toNode='AAAV-2'),
    ROUTE(fromField='value_changed',fromNode='AAV-3PATH',toField='set_translation',toNode='AAAV-3'),
    Comment(' AAV7PA1 Waypoint Routes '),
    ROUTE(fromField='totalDuration',fromNode='AAV7PA1WaypointInterpolator',toField='cycleInterval',toNode='AAV7PA1Clock'),
    ROUTE(fromField='fraction_changed',fromNode='AAV7PA1Clock',toField='set_fraction',toNode='AAV7PA1WaypointInterpolator'),
    ROUTE(fromField='position_changed',fromNode='AAV7PA1WaypointInterpolator',toField='set_translation',toNode='AAV7PA1Location'),
    ROUTE(fromField='orientation_changed',fromNode='AAV7PA1WaypointInterpolator',toField='set_rotation',toNode='AAV7PA1Location')])
)

### X3D model conversion complete ###

####################################################################################################
# Self-test diagnostics
####################################################################################################

print('Self-test diagnostics for AmphibiousRaidWithCommunications.py:')
if        metaDiagnostics(newModel): # built-in utility method in X3D class
    print(metaDiagnostics(newModel)) # display meta info, hint, warning, error, TODO values in this model
# print('check newModel.XML() serialization...')
newModelXML= newModel.XML() # test export method XML() for exceptions during export
newModel.XMLvalidate()
# print(newModelXML) # diagnostic

try:
#   print('check newModel.VRML() serialization...')
    newModelVRML=newModel.VRML() # test export method VRML() for exceptions during export
    # print(prependLineNumbers(newModelVRML)) # debug
    print("Python-to-VRML export of VRML output successful", flush=True)
except Exception as err: # usually BaseException
    # https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python
    print("*** Python-to-VRML export of VRML output failed:", type(err).__name__, err)
    if newModelVRML: # may have failed to generate
        print(prependLineNumbers(newModelVRML, err.lineno))

try:
#   print('check newModel.JSON() serialization...')
    newModelJSON=newModel.JSON() # test export method JSON() for exceptions during export
#   print(prependLineNumbers(newModelJSON)) # debug
    print("Python-to-JSON export of JSON output successful (under development)")
except Exception as err: # usually SyntaxError
    print("*** Python-to-JSON export of JSON output failed:", type(err).__name__, err)
    if newModelJSON: # may have failed to generate
        print(prependLineNumbers(newModelJSON,err.lineno))

print("python AmphibiousRaidWithCommunications.py load and self-test diagnostics complete.")
