diff --git a/CMIS-IADS_withCMs_David_2.bbp2 b/CMIS-IADS_withCMs_David_2.bbp2 index f5ba78cdb42fc00df8d3a25951a0023536e49627..4830069497abc9af8103efd3093784e89fd5c02b 100644 --- a/CMIS-IADS_withCMs_David_2.bbp2 +++ b/CMIS-IADS_withCMs_David_2.bbp2 @@ -1,2 +1,2 @@ -<BBP2_v0.1 SITS_XML_VERSION="1.06" SITS_XML_CREATION_DATE="01/07/2020"> +<BBP2_v0.1 SITS_XML_VERSION="1.06" SITS_XML_CREATION_DATE="05/08/2020"> </BBP2_v0.1> diff --git a/CMIS-IADS_withCMs_David_2.xml b/CMIS-IADS_withCMs_David_2.xml index f0907048fc3db570ce646f35d74a8a428e6d8f57..c3407716db68a12bda3defe40feebbb6f39ce99f 100644 --- a/CMIS-IADS_withCMs_David_2.xml +++ b/CMIS-IADS_withCMs_David_2.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<Scenario SITS_XML_VERSION="1.16" SITS_XML_CREATION_DATE="07/01/2020"> +<Scenario SITS_XML_VERSION="1.16" SITS_XML_CREATION_DATE="08/05/2020"> <Metadata> <MetaInfo> <ScenarioData class="SCENARIO"> @@ -7659,7 +7659,7 @@ <Id>2073771340</Id> <Name>Entity_2</Name> <UUID>45009995-3b67-4f91-9012-ec93745bed9e</UUID> - <Type>RED_OPS_CTR</Type> + <Type>M1A1</Type> <Longitude>-117.31893406550718</Longitude> <Latitude>33.19642367286961</Latitude> <Altitude>0.0</Altitude> @@ -8067,7 +8067,7 @@ <Id>929392452</Id> <Name>Entity_10</Name> <UUID>ed41fe6f-c250-4dea-8b21-7c808d4a7604</UUID> - <Type>RED_OPS_CTR</Type> + <Type>M1A1</Type> <Longitude>-117.31885344614939</Longitude> <Latitude>33.19669031688471</Latitude> <Altitude>0.0</Altitude> @@ -8475,7 +8475,7 @@ <Id>888995885</Id> <Name>Entity_18</Name> <UUID>8b3baf2d-79f0-4bc4-b727-d044112b235b</UUID> - <Type>RED_OPS_CTR</Type> + <Type>M1A1</Type> <Longitude>-117.31857975900704</Longitude> <Latitude>33.196457241382824</Latitude> <Altitude>0.0</Altitude> @@ -8883,7 +8883,7 @@ <Id>400728507</Id> <Name>Entity_26</Name> <UUID>a8095ffd-d879-4889-b2be-b7ddd8792e73</UUID> - <Type>RED_OPS_CTR</Type> + <Type>M1A1</Type> <Longitude>-117.31820895707223</Longitude> <Latitude>33.19617554962725</Latitude> <Altitude>0.0</Altitude> @@ -17961,7 +17961,7 @@ <Id>648303711</Id> <Name>Entity_204</Name> <UUID>5715ea7a-4dfe-473a-8a29-efc87ea89a00</UUID> - <Type>RED_OPS_CTR</Type> + <Type>M1A1</Type> <Longitude>-117.31816024885151</Longitude> <Latitude>33.19547433730728</Latitude> <Altitude>0.0</Altitude> @@ -359134,7 +359134,7 @@ <UUID>99999d73-bd88-4cf2-861d-aebbf88517b8</UUID> <Category>UNKNOWN</Category> <Type>UNKNOWN_GROUND</Type> - <What>RED_OPS_CTR</What> + <What>M1A1</What> <ScenarioData class="SUBDATA" parent="1832696990"> <Map> <Entry name="COUNTER_MEASURE"> diff --git a/scripts/HTN/Trees/NetworkMove.xml b/scripts/HTN/Trees/NetworkMove.xml index ff1d3fcce0d452ab577c756d8776114e64a60faa..a4ea3f784dbc7bac05e46ebc5575167593aeecd8 100644 --- a/scripts/HTN/Trees/NetworkMove.xml +++ b/scripts/HTN/Trees/NetworkMove.xml @@ -17,7 +17,7 @@ _htn_precon_ret=1 </Code> <Import /> - <HTNNode AllowMsg="true" Name="buildMoveOrder" Type="DEFAULT"> + <HTNNode AllowMsg="false" Name="buildMoveOrder" Type="DEFAULT"> <Parent>initInfo</Parent> <Code IsFile="false">import cxxi.model.behavior.OrderUtilities as OrderUtilities import java.util.Vector as Vector @@ -116,7 +116,7 @@ orders.preemptAllOrders(ordr) _htn_precon_ret=1 </Code> <Import /> - <HTNNode AllowMsg="true" Name="moveComplete" Type="GOAL"> + <HTNNode AllowMsg="false" Name="moveComplete" Type="GOAL"> <Parent>New Node</Parent> <Code IsFile="false">from HTNBehaviors import SendEntityEvent @@ -163,7 +163,7 @@ goalWP=_gt_activeNode.getVar("goalWP") state.removeControlMeasure(goalWP.getName()) SendEntityEvent(info.getMyAssignedName(), "GoalTracker_NWMoveComplete", []) -printMessage("NW ATCM", True) +#printMessage("NW ATCM", True) </Code> <Import /> </HTNNode> diff --git a/scripts/HTN/Trees/Red/ConvoyUnit.xml b/scripts/HTN/Trees/Red/ConvoyUnit.xml index 48312c338e4af58b05a9ca60d7a76b717b873045..6f29a38ab648f9250bd40ea6a9565d814f01d332 100644 --- a/scripts/HTN/Trees/Red/ConvoyUnit.xml +++ b/scripts/HTN/Trees/Red/ConvoyUnit.xml @@ -20,7 +20,9 @@ #borg.delay=1.0 # #borg.redUnitStatus[state.getCurrentUnitName()] = 0 -#</Code> +# + +</Code> <Import /> </HTNNode> <HTNNode AllowMsg="true" Name="addReplanTriggers" Type="INTERRUPT"> @@ -110,6 +112,11 @@ CreateNetworkMove( borg.delay) borg.delay+=5.0 printMessage("Starting move: "+str(wps), True) + +##################################################### +# set activity to log +if _gt_activeNode.getVar("moveReason") == "CONVOY": + borg.redUnitActivity[state.getCurrentUnitName()]="MOVE_TO_DEPLOYMENT_SITE" </Code> <Import /> </HTNNode> @@ -146,11 +153,6 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0: cmdName = state.getCurrentCommander().getAssignedName() SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", []) borg.delay=1.0 - - ################################# - # logging info - borg.redUnitActivity[state.getCurrentUnitName()]="MOVE_TO_DEPLOYMENT_SITE" - </Code> <Import /> </HTNNode> @@ -189,6 +191,10 @@ for i in range(nlocs): _gt_activeNode.putVar("setupNum", nlocs) printMessage("Convoy setup for "+str(borg.formationsByName[formName].size()/2)+" vehicles", True) + +##################################################### +# set activity to log +borg.redUnitActivity[state.getCurrentUnitName()]="DEPLOY_AT_SITE" </Code> <Import /> </HTNNode> @@ -211,7 +217,7 @@ setupNum = _gt_activeNode.getVar("setupNum") if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum: rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0]) rn = (1.5 + rn * 2.5) * 14400.0 - rn = 60.0 #00000.0 +# rn = 60.0 # SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn) # printMessage("Convoy setup complete: "+str(state.getCurrentUnitName()), True) # borg.delay=0 @@ -224,6 +230,11 @@ if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum: cmdName = state.getCurrentCommander().getAssignedName() SendEntityEventDelay(cmdName, "GoalTracker_ConvoyPackUp", [], rn) + + ##################################################### + # set activity to log + borg.redUnitActivity[state.getCurrentUnitName()]="OPERATE_AT_SITE" + </Code> <Import /> </HTNNode> @@ -249,6 +260,10 @@ else: SendEntityEventDelay(cmdName, "GoalTracker_ConvoyPackUpComplete", [], 300.0) printMessage("Convoy packing up: "+str(state.getCurrentUnitName()), True) borg.delay=0 + +##################################################### +# set activity to log +borg.redUnitActivity[state.getCurrentUnitName()]="PACK_UP_AT_SITE" </Code> <Import /> </HTNNode> @@ -296,6 +311,9 @@ for m in state.getCurrentUnit().getMembers(): borg.delay) borg.delay+=5.0 +##################################################### +# set activity to log +borg.redUnitActivity[state.getCurrentUnitName()]="RETURN_TO_GARRISON" </Code> <Import /> </HTNNode> @@ -318,6 +336,10 @@ borg.redUnitStatus[state.getCurrentUnitName()] = borg.redUnitStatus[state.getCur if borg.redUnitStatus[state.getCurrentUnitName()]==state.getCurrentUnit().getMembers().size(): printMessage("Convoy return", True) SendEntityEventDelay("RFC", "GoalTracker_ReclaimConvoy", [state.getCurrentUnitName()], 1.0) + + ##################################################### + # set activity to log + borg.redUnitActivity[state.getCurrentUnitName()] = None </Code> <Import /> </HTNNode> diff --git a/scripts/HTN/Trees/Red/EntityLogger.xml b/scripts/HTN/Trees/Red/EntityLogger.xml new file mode 100644 index 0000000000000000000000000000000000000000..3d513a822a5f6df05fcd6ed6fe801f8852fc1891 --- /dev/null +++ b/scripts/HTN/Trees/Red/EntityLogger.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<HTNNode AllowMsg="true" Name="EntityLogger" Type="DEFAULT"> + <Parent>null</Parent> + <Code IsFile="false" /> + <Import /> + <HTNNode AllowMsg="true" Name="initInfo" Type="DEFAULT"> + <Parent>BasicTree</Parent> + <Code IsFile="false">if _gt_activeNode.getVar("isInited") == None: + _gt_activeNode.putVar("isInited", 1) + _htn_precon_ret=1 +</Code> + <Import /> + <HTNNode AllowMsg="true" Name="startLogLoop" Type="DEFAULT"> + <Parent>addReplanTriggers</Parent> + <Code IsFile="false">from HTNBehaviors import SendEntityEventDelay + +SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogInfo", [], 5.0) +borg.redLoggerInterval = 60 +</Code> + <Import /> + </HTNNode> + <HTNNode AllowMsg="true" Name="addReplanTriggers" Type="INTERRUPT"> + <Parent>initInfo</Parent> + <Code IsFile="false"># model events +#goalContainer.getCurrentExecutingStack().addReplanTrigger("ModelEvent") + +# goal tracker events +#goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_Event") +goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_LogInfo") +</Code> + <Import /> + </HTNNode> + </HTNNode> + <HTNNode AllowMsg="true" Name="events" Type="DEFAULT"> + <Parent>BasicTree</Parent> + <Code IsFile="false" /> + <Import /> + <HTNNode AllowMsg="true" Name="isGoalTrackerEvent" Type="DEFAULT"> + <Parent>events</Parent> + <Code IsFile="false">if state.getLastTrigger().startswith("doGoalTracker_"): + _htn_precon_ret=1 +</Code> + <Import /> + <HTNNode AllowMsg="true" Name="isGoalTracker_LogInfo" Type="DEFAULT"> + <Parent>printGoalTrackerEvent</Parent> + <Code IsFile="false">if state.getLastTrigger().startswith("doGoalTracker_LogInfo"): + _htn_precon_ret=1 +</Code> + <Import /> + <HTNNode AllowMsg="true" Name="logInfo" Type="INTERRUPT"> + <Parent>isGoalTracker_LogInfo</Parent> + <Code IsFile="false">import mtry.cxxi.model.MtryLog.LogGenericMsg as LogGenericMsg +from HTNBehaviors import SendEntityEventDelay + +currentActivity = "PARKED_AT_BASE" +if state.getCurrentUnitName() in borg.redUnitActivity: + currentActivity = borg.redUnitActivity[state.getCurrentUnitName()] + +if currentActivity == None: + currentActivity = "RESUPPLY" + +loc = state.getCurrentLocation() +heading = state.getCurrentHeading().getHeadingInDegrees() + +LogGenericMsg.logMsg( + "EntityActivityLogger", + "ID\tProfile\tLat\tLon\tEle\tSpeed\tHeading\Activity", + info.getMySelf(), + [str(info.getMySelf().getID()), info.getMyProfile().getName(), str(loc.getLatitude()), str(loc.getLongitude()), str(loc.getElevation()), str(state.getCurrentSpeed()), str(heading), currentActivity]) +#printMessage("TEST LOG", True) + +SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogInfo", [], borg.redLoggerInterval) +</Code> + <Import /> + </HTNNode> + </HTNNode> + <HTNNode AllowMsg="true" Name="printGoalTrackerEvent" Type="INTERRUPT"> + <Parent>isGoalTrackerEvent</Parent> + <Code IsFile="false">printMessage("GOAL TRACKER EVENT"+state.getLastTrigger(), True) +</Code> + <Import /> + </HTNNode> + </HTNNode> + <HTNNode AllowMsg="true" Name="modelEvents" Type="DEFAULT"> + <Parent>events</Parent> + <Code IsFile="false" /> + <Import /> + <HTNNode AllowMsg="true" Name="printEvent" Type="INTERRUPT"> + <Parent>modelEvents</Parent> + <Code IsFile="false">printMessage("EVENT"+state.getLastTrigger(), True)</Code> + <Import /> + </HTNNode> + </HTNNode> + </HTNNode> +</HTNNode> \ No newline at end of file diff --git a/scripts/HTN/Trees/Red/RedForceCoordinator.xml b/scripts/HTN/Trees/Red/RedForceCoordinator.xml index 95447ffdd04a45066c7904976c5e25851e945266..d40f156ea55d91004fa05a166d64b64e056776e3 100644 --- a/scripts/HTN/Trees/Red/RedForceCoordinator.xml +++ b/scripts/HTN/Trees/Red/RedForceCoordinator.xml @@ -412,7 +412,7 @@ unit = NewUnitHolder.retrieveUnitByName(state.getLastTriggerParams()[0].get(0)) printMessage("Unit reclaimed", True) formName = borg.redFormsByUnit[unit.getName()] -SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [unit.getName(), formName], 5) +#SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [unit.getName(), formName], 5) </Code> <Import /> </HTNNode> diff --git a/scripts/jump_start.py b/scripts/jump_start.py index 63623594486b3548aefd8ce3079c646c77e9ef55..d0135293823f034b0082d76b853378c53893edde 100644 --- a/scripts/jump_start.py +++ b/scripts/jump_start.py @@ -4,6 +4,7 @@ import cxxi.model.knowledge.group.holders.NewUnitHolder as NewUnitHolder from HTNBehaviors import SendEntityEvent from SATracker import SATracker +import cxxi.model.objects.playboard.PlayBoard as PlayBoard import mtry.cxxi.model.MtryLog.LogManager as LogManager print info.getMyAssignedName(),": JUMP START!" @@ -46,3 +47,12 @@ UtilityFuncsExp.addGoal( borg.goalPath + "Red/RedForceCoordinator.xml", [], None) + +for entity in PlayBoard.getSingleton().getAllEntities(): + UtilityFuncsExp.addSpecificGoal( + entity.getAssignedName(), + 0.5, + borg.goalPath + "Red/EntityLogger.xml", + "LOGGING", + [], + None)