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

LIB: Added bitmapped bytes and enumeration values ISO new architecture

Incorporated for backwards compatibility and to ensure that the current
GCS applications will work with the new architecture
parent b1039ab4
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,7 @@ PATROL_BOX_SHOOTER = 11 # Randomly patrol a rectangular box & engage approach
WAVE_ATTACK = 12 # Formation flyin and sequential drop
DELAYED_ATTACK = 13 # Time delay between individual attacks one one location
OVERWATCH_ATTACK = 14 # Formation flyin and sequential drop with highboy overwatch
DEFEND_AND_ATTACK = 15 # Half swarm area defense and the other half wave attack
SWARM_SEQUENCE_LAND = 99 # Land in order (low-to-high UAV)
# Obsolete behaviors that are still included for backwards compatibility
......@@ -163,6 +164,7 @@ SWARM_BHVRS = { SWARM_STANDBY: 'Standby', \
WAVE_ATTACK: 'Wave Grnd Attack', \
DELAYED_ATTACK: 'Delayed Grnd Attack', \
OVERWATCH_ATTACK: 'Overwatch Grnd Attack', \
DEFEND_AND_ATTACK: 'Defend and Grnd Attack', \
FIXED_TURN: 'Fixed Turn' }
SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \
......@@ -189,6 +191,7 @@ SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \
'Wave Grnd Attack': WAVE_ATTACK, \
'Delayed Grnd Attack': DELAYED_ATTACK, \
'Overwatch Grnd Attack': OVERWATCH_ATTACK, \
'Defend and Grnd Attack':DEFEND_AND_ATTACK, \
'Fixed Turn': FIXED_TURN }
# Enumeration for swarming states
......
......@@ -28,32 +28,35 @@ INT_LIST = 12 # Data field contains a series of ints
UINT_LIST = 13 # Data field contains a series of unsigned ints
FLOAT_LIST = 14 # Data field contains a series of floats
BEHAVIOR_STATE = 15 # Data field represents an updated behavior state (int)
LAT_LON = 16 # Data field contains a latitude/longitude
SEARCH_WP = 17 # Data field represents a series of waypoints
FIRING_REPORT = 18 # Data field represents an air-to-air firing report
ATTACK_REPORT = 19 # Data field represents an air-to-ground firing report
HIT_REPORT = 20 # Data field represents an air-to-air hit report
ID_VALUE_PAIRS = 21 # Data field represents a series of ID-value pairs
ID_FLOAT_PAIRS = 22 # Data field represents a series of ID-float (32-bit) pairs
CONSENSUS_SUMMARY = 23 # Data field represents a consensus algorithm summary
GEO_BOX = 24 # Data field represents a box (lat, lon, len, width, orient)
PURSUIT_MESSAGE = 25 # Data field represents a pursuit message
PURSUIT_UPDATE_REQUEST = 26 # List of Enemies being pursued
PURSUIT_LIST = 26 # Used to give new swarm member the pursuit list
RANGE_FOV = 27 # Data field represents a Constrained Shooter parameter message
WINGMAN_PARAMETERS = 28 # Data field represents a Wingman Parameter message
BOMB_MESSAGE = 29 # Data field represents a Bomb Parameter message
AUCTION_STATUS = 30 # Data field represents an AuctionSearch searcher update message
AUCTION_NEW = 31 # Data field represents an AuctionSearch new auction message
AUCTION_CELLS = 32 # Data field represents an AuctionSearch cells status message
AUCTION_BID = 33 # Data field represents an AuctionSearch bid message
AUCTION_CELLS_REQUEST = 34 # Data field represents an AuctionSearch cells status request message
AUCTION_BIDS_REQUEST = 35 # Data field represents an AuctionSearch cells status request message
AUCTION_COMPLETE = 36
BEHAVIOR_STATE = 15 # Data field represents an updated behavior state (int)
LAT_LON = 16 # Data field contains a latitude/longitude
SEARCH_WP = 17 # Data field represents a series of waypoints
FIRING_REPORT = 18 # Data field represents an air-to-air firing report
ATTACK_REPORT = 19 # Data field represents an air-to-ground firing report
HIT_REPORT = 20 # Data field represents an air-to-air hit report
ID_VALUE_PAIRS = 21 # Data field represents a series of ID-value pairs
ID_FLOAT_PAIRS = 22 # Data field represents a series of ID-float (32-bit) pairs
CONSENSUS_SUMMARY = 23 # Data field represents a consensus algorithm summary
GEO_BOX = 24 # Data field represents a box (lat, lon, len, width, orient)
GRND_ATTACK = 25 # Data field represents a ground attack order
DELAYED_GRND_ATTACK = 26 # Data field represents a delayed ground attack order
PATROL_AND_GRND_ATTACK = 27 # Data field represents a combined patrol & ground attack order
PURSUIT_MESSAGE = 28 # Data field represents a pursuit message
PURSUIT_UPDATE_REQUEST = 29 # List of Enemies being pursued
PURSUIT_LIST = 30 # Used to give new swarm member the pursuit list
RANGE_FOV = 31 # Data field represents a Constrained Shooter parameter message
WINGMAN_PARAMETERS = 32 # Data field represents a Wingman Parameter message
BOMB_MESSAGE = 33 # Data field represents a Bomb Parameter message
AUCTION_STATUS = 34 # Data field represents an AuctionSearch searcher update message
AUCTION_NEW = 35 # Data field represents an AuctionSearch new auction message
AUCTION_CELLS = 36 # Data field represents an AuctionSearch cells status message
AUCTION_BID = 37 # Data field represents an AuctionSearch bid message
AUCTION_CELLS_REQUEST = 38 # Data field represents an AuctionSearch cells status request message
AUCTION_BIDS_REQUEST = 39 # Data field represents an AuctionSearch cells status request message
AUCTION_COMPLETE = 40
class BitmappedBytes(object):
''' Abstract class template for customized parsing of byte arrays
......@@ -678,6 +681,60 @@ class DelayedGroundAttackOrderParser(BitmappedBytes):
self.delay = fields[4]
class AreaPatrolAndGroundAttackOrderParser(BitmappedBytes):
''' Parser for combined area patrol and ground attack orders
'''
fmt = ">llHHfllll"
def __init__(self):
''' Initializes parameters with default values
'''
self.box_sw_latitude = 0.0 # 7-decimal precision degrees
self.box_sw_longitude = 0.0 # 7-decimal precision degrees
self.box_length = 0
self.box_width = 0
self.box_orientation = 0.0
self.tgt_latitude = 0.0 # 7-decimal precision degrees
self.tgt_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
def pack(self):
''' Serializes parameter values into a bitmapped byte array
@return bitmapped bytes as a string
'''
tupl = (int(self.box_sw_latitude * 1e07), \
int(self.box_sw_longitude * 1e07), \
int(self.box_length), \
int(self.box_width), \
self.box_orientation, \
int(self.tgt_latitude * 1e07), \
int(self.tgt_longitude * 1e07), \
int(self.release_altitude * 1e02), \
int(self.runin_direction * 1e03))
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.box_sw_latitude = fields[0] / 1e07
self.box_sw_longitude = fields[1] / 1e07
self.box_length = fields[2]
self.box_width = fields[3]
self.box_orientation = fields[4]
self.tgt_latitude = fields[5] / 1e07
self.tgt_longitude = fields[6] / 1e07
self.release_altitude = fields[7] / 1e02
self.runin_direction = fields[8] / 1e03
class FiringReportParser(BitmappedBytes):
''' 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