import Javaclient.src.*; import java.util.Vector; /** This is the bootstrapping device for the Rover implementation. It does the socket connect, holds all the devices, and does all the boring stuff so that Rover can do all the fun stuff. */ public abstract class Robot implements Runnable { public PlayerClient pc; public PositionPlayerDevice ppd; public LaserPlayerDevice lpd; public PtzPlayerDevice ptz; public BlobfinderInterface bfi; public FiducialInterface fi; public String host; public int port; /** creates a robot and activates the PlayerClient devices (for issuing odometry-related ans sensor-related commands) */ Robot (String host, int port) { super(); this.host = host; this.port = port; pc = new PlayerClient(host, port); ppd = pc.requestPosition('a'); ptz = pc.requestPtz('a'); lpd = pc.requestLaser('r'); bfi = pc.requestBlobfinder('r'); fi = pc.requestFiducial('a'); } /** Delegates the lifeCycle method downward to the subclasses to provide encapsulation. */ public void run () { lifeCycle(); } /** Implemented by concrete subclasses */ public abstract void lifeCycle(); }