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
6350301d
Commit
6350301d
authored
3 years ago
by
Reeves, David E
Browse files
Options
Downloads
Patches
Plain Diff
* don't do anything at base stops, just wait
* fixed some events not showing up in the logger
parent
39b99f45
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/HTN/Trees/Red/ConvoyUnit.xml
+79
-14
79 additions, 14 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
scripts/jump_start.py
+4
-0
4 additions, 0 deletions
scripts/jump_start.py
with
83 additions
and
14 deletions
scripts/HTN/Trees/Red/ConvoyUnit.xml
+
79
−
14
View file @
6350301d
...
@@ -57,6 +57,7 @@ goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyRet
...
@@ -57,6 +57,7 @@ goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyRet
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReturnCompleted")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReturnCompleted")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyPackUp")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyPackUp")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyPackUpComplete")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyPackUpComplete")
goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ConvoyWaitAtBaseComplete")
</Code>
</Code>
<Import
/>
<Import
/>
</HTNNode>
</HTNNode>
...
@@ -168,6 +169,8 @@ if state.isCommander():
...
@@ -168,6 +169,8 @@ if state.isCommander():
<Code
IsFile=
"false"
>
from HTNBehaviors import SendUnitEventDelay
<Code
IsFile=
"false"
>
from HTNBehaviors import SendUnitEventDelay
from HTNBehaviors import SendEntityEvent
from HTNBehaviors import SendEntityEvent
import cxxi.model.behavior.PythonUtilities as PythonUtilities
import cxxi.model.behavior.PythonUtilities as PythonUtilities
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import ConvertToJavaList
# used whenver the unit finishes moving (any move)
# used whenver the unit finishes moving (any move)
borg.redConvoysWaiting[state.getCurrentUnit().getName()].remove(info.getMyAssignedName())
borg.redConvoysWaiting[state.getCurrentUnit().getName()].remove(info.getMyAssignedName())
...
@@ -197,25 +200,48 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0:
...
@@ -197,25 +200,48 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0:
SendUnitEventDelay(state.getCurrentUnit().getName(), "GoalTracker_MoveToPoint", ["CONVOY", randSpd, destName], borg.delay)
SendUnitEventDelay(state.getCurrentUnit().getName(), "GoalTracker_MoveToPoint", ["CONVOY", randSpd, destName], borg.delay)
borg.delay=1.0
borg.delay=1.0
# log data
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "CONVOY_ARRIVED_AT_ASSEMBLY" "" ])], 0)
elif moveReason == "CONVOY":
elif moveReason == "CONVOY":
# setup off road
# setup off road
cmdName=""
destName = "EMPTY"
if state.isCommander():
if len(borg.redConvoyDest[state.getCurrentUnit().getName()])
>
0:
cmdName = info.getMyAssignedName()
destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0]
else:
# printMessage("LOC:"+str(destName), True)
cmdName = state.getCurrentCommander().getAssignedName()
# calculate how long on station they should be
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "CONVOY_ARRIVED" "" ])], 0.001)
borg.redNumSetups[state.getCurrentUnitName()]=borg.params_redNumSetups
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
# note this assumes an ASSEMBLY_LOCATION has been inserted between each location
borg.delay=1.0
# also the head of the list is one location ahead hence we check the next location
# log data
# is an assembly location if we need to do setups here
if state.isCommander():
if destName == "ASSEMBLY_LOCATION" or destName == "EMPTY":
from HTNBehaviors import SendEntityEventDelay
cmdName=""
from HTNBehaviors import ConvertToJavaList
if state.isCommander():
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "CONVOY_ARRIVED" "" ])], 0)
cmdName = info.getMyAssignedName()
else:
cmdName = state.getCurrentCommander().getAssignedName()
# calculate how long on station they should be
borg.redNumSetups[state.getCurrentUnitName()]=borg.params_redNumSetups
SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
else:
# we're at an assembly location, just wait
cmdName=""
if state.isCommander():
cmdName = info.getMyAssignedName()
else:
cmdName = state.getCurrentCommander().getAssignedName()
# calculate how long we should wait
randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
waitTime = borg.params_redWaitAtBaseForMin + (borg.params_redWaitAtBaseForVar * randVal)
SendEntityEventDelay(cmdName, "GoalTracker_ConvoyWaitAtBaseComplete", [], waitTime)
# log data
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "WAIT_AT_BASE" "" ])], 0.001)
</Code>
</Code>
<Import
/>
<Import
/>
...
@@ -429,6 +455,45 @@ if state.isCommander():
...
@@ -429,6 +455,45 @@ if state.isCommander():
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import ConvertToJavaList
from HTNBehaviors import ConvertToJavaList
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "PACKUP_COMPLETE" "" ])], 0)
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "PACKUP_COMPLETE" "" ])], 0)
</Code>
<Import
/>
</HTNNode>
</HTNNode>
<HTNNode
AllowMsg=
"true"
Name=
"isGoalTracker_ConvoyWaitAtBaseComplete"
Type=
"DEFAULT"
>
<Parent>
isGoalTracker_ConvoyReturn
</Parent>
<Code
IsFile=
"false"
>
if state.getLastTrigger() == "doGoalTracker_ConvoyWaitAtBaseComplete":
_htn_precon_ret=1
</Code>
<Import
/>
<HTNNode
AllowMsg=
"true"
Name=
"waitComplete"
Type=
"INTERRUPT"
>
<Parent>
isGoalTracker_ConvoyPackUp
</Parent>
<Code
IsFile=
"false"
>
import cxxi.model.behavior.PythonUtilities as PythonUtilities
from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import ConvertToJavaList
# complete the wait process
# reset the setup count
borg.redUnitStatus[state.getCurrentUnitName()] = 0
# go to next destination
# get a random speed
if borg.params_randSpdOverride
>
0:
randSpd = borg.params_randSpdOverride
else:
randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = borg.params_randSpdMin + (borg.params_randSpdVar * randVal)
destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0]
del borg.redConvoyDest[state.getCurrentUnit().getName()][0]
SendUnitEventDelay(state.getCurrentUnit().getName(), "GoalTracker_MoveToPoint", ["CONVOY", randSpd, destName], borg.delay)
borg.delay=1.0
# log data
if state.isCommander():
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "WAIT_AT_BASE_COMPLETE" "" ])], 0)
</Code>
</Code>
<Import
/>
<Import
/>
</HTNNode>
</HTNNode>
...
...
This diff is collapsed.
Click to expand it.
scripts/jump_start.py
+
4
−
0
View file @
6350301d
...
@@ -80,6 +80,10 @@ borg.params_useFakeConvoys = False
...
@@ -80,6 +80,10 @@ borg.params_useFakeConvoys = False
# use random background traffic
# use random background traffic
borg
.
params_useRandomMovers
=
False
borg
.
params_useRandomMovers
=
False
# how long to wait at base between training locations
borg
.
params_redWaitAtBaseForMin
=
120
borg
.
params_redWaitAtBaseForVar
=
0
# this lets you set the number of destinations to use
# this lets you set the number of destinations to use
# if 0 it will be determined randomly how many to use
# if 0 it will be determined randomly how many to use
# between 1 and 3
# between 1 and 3
...
...
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