コード例 #1
0
 def zephyrize(self):
     clock = self.environment.clock()
     zepy.advertise(self.environment, clock)
     zepy.advertise(self.demons, clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction,
                      'rewardValue',
                      clock=clock,
                      label=rewardFunction.label)
コード例 #2
0
ファイル: CreateNexting.py プロジェクト: pilarski/rlpark
 def zephyrize(self):
     Zephyr.registerLabeledCollection(self, "demons", "")
     monitoredList = [self.verifiers, self.environment, self.demons]
     for monitored in monitoredList:
         zepy.advertise(monitored, self.clock)
         self.logfile.add(monitored, 0)
     monitor = ZephyrPlotting.createMonitor(self.clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction, "rewardValue", clock=self.clock, label=rewardFunction.label())
コード例 #3
0
ファイル: CreateNexting.py プロジェクト: denizonural/rlpark
 def zephyrize(self):
     Zephyr.registerLabeledCollection(self, "demons", "")
     monitoredList = [self.verifiers, self.environment, self.demons]
     for monitored in monitoredList:
         zepy.advertise(monitored, self.clock)
         self.logfile.add(monitored, 0)
     monitor = ZephyrPlotting.createMonitor(self.clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction,
                      'rewardValue',
                      clock=self.clock,
                      label=rewardFunction.label())
コード例 #4
0
ファイル: CreateIntroSession.py プロジェクト: amw8/rlpark
from rlpark.plugin.irobot.data import CreateAction;
from rlpark.plugin.irobot.data import IRobotDrops;
from rlpark.plugin.irobot.robots import CreateRobot;
from zephyr.plugin.core.api.synchronization import Clock
import zepy

if __name__ == '__main__':
    robot = CreateRobot("/dev/cu.ElementSerial-ElementSe")
    clock = Clock()
    zepy.advertise(robot, clock)
    bumpRightObsIndex = robot.legend().indexOf(IRobotDrops.BumpRight)
    bumpLeftObsIndex = robot.legend().indexOf(IRobotDrops.BumpLeft)
    robot.safeMode()
    while clock.tick():
      obs = robot.waitNewObs()
      wheelLeft = 150 if obs[bumpRightObsIndex] == 0 else -150
      wheelRight = 150  if obs[bumpLeftObsIndex] == 0 else -70
      robot.sendAction(CreateAction(wheelLeft, wheelRight))
      
コード例 #5
0
ファイル: DemonsControlOffPolicy.py プロジェクト: amw8/rlpark
 def zephyrize(self):
     clock = self.environment.clock()
     zepy.advertise(self.environment, clock)
     zepy.advertise(self.demons, clock)
     for rewardFunction in self.rewards:
         zepy.monattr(rewardFunction, 'rewardValue', clock = clock, label = rewardFunction.label)
コード例 #6
0
 def zephyrize(self):
     zepy.advertise(self.clock, self.environment)
     zepy.advertise(self.clock, self.horde)
     for rewardFunction in self.rewards:
         zepy.monattr(self.clock, rewardFunction, 'rewardValue', label = rewardFunction.label)
コード例 #7
0
ファイル: RoombaExample.py プロジェクト: denizonural/rlpark
from rlpark.plugin.irobot.data import CreateAction
from rlpark.plugin.irobot.data import IRobotDrops
from rlpark.plugin.irobot.robots import RoombaRobot
import zepy

if __name__ == '__main__':
    robot = RoombaRobot()
    zepy.advertise(robot)
    bumpRightObsIndex = robot.legend().indexOf(IRobotDrops.BumpRight)
    bumpLeftObsIndex = robot.legend().indexOf(IRobotDrops.BumpLeft)
    robot.safeMode()
    while not robot.isClosed():
        obs = robot.waitNewObs()
        wheelLeft = 100 if obs[bumpRightObsIndex] == 0 else -100
        wheelRight = 100 if obs[bumpLeftObsIndex] == 0 else -70
        robot.sendAction(CreateAction(wheelLeft, wheelRight))
コード例 #8
0
ファイル: RoombaExample.py プロジェクト: amw8/rlpark
from rlpark.plugin.irobot.data import CreateAction;
from rlpark.plugin.irobot.data import IRobotDrops;
from rlpark.plugin.irobot.robots import RoombaRobot;
import zepy

if __name__ == '__main__':
    robot = RoombaRobot()
    zepy.advertise(robot)
    bumpRightObsIndex = robot.legend().indexOf(IRobotDrops.BumpRight)
    bumpLeftObsIndex = robot.legend().indexOf(IRobotDrops.BumpLeft)
    robot.safeMode()
    while not robot.isClosed():
      obs = robot.waitNewObs()
      wheelLeft = 100 if obs[bumpRightObsIndex] == 0 else -100
      wheelRight = 100  if obs[bumpLeftObsIndex] == 0 else -70
      robot.sendAction(CreateAction(wheelLeft, wheelRight))
コード例 #9
0
from rlpark.plugin.irobot.data import CreateAction
from rlpark.plugin.irobot.data import IRobotDrops
from rlpark.plugin.irobot.robots import CreateRobot
from zephyr.plugin.core.api.synchronization import Clock
import zepy

if __name__ == '__main__':
    robot = CreateRobot("/dev/cu.ElementSerial-ElementSe")
    clock = Clock()
    zepy.advertise(robot, clock)
    bumpRightObsIndex = robot.legend().indexOf(IRobotDrops.BumpRight)
    bumpLeftObsIndex = robot.legend().indexOf(IRobotDrops.BumpLeft)
    robot.safeMode()
    while clock.tick():
        obs = robot.waitNewObs()
        wheelLeft = 150 if obs[bumpRightObsIndex] == 0 else -150
        wheelRight = 150 if obs[bumpLeftObsIndex] == 0 else -70
        robot.sendAction(CreateAction(wheelLeft, wheelRight))