uk.ac.ed.inf.sdp2012.group7.control
Class RobotControl

java.lang.Object
  extended by uk.ac.ed.inf.sdp2012.group7.control.RobotControl
All Implemented Interfaces:
ConstantsReuse

public class RobotControl
extends java.lang.Object
implements ConstantsReuse

This class holds the geometric location of our robot but is also responsible for communicating with it.


Nested Class Summary
 
Nested classes/interfaces inherited from interface uk.ac.ed.inf.sdp2012.group7.control.ConstantsReuse
ConstantsReuse.OpCodes
 
Field Summary
static org.apache.log4j.Logger logger
           
 
Fields inherited from interface uk.ac.ed.inf.sdp2012.group7.control.ConstantsReuse
ROBOT_MAC, ROBOT_NAME
 
Constructor Summary
RobotControl()
           
 
Method Summary
 void beep()
          Commands the robot to make a noise
 void changeSpeed(int speed)
          Changes the speed the robot is travelling at
 void circleWithRadius(int radius, boolean arcLeft)
          Commands the robot to move forwards on an arc with a certain radius from the centre of the robot
 boolean isConnected()
           
 void kick()
          Commands the robot to kick
 void logResponse(ConstantsReuse.OpCodes response)
           
 void moveBackward()
          Commands the robot to move backward
 void moveBackward(int speed)
          Commands the robot to move backward at a speed
 void moveBackwardDistance(int distance)
          Commands the robot to move backward
 void moveForward()
          Commands the robot to move forward
 void moveForward(int speed)
           
 void moveForwardDistance(int distance)
          Commands the robot to move forwards a certain distance
 void rotateBy(double radians)
           
 void rotateBy(double radians, boolean block)
           
 void rotateBy(double radians, boolean block, boolean left)
          Rotates the robot by the given number of radians
 void setConnected(boolean isConnected)
           
 boolean startCommunications()
          This method initialises the connection and starts the thread which sends data to the robot
 void startMatch()
          Commands the robot to move forward indefinitely and start odometry from its initial position (if the bluetooth connection is lost, it'll try to move back to the initial position)
 void stop()
          Commands the robot to stop where it is
 void stopCommunications()
          Stops the connection with the Robot
 void stopMatch()
          Commands the robot to stop movement and recording odometry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final org.apache.log4j.Logger logger
Constructor Detail

RobotControl

public RobotControl()
Method Detail

startCommunications

public boolean startCommunications()
This method initialises the connection and starts the thread which sends data to the robot

Returns:
True if the connection has been established, false otherwise

stopCommunications

public void stopCommunications()
Stops the connection with the Robot


changeSpeed

public void changeSpeed(int speed)
Changes the speed the robot is travelling at

Parameters:
speed -

moveForward

public void moveForward()
Commands the robot to move forward


moveForward

public void moveForward(int speed)

moveForwardDistance

public void moveForwardDistance(int distance)
Commands the robot to move forwards a certain distance

Parameters:
distance - Measured in cm

moveBackward

public void moveBackward()
Commands the robot to move backward


moveBackward

public void moveBackward(int speed)
Commands the robot to move backward at a speed


moveBackwardDistance

public void moveBackwardDistance(int distance)
Commands the robot to move backward


stop

public void stop()
Commands the robot to stop where it is


kick

public void kick()
Commands the robot to kick


rotateBy

public void rotateBy(double radians,
                     boolean block,
                     boolean left)
Rotates the robot by the given number of radians

Parameters:
radians -

rotateBy

public void rotateBy(double radians,
                     boolean block)

rotateBy

public void rotateBy(double radians)

circleWithRadius

public void circleWithRadius(int radius,
                             boolean arcLeft)
Commands the robot to move forwards on an arc with a certain radius from the centre of the robot

Parameters:
radius -
arcLeft - If true the robot will go left, otherwise will go right

beep

public void beep()
Commands the robot to make a noise


startMatch

public void startMatch()
Commands the robot to move forward indefinitely and start odometry from its initial position (if the bluetooth connection is lost, it'll try to move back to the initial position)


stopMatch

public void stopMatch()
Commands the robot to stop movement and recording odometry


setConnected

public void setConnected(boolean isConnected)

isConnected

public boolean isConnected()

logResponse

public void logResponse(ConstantsReuse.OpCodes response)