-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPreyBrain.py
More file actions
36 lines (27 loc) · 1.14 KB
/
PreyBrain.py
File metadata and controls
36 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'''
(c) 2015 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see the LICENSE.txt file included with this software for more information
authors: Arindam Bose (arindam.1993@gmail.com), Tucker Balch (trbalch@gmail.com)
'''
from Agent import Agent
from Ball import Ball
from Obstacle import Obstacle
from LinearAlegebraUtils import getYPRFromVector
import numpy as np
from Action import Stun, Kick
from NavUtils import getObstacleAvoidance, getTeamNearestAvoidance, getRestrictionField
class PreyBrain(object):
'''
classdocs
'''
def __init__(self):
pass
def takeStep(self, myTeam=[], enemyTeam=[], balls=[], obstacles=[]):
actions = []
deltaPos = np.array([1, 0, 0])
avoidMovement = getObstacleAvoidance(obstacles)
avoidEnemyMovement = getTeamNearestAvoidance(enemyTeam)
fenceAvoidMovement = getRestrictionField(obstacles[1], 200)
movement = 1.5*avoidMovement + 2.0 * avoidEnemyMovement + 1.5*fenceAvoidMovement
deltaRot = getYPRFromVector(movement)
return deltaPos, deltaRot, actions