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
013e4802
Commit
013e4802
authored
4 years ago
by
Reeves, David E
Browse files
Options
Downloads
Patches
Plain Diff
* committing for a restore point
parent
2fb857e7
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
+1
-1
1 addition, 1 deletion
scripts/HTN/Trees/Red/ConvoyUnit.xml
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+82
-83
82 additions, 83 deletions
scripts/HTN/Trees/Red/RedForceCoordinator.xml
scripts/jump_start.py
+27
-27
27 additions, 27 deletions
scripts/jump_start.py
with
110 additions
and
111 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
+
1
−
1
View file @
013e4802
...
@@ -230,7 +230,7 @@ setupNum = _gt_activeNode.getVar("setupNum")
...
@@ -230,7 +230,7 @@ setupNum = _gt_activeNode.getVar("setupNum")
if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum:
if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum:
rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
rn = (1.5 + rn * 2.5) * 14400.0
rn = (1.5 + rn * 2.5) * 14400.0
#
rn = 60.0
rn = 60.0
# SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn)
# SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn)
# printMessage("Convoy setup complete: "+str(state.getCurrentUnitName()), True)
# printMessage("Convoy setup complete: "+str(state.getCurrentUnitName()), True)
# borg.delay=0
# borg.delay=0
...
...
This diff is collapsed.
Click to expand it.
scripts/HTN/Trees/Red/RedForceCoordinator.xml
+
82
−
83
View file @
013e4802
...
@@ -274,67 +274,66 @@ UtilityFuncsExp.scheduleEvent(
...
@@ -274,67 +274,66 @@ UtilityFuncsExp.scheduleEvent(
0.001,
0.001,
al)
al)
al = ArrayList()
#al = ArrayList()
al.add("bigellipse")
#al.add("bigellipse")
al.add("FIRE_CONTROL_RADAR")
#al.add("FIRE_CONTROL_RADAR")
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")
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(
#UtilityFuncsExp.scheduleEvent(
dm,
# dm,
info.getMyAssignedName(),
# info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
# "GoalTracker_CreateConvoy",
5,
# 5,
al)
# al)
al = ArrayList()
#al = ArrayList()
al.add("bigbox")
#al.add("bigbox")
al.add("FIRE_CONTROL_RADAR")
#al.add("FIRE_CONTROL_RADAR")
#al.add("TARGET_ACQ_RADAR")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
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("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("SPT_VEH")
#al.add("TELAR")
al.add("TELAR")
#al.add("TELAR")
al.add("TELAR")
#
al.add("TELAR")
#UtilityFuncsExp.scheduleEvent(
# dm,
UtilityFuncsExp.scheduleEvent(
# info.getMyAssignedName(),
dm,
# "GoalTracker_CreateConvoy",
info.getMyAssignedName(),
# 10,
"GoalTracker_CreateConvoy",
# al)
10,
al)
</Code>
</Code>
<Import
/>
<Import
/>
</HTNNode>
</HTNNode>
...
@@ -373,14 +372,22 @@ goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReclaimCo
...
@@ -373,14 +372,22 @@ goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReclaimCo
<Code
IsFile=
"false"
>
import mtry.cxxi.model.HierarchicalTaskNetwork.PythonUtilities.PythonUnit as PythonUnit
<Code
IsFile=
"false"
>
import mtry.cxxi.model.HierarchicalTaskNetwork.PythonUtilities.PythonUnit as PythonUnit
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import SendEntityEventDelay
# an index for the convoy
convoyIndex = _gt_activeNode.getVar("convoyIndex")
convoyIndex = _gt_activeNode.getVar("convoyIndex")
# a list of the profiles the are part of this convoy
profiles = state.getLastTriggerParams()[0]
profiles = state.getLastTriggerParams()[0]
# formation name to use. formation is the first string in the
# profile list
formName = profiles.get(0)
formName = profiles.get(0)
profiles.remove(0)
profiles.remove(0)
# create a list of members
memberList = ArrayList()
memberList = ArrayList()
# entities are stored in the borg in a dictionary by profiles
# loop through the list of desired profiles and pull those entities
# to add to the member list
for profile in profiles:
for profile in profiles:
if len(borg.redProfiles[profile])
>
0:
if len(borg.redProfiles[profile])
>
0:
entityName = borg.redProfiles[profile].pop(0)
entityName = borg.redProfiles[profile].pop(0)
...
@@ -395,25 +402,13 @@ for profile in profiles:
...
@@ -395,25 +402,13 @@ for profile in profiles:
else:
else:
printMessage("No more "+profile+" entities left.", True)
printMessage("No more "+profile+" entities left.", True)
# create the tactical unit from the member list
tu = PythonUnit._py_createTacticalUnitMtry("CONVOY_"+str(convoyIndex), memberList)
tu = PythonUnit._py_createTacticalUnitMtry("CONVOY_"+str(convoyIndex), memberList)
#borg.redConvoys[tu.getName()] = tu
# increment the convoy index
#borg.redConvoysWaiting[tu.getName()] = []
#
#destName = borg.redDestinations[0]
#del borg.redDestinations[0]
#borg.redDestinations.append(destName)
#
#borg.redConvoyDest[tu.getName()] = destName
#borg.redFormsByUnit[tu.getName()] = formName
_gt_activeNode.putVar("convoyIndex", convoyIndex+1)
_gt_activeNode.putVar("convoyIndex", convoyIndex+1)
#
#SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [], 1)
#
#printMessage("Convoy created: "+str(tu.getName())+" DEST: "+destName, True)
#
# go to making the convoy move (still in this tree)
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.getName(), formName], 1)
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.getName(), formName], 1)
</Code>
</Code>
<Import
/>
<Import
/>
...
@@ -430,16 +425,12 @@ SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.get
...
@@ -430,16 +425,12 @@ SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.get
<Code
IsFile=
"false"
>
import cxxi.model.knowledge.group.holders.NewUnitHolder as NewUnitHolder
<Code
IsFile=
"false"
>
import cxxi.model.knowledge.group.holders.NewUnitHolder as NewUnitHolder
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import SendEntityEventDelay
# get the unity, the name of the unit is the first parameter
unit = NewUnitHolder.retrieveUnitByName(state.getLastTriggerParams()[0].get(0))
unit = NewUnitHolder.retrieveUnitByName(state.getLastTriggerParams()[0].get(0))
#for m in unit.getMembers():
# borg.redProfiles[m.getProfile().getName()].append(m.getAssignedName())
# unit.dismissMember(m)
printMessage("Unit reclaimed", True)
printMessage("Unit reclaimed", True)
formName = borg.redFormsByUnit[unit.getName()]
formName = borg.redFormsByUnit[unit.getName()]
#SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [unit.getName(), formName], 5)
</Code>
</Code>
<Import
/>
<Import
/>
</HTNNode>
</HTNNode>
...
@@ -456,26 +447,34 @@ formName = borg.redFormsByUnit[unit.getName()]
...
@@ -456,26 +447,34 @@ formName = borg.redFormsByUnit[unit.getName()]
from HTNBehaviors import SendUnitEventDelay
from HTNBehaviors import SendUnitEventDelay
import cxxi.model.behavior.PythonUtilities as PythonUtilities
import cxxi.model.behavior.PythonUtilities as PythonUtilities
# get the unit name (first trigger param)
unitName = state.getLastTriggerParams()[0].get(0)
unitName = state.getLastTriggerParams()[0].get(0)
# get the formation name (second trigger param)
formName = state.getLastTriggerParams()[0].get(1)
formName = state.getLastTriggerParams()[0].get(1)
# get the actual unit
tu = NewUnitHolder.retrieveUnitByName(unitName)
tu = NewUnitHolder.retrieveUnitByName(unitName)
# add the unit to the list of convoys
borg.redConvoys[tu.getName()] = tu
borg.redConvoys[tu.getName()] = tu
# create a dictionary entry for the unit
borg.redConvoysWaiting[tu.getName()] = []
borg.redConvoysWaiting[tu.getName()] = []
#destName = "PATH_DEST"+str(convoyIndex+1)
# get the destination for the convoy
# then move it to the back
destName = borg.redDestinations[0]
destName = borg.redDestinations[0]
del borg.redDestinations[0]
del borg.redDestinations[0]
borg.redDestinations.append(destName)
borg.redDestinations.append(destName)
# set the convoys destination and formation
# in the borg
borg.redConvoyDest[tu.getName()] = destName
borg.redConvoyDest[tu.getName()] = destName
borg.redFormsByUnit[tu.getName()] = formName
borg.redFormsByUnit[tu.getName()] = formName
# randomize the speed
randSpd = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = 10.0 + (40.0 * randSpd)
randSpd = 10.0 + (40.0 * randSpd)
# start the assembly
SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [randSpd], 1)
SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [randSpd], 1)
printMessage("Convoy move: "+str(tu.getName())+" DEST: "+destName, True)
printMessage("Convoy move: "+str(tu.getName())+" DEST: "+destName, True)
...
...
This diff is collapsed.
Click to expand it.
scripts/jump_start.py
+
27
−
27
View file @
013e4802
...
@@ -56,26 +56,26 @@ UtilityFuncsExp.addGoal(
...
@@ -56,26 +56,26 @@ UtilityFuncsExp.addGoal(
None
)
None
)
# draw for number of fakeys
# draw for number of fakeys
numFakeConvoys
=
GetRandomInt
(
0
,
2
)
#
numFakeConvoys = GetRandomInt(0, 2)
fakeConvoys
=
[]
#
fakeConvoys = []
if
numFakeConvoys
==
1
:
#
if numFakeConvoys==1:
fakeConvoys
.
append
(
fakeConvoy1
)
#
fakeConvoys.append(fakeConvoy1)
elif
numFakeConvoys
==
2
:
#
elif numFakeConvoys==2:
fakeConvoys
.
append
(
fakeConvoy1
)
#
fakeConvoys.append(fakeConvoy1)
fakeConvoys
.
append
(
fakeConvoy2
)
#
fakeConvoys.append(fakeConvoy2)
# create the fake convoys if any
# create the fake convoys if any
ctr
=
10
#
ctr = 10
for
fakeConvoy
in
fakeConvoys
:
#
for fakeConvoy in fakeConvoys:
entityList
=
ConvertToJavaListRandom
(
fakeConvoy
,
4
,
25
)
#
entityList = ConvertToJavaListRandom(fakeConvoy, 4, 25)
fakeConvoyLeader
=
fakeConvoy
[
0
]
#
fakeConvoyLeader = fakeConvoy[0]
UtilityFuncsExp
.
addGoal
(
#
UtilityFuncsExp.addGoal(
entityList
.
get
(
0
),
#
entityList.get(0),
ctr
,
#
ctr,
borg
.
goalPath
+
"
Red/RandomMove.xml
"
,
#
borg.goalPath + "Red/RandomMove.xml",
[
1
,
entityList
,
True
],
#
[1, entityList, True],
None
)
#
None)
ctr
=
ctr
+
10
#
ctr = ctr + 10
# common trees for all entities or entities with specific combos
# common trees for all entities or entities with specific combos
for
entity
in
PlayBoard
.
getSingleton
().
getAllEntities
():
for
entity
in
PlayBoard
.
getSingleton
().
getAllEntities
():
...
@@ -98,13 +98,13 @@ for entity in PlayBoard.getSingleton().getAllEntities():
...
@@ -98,13 +98,13 @@ for entity in PlayBoard.getSingleton().getAllEntities():
None
)
None
)
# random movers
# random movers
ctr
=
10
#
ctr = 10
for
vehicle
in
randomMoveVeh
:
#
for vehicle in randomMoveVeh:
UtilityFuncsExp
.
addGoal
(
#
UtilityFuncsExp.addGoal(
vehicle
,
#
vehicle,
ctr
,
#
ctr,
borg
.
goalPath
+
"
Red/RandomMove.xml
"
,
#
borg.goalPath + "Red/RandomMove.xml",
[
-
1
,
None
,
False
],
#
[-1, None, False],
None
)
#
None)
ctr
=
ctr
+
10
#
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