Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CMIS-IADS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reeves, David E
CMIS-IADS
Commits
1d00b32a
Commit
1d00b32a
authored
4 years ago
by
Reeves, David E
Browse files
Options
Downloads
Patches
Plain Diff
* convoy unit
parent
b6982778
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/HTN/Trees/Red/ConvoyUnit.xml
+13
-11
13 additions, 11 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+88
-79
88 additions, 79 deletions
scripts/HTN/Trees/Red/RedForceCoordinator.xml
scripts/jump_start.py
+53
-31
53 additions, 31 deletions
scripts/jump_start.py
with
154 additions
and
121 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
+
13
−
11
View file @
1d00b32a
...
...
@@ -10,6 +10,15 @@
_htn_precon_ret=1
</Code>
<Import
/>
<HTNNode
AllowMsg=
"true"
Name=
"createData"
Type=
"DEFAULT"
>
<Parent>
start
</Parent>
<Code
IsFile=
"false"
>
# create data
borg.redNumSetups = dict()
</Code>
<Import
/>
</HTNNode>
<HTNNode
AllowMsg=
"true"
Name=
"start"
Type=
"DEFAULT"
>
<Parent>
addReplanTriggers
</Parent>
<Code
IsFile=
"false"
>
...
...
@@ -182,10 +191,7 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0:
cmdName = state.getCurrentCommander().getAssignedName()
# calculate how long on station they should be
rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
rn = (1.5 + rn * 2.5) * 14400.0
rn = 1
borg.redTimeOnStation[state.getCurrentUnitName()]=rn
borg.redNumSetups[state.getCurrentUnitName()]=borg.params_redNumSetups
printMessage("SETTING TOS "+str(state.getCurrentUnitName()), True)
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
...
...
@@ -269,11 +275,7 @@ setupNum = _gt_activeNode.getVar("setupNum")
printMessage("Setup completed rus: "+str(borg.redUnitStatus[state.getCurrentUnitName()])+" setupNum: "+str(setupNum), True)
if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum:
rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
rn = (1.5 + rn * 2.5) * 14400.0
rn = 10.0
# SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn)
# printMessage("Convoy setup complete: "+str(state.getCurrentUnitName()), True)
# borg.delay=0
rn = borg.params_redSetupTimeMin + rn * borg.params_redSetupTimeVar
# commander name
cmdName=""
...
...
@@ -356,7 +358,7 @@ from HTNBehaviors import SendEntityEventDelay
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
if borg.red
TimeOnStation
[state.getCurrentUnitName()]
>
1: # check against 1 because at least one setup always occurs
if borg.red
NumSetups
[state.getCurrentUnitName()]
>
1: # check against 1 because at least one setup always occurs
# time on station hasn't elapsed, keep practicing setup
cmdName=""
if state.isCommander():
...
...
@@ -366,7 +368,7 @@ if borg.redTimeOnStation[state.getCurrentUnitName()] > 1: # check against 1 b
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
printMessage("Setting up again: "+str(cmdName), True)
borg.red
TimeOnStation
[state.getCurrentUnitName()]=borg.red
TimeOnStation
[state.getCurrentUnitName()]-1
borg.red
NumSetups
[state.getCurrentUnitName()]=borg.red
NumSetups
[state.getCurrentUnitName()]-1
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
...
...
This diff is collapsed.
Click to expand it.
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+
88
−
79
View file @
1d00b32a
...
...
@@ -259,84 +259,91 @@ while len(dismounts)>0:
_gt_activeNode.putVar("convoyIndex", 0)
al = ArrayList()
al.add("circle")
al.add("FIRE_CONTROL_RADAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
0.001,
al)
#al = ArrayList()
#al.add("bigellipse")
#al.add("FIRE_CONTROL_RADAR")
#al.add("FIRE_CONTROL_RADAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#
#UtilityFuncsExp.scheduleEvent(
# dm,
# info.getMyAssignedName(),
# "GoalTracker_CreateConvoy",
# 5,
# al)
#al = ArrayList()
#al.add("bigbox")
#al.add("FIRE_CONTROL_RADAR")
#al.add("TARGET_ACQ_RADAR")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#
#UtilityFuncsExp.scheduleEvent(
# dm,
# info.getMyAssignedName(),
# "GoalTracker_CreateConvoy",
# 10,
# al)
# activate one
if borg.params_activateConvoyOne:
al = ArrayList()
al.add("circle")
al.add("FIRE_CONTROL_RADAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
0.001,
al)
# activate two
if borg.params_activateConvoyTwo:
al = ArrayList()
al.add("bigellipse")
al.add("FIRE_CONTROL_RADAR")
al.add("FIRE_CONTROL_RADAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
5,
al)
# activate three
if borg.params_activateConvoyThree:
al = ArrayList()
al.add("bigbox")
al.add("FIRE_CONTROL_RADAR")
al.add("TARGET_ACQ_RADAR")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
10,
al)
</Code>
<Import
/>
</HTNNode>
...
...
@@ -474,7 +481,9 @@ if numDestChance > 0.75:
elif numDestChance
>
0.5:
numDestinations = 2
numDestinations = 1
# check for testing override (jump_start.py)
if borg.params_overrideNumDests
>
0:
numDestinations = borg.params_overrideNumDests
convoyDests = []
for n in range(numDestinations):
...
...
This diff is collapsed.
Click to expand it.
scripts/jump_start.py
+
53
−
31
View file @
1d00b32a
...
...
@@ -27,6 +27,25 @@ printMessage("SA Inited = "+str(borg.saTracker.retrieveData(info.getMyAssignedNa
borg
.
goalPath
=
"
HTN/Trees/
"
entityName
=
"
RFC
"
#################################################################################################################################################################
# Scenario Parameters
#################################################################################################################################################################
borg
.
params_redNumSetups
=
1
borg
.
params_redSetupTimeMin
=
10
borg
.
params_redSetupTimeVar
=
10
borg
.
params_activateConvoyOne
=
True
borg
.
params_activateConvoyTwo
=
False
borg
.
params_activateConvoyThree
=
False
borg
.
params_useFakeConvoys
=
False
borg
.
params_useRandomMovers
=
False
borg
.
params_overrideNumDests
=
2
# ignored if 0
#################################################################################################################################################################
#
#################################################################################################################################################################
# get bool value for if we're in attack mode or not
# 0.5 maps to a 50% chance of attack mode being true
borg
.
attackMode
=
GetRandomChance
(
0.5
)
...
...
@@ -60,27 +79,28 @@ UtilityFuncsExp.addGoal(
[],
None
)
# draw for number of fakeys
numFakeConvoys
=
GetRandomInt
(
0
,
2
)
fakeConvoys
=
[]
if
numFakeConvoys
==
1
:
fakeConvoys
.
append
(
fakeConvoy1
)
elif
numFakeConvoys
==
2
:
fakeConvoys
.
append
(
fakeConvoy1
)
fakeConvoys
.
append
(
fakeConvoy2
)
# create the fake convoys if any
#ctr = 10
#for fakeConvoy in fakeConvoys:
# entityList = ConvertToJavaListRandom(fakeConvoy, 4, 25)
# fakeConvoyLeader = fakeConvoy[0]
# UtilityFuncsExp.addGoal(
# entityList.get(0),
# ctr,
# borg.goalPath + "Red/RandomMove.xml",
# [1, entityList, True],
# None)
# ctr = ctr + 10
if
borg
.
params_useFakeConvoys
:
# draw for number of fakeys
numFakeConvoys
=
GetRandomInt
(
0
,
2
)
fakeConvoys
=
[]
if
numFakeConvoys
==
1
:
fakeConvoys
.
append
(
fakeConvoy1
)
elif
numFakeConvoys
==
2
:
fakeConvoys
.
append
(
fakeConvoy1
)
fakeConvoys
.
append
(
fakeConvoy2
)
# create the fake convoys if any
ctr
=
10
for
fakeConvoy
in
fakeConvoys
:
entityList
=
ConvertToJavaListRandom
(
fakeConvoy
,
4
,
25
)
fakeConvoyLeader
=
fakeConvoy
[
0
]
UtilityFuncsExp
.
addGoal
(
entityList
.
get
(
0
),
ctr
,
borg
.
goalPath
+
"
Red/RandomMove.xml
"
,
[
1
,
entityList
,
True
],
None
)
ctr
=
ctr
+
10
# common trees for all entities or entities with specific combos
for
entity
in
PlayBoard
.
getSingleton
().
getAllEntities
():
...
...
@@ -102,14 +122,16 @@ for entity in PlayBoard.getSingleton().getAllEntities():
[],
None
)
# random movers
#ctr = 10
#for vehicle in randomMoveVeh:
# UtilityFuncsExp.addGoal(
# vehicle,
# ctr,
# borg.goalPath + "Red/RandomMove.xml",
# [-1, None, False],
# None)
# ctr = ctr + 10
if
borg
.
params_useRandomMovers
:
# random movers
ctr
=
10
for
vehicle
in
randomMoveVeh
:
UtilityFuncsExp
.
addGoal
(
vehicle
,
ctr
,
borg
.
goalPath
+
"
Red/RandomMove.xml
"
,
[
-
1
,
None
,
False
],
None
)
ctr
=
ctr
+
10
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment