Skip to content
Snippets Groups Projects
Commit 5f681adb authored by Davis, Duane T's avatar Davis, Duane T
Browse files

LIB: Added enums & bitmapped message types for overwatch and delayed attack

parent 5e006410
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,9 @@ TACTIC_INTERFACE = 15 # Use generic tactic interface ...@@ -109,7 +109,9 @@ TACTIC_INTERFACE = 15 # Use generic tactic interface
EVADER = 16 # Move to a waypoint while avoiding enemies EVADER = 16 # Move to a waypoint while avoiding enemies
SIMPLE_GRND_ATTACK = 17 # Basic ground attack behavior (just land there) SIMPLE_GRND_ATTACK = 17 # Basic ground attack behavior (just land there)
WAVE_ATTACK = 18 # Formation flyin and sequential drop WAVE_ATTACK = 18 # Formation flyin and sequential drop
FIXED_TURN = 19 # Simple test behavior for turn-rate control capability DELAYED_ATTACK = 19 # Time delay between individual attacks one one location
OVERWATCH_ATTACK = 20 # Formation flyin and sequential drop with highboy overwatch
FIXED_TURN = 97 # Simple test behavior for turn-rate control capability
SWARM_SEQUENCE_LAND = 98 # Land in order (low-to-high UAV) SWARM_SEQUENCE_LAND = 98 # Land in order (low-to-high UAV)
SWARM_EGRESS = 99 # Egress the swarm for recovery SWARM_EGRESS = 99 # Egress the swarm for recovery
...@@ -134,6 +136,8 @@ SWARM_BHVRS = { SWARM_STANDBY: 'Standby', \ ...@@ -134,6 +136,8 @@ SWARM_BHVRS = { SWARM_STANDBY: 'Standby', \
PATROL_BOX_SHOOTER: 'Patrol Box Shooter', \ PATROL_BOX_SHOOTER: 'Patrol Box Shooter', \
SIMPLE_GRND_ATTACK: 'Simple Grnd Attack', \ SIMPLE_GRND_ATTACK: 'Simple Grnd Attack', \
WAVE_ATTACK: 'Wave Grnd Attack', \ WAVE_ATTACK: 'Wave Grnd Attack', \
DELAYED_ATTACK: 'Delayed Grnd Attack', \
OVERWATCH_ATTACK: 'Overwatch Grnd Attack', \
FIXED_TURN: 'Fixed Turn' } FIXED_TURN: 'Fixed Turn' }
SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \ SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \
...@@ -156,6 +160,8 @@ SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \ ...@@ -156,6 +160,8 @@ SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \
'Tactic Interface' : TACTIC_INTERFACE, \ 'Tactic Interface' : TACTIC_INTERFACE, \
'Simple Grnd Attack': SIMPLE_GRND_ATTACK, \ 'Simple Grnd Attack': SIMPLE_GRND_ATTACK, \
'Wave Grnd Attack': WAVE_ATTACK, \ 'Wave Grnd Attack': WAVE_ATTACK, \
'Delayed Grnd Attack': DELAYED_ATTACK, \
'Overwatch Grnd Attack': OVERWATCH_ATTACK, \
'Fixed Turn': FIXED_TURN } 'Fixed Turn': FIXED_TURN }
# Enumeration for swarming states # Enumeration for swarming states
......
...@@ -629,6 +629,48 @@ class GroundAttackOrderParser(BitmappedBytes): ...@@ -629,6 +629,48 @@ class GroundAttackOrderParser(BitmappedBytes):
self.runin_direction = fields[3] / 1e03 self.runin_direction = fields[3] / 1e03
class DelayedGroundAttackOrderParser(BitmappedBytes):
''' Parser for ground attack orders
'''
fmt = ">llllH2x"
def __init__(self):
''' Initializes parameters with default values
'''
self.latitude = 0.0 # 7-decimal precision degrees
self.longitude = 0.0 # 7-decimal precision degrees
self.release_altitude = 0.0 # 2-decimal precision meters MSL
self.runin_direction = 0.0 # 3-decimal precision degrees
self.delay = 0 # Seconds between drops
def pack(self):
''' Serializes parameter values into a bitmapped byte array
@return bitmapped bytes as a string
'''
tupl = (int(self.latitude * 1e07), \
int(self.longitude * 1e07), \
int(self.release_altitude * 1e02), \
int(self.runin_direction * 1e03), \
int(self.delay))
return struct.pack(type(self).fmt, *tupl)
def unpack(self, bytes):
''' Sets parameter values from a bitmapped byte array
@param bytes: bitmapped byte array
'''
fields = struct.unpack_from(type(self).fmt, bytes, 0)
# Place unpacked but unconverted fields into message elements
self.latitude = fields[0] / 1e07
self.longitude = fields[1] / 1e07
self.release_altitude = fields[2] / 1e02
self.runin_direction = fields[3] / 1e03
self.delay = fields[4]
class FiringReportParser(BitmappedBytes): class FiringReportParser(BitmappedBytes):
''' Parser for firing report messages orders ''' Parser for firing report messages orders
''' '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment