Skip to content
Snippets Groups Projects
Commit 23ff4c38 authored by spiglerg's avatar spiglerg
Browse files

test1

parent 1154e8da
No related branches found
No related tags found
No related merge requests found
......@@ -29,18 +29,23 @@ class EnvAgentStatic(object):
direction = attrib()
target = attrib()
moving = attrib()
speed_data = attrib()
def __init__(self, position, direction, target, moving=False):
def __init__(self, position, direction, target, moving=False, speed_data={'position_fraction':0.0, 'speed':1.0, 'transition_action_on_cellexit':2}):
self.position = position
self.direction = direction
self.target = target
self.moving = moving
self.speed_data = speed_data
@classmethod
def from_lists(cls, positions, directions, targets):
""" Create a list of EnvAgentStatics from lists of positions, directions and targets
"""
return list(starmap(EnvAgentStatic, zip(positions, directions, targets, [False] * len(positions))))
speed_datas = []
for i in range(len(positions)):
speed_datas.append( speed_data={'position_fraction':0.0, 'speed':1.0, 'transition_action_on_cellexit':2} )
return list(starmap(EnvAgentStatic, zip(positions, directions, targets, [False] * len(positions), speed_datas)))
def to_list(self):
......@@ -54,7 +59,7 @@ class EnvAgentStatic(object):
if type(lTarget) is np.ndarray:
lTarget = lTarget.tolist()
return [lPos, int(self.direction), lTarget, int(self.moving)]
return [lPos, int(self.direction), lTarget, int(self.moving), self.speed_data]
@attrs
......@@ -78,7 +83,7 @@ class EnvAgent(EnvAgentStatic):
def to_list(self):
return [
self.position, self.direction, self.target, self.handle,
self.old_direction, self.old_position, self.moving]
self.old_direction, self.old_position, self.moving, self.speed_data]
@classmethod
def from_static(cls, oStatic):
......
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