001/* This source code is released under the new BSD license, a copy of the
002 * license is in the distribution directory. */
003
004package mazerob.conn;
005
006import java.io.IOException;
007import lejos.robotics.RangeReadings;
008
009/**
010 * Specification of functionality of a maze solving robot ({@link
011 * mazerob.pc.Robot} and {@link mazerob.nxt.Robot})
012 *
013 * @author Pedro I. López
014 *
015 */
016public interface RemotelyControllable {
017    /**
018     * Message showed when the Bluetooth connection is closed
019     */
020    static final String CLOSING_CONN_MSG = "Closing BT Connection";
021
022    /**
023     * Array of angles at which range readings are to be taken by the
024     * implementation of the {@link mazerob.conn.RemotelyControllable#scan}
025     * method.
026     */
027    static final float[] SCANNING_ANGLES = {0f, 45f, 90f, 135f, 180f};
028
029    /** Translate a specific distance in a straight line
030     *
031     * <p>A positive distance causes forward motion, a negative distance
032     * translates backward.</p>
033     *
034     * @param distance The distance to move
035     *
036     * @throws IOException
037     *
038     */
039    public void translate(double distance) throws IOException;
040
041    /** Translate forward */
042    public void translateForward() throws IOException;
043
044    /** Translate backward */
045    public void translateBackward() throws IOException;
046
047    /** Rotate through specific angle
048     *
049     * @param angle The wanted angle of rotation in degrees
050     *
051     * @throws IOException
052     *
053     */
054    public void rotate(double angle) throws IOException;
055
056    /** Rotate to the right */
057    public void rotateRight() throws IOException;
058
059    /** Rotate to the left */
060    public void rotateLeft() throws IOException;
061
062    /** Scan the environment for object detection 
063     *
064     * <p>Scanning angles specified by {@link
065     * mazerob.conn.RemotelyControllable#SCANNING_ANGLES}.</p>
066     *
067     * @return A set of {@link lejos.robotics.RangeReadings} taken the
068     * angles specified.
069     *
070     * @throws IOException
071     *
072     */
073    public RangeReadings scan() throws IOException;
074
075    /** End the connection/program */
076    public void end() throws IOException;
077}