All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mytechia.robobo.rob.comm.IRobComm Maven / Gradle / Ivy

There is a newer version: 1.1.8
Show newest version
/*******************************************************************************
 *
 *   Copyright 2016 Mytech Ingenieria Aplicada 
 *   Copyright 2016 Julio Gómez 
 *
 *   This file is part of Robobo ROB Interface Library.
 *
 *   Robobo ROB Interface Library is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Robobo ROB Interface Library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Robobo ROB Interface Library.  If not, see .
 *
 ******************************************************************************/

package com.mytechia.robobo.rob.comm;

import com.mytechia.commons.framework.simplemessageprotocol.exception.CommunicationException;
import com.mytechia.robobo.rob.RobMotorEnum;

/**
 * This is the low level communication interface between the smartphone (OBO)
 * and the robotic platform (ROB).
 */
public interface IRobComm {

    /**
     * Changes the color of the LED light identified by 'ledId'.
     *
     * @param ledId the identifier of the LED light whose color is going to
     * change
     * @param r the red value of the RGB color
     * @param g the green value of the RGB color
     * @param b the blue value of the RGB color
     * @throws CommunicationException when communication with the base is not possible
     */
    public void setLEDColor(int ledId, int r, int g, int b) throws CommunicationException;

    /**
     * Changes the automatic mode of operation of the LEDs.
     *
     * @param mode the new mode of operation of the LEDs
     * @throws CommunicationException when communication with the base is not possible
     */
    public void setLEDsMode(byte mode) throws CommunicationException;

    /**
     * Sends a move command to the two motors in charge of wheel movement.
     *
     * The 'mode' paramter configures the direction of movement of the motors: -
     * 0 --- STOP | STOP - 1 --- REVERSE | REVERSE - 2 --- FORWARD | FORWARD - 4
     * --- FORWARD | REVERSE - 8 --- REVERSE | FORWARD
     * @param angVel1 angular velocity of the motor 1
     * @param angle1 total angle of movement of the motor 1
     * @param angVel2 angular velocity of the motor 2
     * @param angle2 total angle of movement of the motor 2
     * @throws CommunicationException when communication with the base is not possible
     */
    public void moveMT(short angVel1, int angle1, short angVel2, int angle2) throws CommunicationException;

    /**
     * Sends a move command to the two motors in charge of wheel movement.
     *
     * The 'mode' paramter configures the direction of movement of the motors: -
     * 0 --- STOP | STOP - 1 --- REVERSE | REVERSE - 2 --- FORWARD | FORWARD - 4
     * --- FORWARD | REVERSE - 8 --- REVERSE | FORWARD
     *
     * @param angVel1 angular velocity of the motor 1
     * @param angVel2 angular velocity o the motor 2
     * @param time total time duration of the movement
     * @throws CommunicationException when communication with the base is not possible
     */
    public void moveMT(short angVel1, short angVel2, long time) throws CommunicationException;

    /**
     * Sends a move command to the motor in charge of the smartphone PAN
     * movement.
     *
     * @param angVel angular velocity of the motor
     * @param angle total angle of movement
     * @throws CommunicationException when communication with the base is not possible
     */
    public void movePan(int angVel, int angle) throws CommunicationException;

    /**
     * Sends a move command to the motor in charge of the smartphone TILT
     * movement.
     *
     * @param angVel angular velocity of the motor
     * @param angle total angle of movement
     * @throws CommunicationException when communication with the base is not possible
     */
    public void moveTilt(int angVel, int angle) throws CommunicationException;

    /**
     * Resets the pan and tilt offset...
     *
     * @throws CommunicationException when communication with the base is not possible
     */
    public void resetPanTiltOffset() throws CommunicationException;

    /**
     * Changes the period used by the ROB to send ROB-STATUS-MESSAGES.
     *
     * @param period the period in millisecods, a value of 0 stops the sending
     * of status messages
     * @throws CommunicationException when communication with the base is not possible
     */
    public void setRobStatusPeriod(int period) throws CommunicationException;

    void addRobStatusListener(IRobCommStatusListener rsListener);

    void removeRobStatusListener(IRobCommStatusListener rsListener);

    void addStopWarningListener(IRobCommStopWarningListener swListener);



    void removeStopWarningListener(IRobCommStopWarningListener swListener);

    void setOperationMode(byte operationMode) throws CommunicationException;

    void infraredConfiguration(byte infraredId, byte commandCode, byte dataByteLow, byte dataByteHigh) throws CommunicationException;

    void maxValueMotors(int m1Tension, int m1Time, int m2Tension, int m2Time, int panTension, int panTime,
            int tiltTension, int tiltTime) throws CommunicationException;

    void resetRob() throws CommunicationException;

    void changeRobName(String name) throws CommunicationException;

    void resetWheelEncoders(RobMotorEnum motor) throws CommunicationException;

    void addRobCommErrorListener(IRobCommErrorListener listener);

    void removeRobCommErrorListener(IRobCommErrorListener listener);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy