RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.irobot.examples; 00002 00003 import rlpark.plugin.irobot.data.RoombaLeds; 00004 import rlpark.plugin.irobot.robots.RoombaRobot; 00005 00006 public class RoombaClient { 00007 private int cleanColor; 00008 private final RoombaRobot environment = new RoombaRobot(); 00009 private final RoombaLeds leds = new RoombaLeds(); 00010 00011 private void run() { 00012 environment.fullMode(); 00013 while (!environment.isClosed()) { 00014 environment.waitNewObs(); 00015 updateRobotLeds(); 00016 environment.sendAction(60, -60); 00017 } 00018 } 00019 00020 private void updateRobotLeds() { 00021 leds.intensity = 255; 00022 leds.cleanColor = cleanColor; 00023 cleanColor = (cleanColor + 5) % 256; 00024 leds.dirt = !leds.dirt; 00025 environment.sendLeds(leds); 00026 } 00027 00028 public static void main(String[] args) { 00029 new RoombaClient().run(); 00030 } 00031 }