
APT.all-test.MOUTBot.execute-mission.sentry-watch.scan-for-contacts.determine-step-rate.soar Maven / Gradle / Ivy
#####################################
# file: determine-step-rate.soar
# created: REW: 2001-08-23
##
# Determine how far to turn and how fast
# Change history:
#
# [1] REW:
echo "\nLoading execute-mission/sentry-watch/scan-for-contacts/determine-step-rate.soar"
# Note: this could easily be pre-computed if the input params are
# really fixed, but this gives us the option for determining fast,slow
# scans, randomization, etc.
sp {scan-for-contacts*propose*determine-step-rate
(state ^name scan-for-contacts
-^step-rate
^top-state.parameters )
(
^scan-angle
^scan-period
^scan-step )
-->
( ^operator +, = 50)
( ^name determine-step-rate
^scan-angle
^scan-period
^scan-step )
}
# REW: 2002-10-10
# SoarAPI bots were crashing when this production fired. Soar printed message about thin-justification.
# After much experiemnting, determined that separating result and local state elab resulted in no
# crash, so that's the workaround for now (ie, number of steps and step rate are computed in separate prods).
# REW:
# period = period of time for the scan (sec)
# angle = angle to be covered during the scan
# step = size (in degrees) of increments in the scan
# step rate = period/total steps = period/(angle/step) = period * step/angle
# Assume sweep to right for now, needs to be negative for left sweep
sp {apply*determine-step-rate*right
(state ^operator
^objective.sentry-watch.scan )
( ^scan-direction right )
( ^name determine-step-rate
^scan-period
^scan-angle
^scan-step )
-->
( ^step-rate (/ (* ) ) )
}
# Make scan-step negative for left scan
sp {apply*determine-step-rate*left
(state ^operator
^objective.sentry-watch.scan )
( ^scan-direction left )
( ^name determine-step-rate
^scan-period
^scan-angle
^scan-step )
-->
( ^step-rate (/ (* (- 0 )) ) )
}
sp {apply*determine-step-rate*number-of-steps
(state ^operator
^objective.sentry-watch.scan )
( ^name determine-step-rate
^scan-angle
^scan-step )
-->
( ^number-of-steps (/ ) )
}