Wiki

Clone wiki

robobo-programming / native / emotion-library

Using the emotion library

The emotion library is used to manage the emotions shown on the screen of the smartphone, it consists in only a module:

Emotion module

The interface of the module is the following:

public interface IEmotionModule extends IModule {


    public void setCurrentEmotion(Emotion emotion);

    public Emotion getCurrentEmotion();

    public void setTemporalEmotion(Emotion temporalEmotion, long duration, Emotion nextEmotion)

    public void subscribe(IEmotionListener listener);

    public void ubsubscribe(IEmotionListener listener);

    public void subscribeTouchListener(ITouchEventListener listener);

    public void unsubscribeTouchListener(ITouchEventListener listener);

    public CameraBridgeViewBase getCameraBridgeView();

    public void setCameraBridgeView(CameraBridgeViewBase viewBase);


}
setCurrentEmotion() and setTemporalEmotion() are used to change the emotion displayed on the screen. The class Emotion represents the diferent emotions that can be displayed, those are the following and are in constant update as the module is updated:

public enum Emotion {

    HAPPY,
    SAD,
    ANGRY,
    SMYLING,
    LAUGHING,
    EMBARRASSED,
    SURPRISED,
    IN_LOVE,
    NORMAL,
    SLEEPING;

}

suscribe() and unsuscribe() are used to suscribe classes implementing IEmotionListener to the notificatons of changing emotions.

The interface of IEmotionListener is the following:

public interface IEmotionListener {

    public void newEmotion(Emotion emotion);

}
newEmotion() is called when the on screen face changes with the new emotion as a parameter

suscribeTouchListener() and unsuscribeTouchListener() are used to get the touch events on the screen.

getCameraBridgeView() and setCameraBridgeView() are utility methods needed by the vision library modules, and needed to capture frames from the camera.

The implementation of the module is DefaultEmotionModule.java.

To get this module working, there must be an activity on the main application which manages the screen faces and implements IEmotionListener, the default faces activity bundled with the app is UnityPlayerActivity.java

Obtaining the instance of the module

IEmotionModule emotionModule = roboboManager.getModuleInstance(IEmotionModule.class);

Current implementation

DefaultEmotionModule:

robobo.module.6=com.mytechia.robobo.framework.hri.emotion.DefaultEmotionModule

The javadoc documentation of this module can be found here

Updated