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

LIB: Added some functions to the GeoBox class

get_cartesian_corners: returns the Cartesian coordinates of the corner points
get_center_point: returns the lat/lon of the GeoBox center
parent 8a83c037
No related branches found
No related tags found
No related merge requests found
......@@ -114,10 +114,11 @@ PATROL_BOX = 13 # Randomly patrol a rectangular box
PATROL_BOX_SHOOTER = 14 # Randomly patrol a rectangular box & engage approaching red UAVs
TACTIC_INTERFACE = 15 # Use generic tactic interface
EVADER = 16 # Move to a waypoint while avoiding enemies
SIMPLE_GRND_ATTACK = 17 # Basic ground attack behavior (just land there)
WAVE_ATTACK = 18 # Formation flyin and sequential drop
DELAYED_ATTACK = 19 # Time delay between individual attacks one one location
OVERWATCH_ATTACK = 20 # Formation flyin and sequential drop with highboy overwatch
AREA_SPREAD = 17 # Disperse uniformly through a rectangular area
SIMPLE_GRND_ATTACK = 18 # Basic ground attack behavior (just land there)
WAVE_ATTACK = 19 # Formation flyin and sequential drop
DELAYED_ATTACK = 20 # Time delay between individual attacks one one location
OVERWATCH_ATTACK = 21 # 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_EGRESS = 99 # Egress the swarm for recovery
......@@ -149,6 +150,7 @@ SWARM_BHVRS = { SWARM_STANDBY: 'Standby', \
LAZY_ALTITUDE_SORT: 'Lazy Altitude Sort', \
SWARM_SEQUENCE_LAND: 'Sequence Land', \
INDEPENDENT_TRANSIT: 'Independent Transit', \
AREA_SPREAD: 'Area Spread', \
PATROL_BOX: 'Patrol Box', \
TACTIC_INTERFACE: 'Tactic Interface', \
EVADER: 'Evader', \
......@@ -173,6 +175,7 @@ SWARM_BHVR_VALUES = { 'Standby': SWARM_STANDBY, \
'Lazy Altitude Sort': LAZY_ALTITUDE_SORT, \
'Sequence Land': SWARM_SEQUENCE_LAND, \
'Independent Transit': INDEPENDENT_TRANSIT, \
'Area Spread': AREA_SPREAD, \
'Patrol Box': PATROL_BOX, \
'Patrol Box Shooter': PATROL_BOX_SHOOTER, \
'Evader': EVADER, \
......
......@@ -310,6 +310,9 @@ class GeoBox():
ne_corner[0], ne_corner[1]), \
cartesian_offset(sw_lat, sw_lon, \
se_corner[0], se_corner[1]) )
center_up = gps_newpos(sw_lat, sw_lon, orientation, length/2.0)
self._center = gps_newpos(center_up[0], center_up[1], \
orientation + math.pi/2.0, width/2.0)
self._floor = floor
self._ceiling = ceiling
self._length = length
......@@ -338,6 +341,12 @@ class GeoBox():
return tuple(self._corners)
def get_cartesian_corners(self):
''' Returns a tuple containing the GeoBox object's corners
'''
return tuple(self._cart_corners)
def contains(self, lat, lon, alt):
''' Returns True if the GeoBox contains the lat/lon/alt point
@param lat: latitude being tested
......@@ -416,6 +425,12 @@ class GeoBox():
return gps_newpos(self._corners[0][0], self._corners[0][1], brng, dist)
def center_point(self):
''' Returns the latitude/longitude of the GeoBox's center point
'''
return self._center
def __vector_aligned_pts(self, lat, lon):
''' Returns a series of cartesian coordinates corresponding to
positions relative to each of the four corners of the box
......
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