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)
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())
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())
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))
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)
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)
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))
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))
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))