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
b6982778
Commit
b6982778
authored
3 years ago
by
Reeves, David E
Browse files
Options
Downloads
Patches
Plain Diff
* code for setup practice
parent
3c1d162e
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
+29
-4
29 additions, 4 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+65
-62
65 additions, 62 deletions
scripts/HTN/Trees/Red/RedForceCoordinator.xml
scripts/jump_start.py
+20
-20
20 additions, 20 deletions
scripts/jump_start.py
with
114 additions
and
86 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
+
29
−
4
View file @
b6982778
...
...
@@ -180,6 +180,14 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0:
cmdName = info.getMyAssignedName()
else:
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
printMessage("SETTING TOS "+str(state.getCurrentUnitName()), True)
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
borg.delay=1.0
# log data
...
...
@@ -345,8 +353,25 @@ if state.isCommander():
<Code
IsFile=
"false"
>
import cxxi.model.behavior.PythonUtilities as PythonUtilities
from HTNBehaviors import SendEntityEventDelay
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
if borg.redTimeOnStation[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():
cmdName = info.getMyAssignedName()
else:
cmdName = state.getCurrentCommander().getAssignedName()
if len(borg.redConvoyDest[state.getCurrentUnit().getName()])==0:
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
printMessage("Setting up again: "+str(cmdName), True)
borg.redTimeOnStation[state.getCurrentUnitName()]=borg.redTimeOnStation[state.getCurrentUnitName()]-1
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
elif len(borg.redConvoyDest[state.getCurrentUnit().getName()])==0:
# no more destinations go home
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn)
printMessage("Convoy pack up complete: "+str(state.getCurrentUnitName()), True)
...
...
@@ -360,9 +385,9 @@ else:
destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0]
del borg.redConvoyDest[state.getCurrentUnit().getName()][0]
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
#
# reset the setup count
#
borg.redUnitStatus[state.getCurrentUnitName()] = 0
#
SendUnitEventDelay(state.getCurrentUnit().getName(), "GoalTracker_MoveToPoint", ["CONVOY", randSpd, destName], borg.delay)
borg.delay=1.0
...
...
This diff is collapsed.
Click to expand it.
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+
65
−
62
View file @
b6982778
...
...
@@ -24,7 +24,10 @@ borg.redUnitActivityTime=dict()
borg.redEntityActivityOverride=dict()
borg.redDestinations=["PATH_DEST1", "PATH_DEST2","PATH_DEST3","PATH_DEST4","PATH_DEST5","PATH_DEST6","PATH_DEST7","PATH_DEST8","PATH_DEST9"]
borg.randomMoveStartTime=0
</Code>
borg.randomMoveStartTime=0
borg.redTimeOnStation=dict()
</Code>
<Import
/>
</HTNNode>
<HTNNode
AllowMsg=
"true"
Name=
"createFormations"
Type=
"DEFAULT"
>
...
...
@@ -274,66 +277,66 @@ UtilityFuncsExp.scheduleEvent(
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)
#
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)
</Code>
<Import
/>
</HTNNode>
...
...
@@ -471,7 +474,7 @@ if numDestChance > 0.75:
elif numDestChance
>
0.5:
numDestinations = 2
#
numDestinations =
3
numDestinations =
1
convoyDests = []
for n in range(numDestinations):
...
...
This diff is collapsed.
Click to expand it.
scripts/jump_start.py
+
20
−
20
View file @
b6982778
...
...
@@ -70,17 +70,17 @@ elif numFakeConvoys==2:
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
#
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
():
...
...
@@ -103,13 +103,13 @@ 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
#
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