Skip to content

Commit

Permalink
Write graph integration
Browse files Browse the repository at this point in the history
  • Loading branch information
synaptek committed Sep 29, 2016
1 parent 1a06be8 commit 7fa5d20
Show file tree
Hide file tree
Showing 87 changed files with 19,504 additions and 1,430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

{ "type":"Sm_Data",
"datasource":"",
//"datasource":"{\"scene_bindings\" : {\"word_copy\": {\"type\": \"SCENEDATA_MAP\", \"databindings\": [{\"name\": \"Sstimulus\",\"datasource\": \"[file]wc_data.json\"}]}}}",
//"datasource":"{\"scene_bindings\" : {\"word_copy\": {\"type\": \"SCENEDATA_MAP\", \"databindings\": [{\"name\": \"word_copy\",\"datasource\": \"[file]wc_data.json\"}]}}}",
"intent": "word_copy", "intentdata":"native", "buttontype":"text" , "buttonvalue":"Word Copy"}
]
},
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
63 changes: 49 additions & 14 deletions app/src/main/assets/tutors/word_copy/animator_graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"title": "Word copying tutor",
"COMMENT": "This tutor is designed for copying words.",
"version": "1.0.0",
"rootnode": "INTRO_STATE",
"rootnode": "DEMO_STATE",

"nodeMap": {

"COMMENT": "@@@@@ CNodes @@@@@",

"TEMP_STATE": {
"DEMO_SELECT": {
"type": "NODE",
"COMMENT": "Intro Clip",
"maptype":"actionMap",
Expand All @@ -29,14 +29,28 @@
]
},

"DEMO_STATE": {
"type": "NODE",
"COMMENT": "Interaction Demo",
"maptype":"moduleMap",
"mapname":"DEMO_MODULE",
"preenter":["SET_VERSION","SET_DEMOSOURCE","FW_DISABLE","NEXT_WORD"],
"preexit" :[],
"edges": [
{
"constraint": "",
"edge": "NEWWORD"
}
]
},

"INTRO_STATE": {
"type": "NODE",
"COMMENT": "Intro Clip",
"maptype":"moduleMap",
"mapname": "PLAYINTRO",
"preenter":["SET_VERSION","SET_DATASOURCE","FW_SET_REC","FW_DISABLE"],
// "preenter":["SET_VERSION","FW_SET_REC","FW_DISABLE"],
"preenter":["SET_VERSION","SET_DATASOURCE","FW_DISABLE"],
// "preenter":["SET_VERSION","FW_DISABLE"],
"preexit" :[],
"edges": [
{
Expand All @@ -49,7 +63,7 @@
"NEWWORD":{
"COMMENT":"This node presents a word for user to copy.",
"type":"node",
"preenter":["GETWORD"],
"preenter":["NEXT_WORD"],
"maptype":"moduleMap",
"mapname": "PLAYWORD",
"preexit" :[],
Expand Down Expand Up @@ -158,6 +172,28 @@

"COMMENT": "@@@@@ CModules @@@@@",

"SET_DEMOSOURCE": {
"type":"MODULE",
"reuse":true,
"COMMENT": "Initialize the data source - ",
"tracks": [
{"type": "COMMAND", "id": "word_copy", "method": "setDataSource", "parms": "[saba]:String","features":"LANG_SW"},
{"type": "COMMAND", "id": "word_copy", "method": "setDataSource", "parms": "[one]:String","features":"LANG_EN"}
]
},

"DEMO_MODULE": {
"type":"MODULE",
"reuse":true,
"COMMENT": "Initialize the data source - ",
"tracks": [
{"type": "COMMAND", "id": "word_copy", "method": "postEvent", "parms": "RIPPLE_DEMO:String|1000:Integer", "features":""},
{"type": "AUDIO", "command": "PLAY", "soundsource": "Now lets practice writing some words.mp3", "soundpackage":"default", "volume": 1.0, "mode":"flow", "features": ""},
{"type": "COMMAND", "cmd": "WAIT" }
]
},


"PLAYINTRO":{
"type": "MODULE",
"reuse":true,
Expand All @@ -172,10 +208,11 @@
"reuse":true,
"COMMENT": "TBD",
"tracks": [
{"type": "COMMAND", "id": "Sstimulus", "method": "show", "parms": "TRUE:Boolean","features":""},
//{"type": "COMMAND", "id": "Sstimulus", "method": "show", "parms": "TRUE:Boolean","features":""},
{"type": "COMMAND", "id": "Sstimulus", "method": "zoomInOut", "parms": "2.0:Float:1000:Long","features":""},
//{"type": "AUDIO", "command": "PLAY", "soundsource": "This is the number.mp3", "mode":"flow", "features": ""},
{"type": "AUDIO", "command": "PLAY", "soundsource": "{{Sstimulus.value}}.mp3", "mode":"flow", "features": ""} //the stimulus digit
// {"type": "TTS", "command": "SAY", "content": "{{word_copy.value}}", "rate":"1.2", "features": ""}
{"type": "AUDIO", "command": "PLAY", "soundsource": "{{word_copy.value}}.mp3", "mode":"flow", "features": ""} //the stimulus digit
]
},

Expand All @@ -186,7 +223,7 @@
"tracks": [
{"type": "COMMAND", "id": "SfingerWriter", "method": "onStartWriting", "parms": "CANCEL_REMINDER:String"},
// This would call the cancel reminder action below when the user starts writing
{"type": "COMMAND", "id": "Sresponse", "method": "onRecognitionComplete", "parms": "NEXT:String"},
{"type": "COMMAND", "id": "Sstimulus", "method": "onRecognitionComplete", "parms": "NEXT:String"},
// This would increment the animation_graph when it is in a wait state. e.g if it is sitting at the end of a stream audio clip
{"type": "COMMAND", "cmd": "WAIT" }
//{"type": "COMMAND", "id": "Sresponse", "method": "show", "parms": "TRUE:Boolean","features":""}
Expand Down Expand Up @@ -223,7 +260,7 @@
{"type": "COMMAND", "id": "Sresponse", "method": "setForeGround", "parms": "wrong:String","features":""}, //flag the incorrect string in red color
{"type": "AUDIO", "command": "PLAY", "soundsource": "Huh.mp3", "mode":"flow","features": ""},
{"type": "AUDIO", "command": "PLAY", "soundsource": "That doesnt look like.mp3", "mode":"flow","features": ""},
{"type": "AUDIO", "command": "PLAY", "soundsource": "{{Sstimulus.value}}.mp3","mode":"flow", "features": ""}, //the stimulus digit
{"type": "AUDIO", "command": "PLAY", "soundsource": "{{word_copy.value}}.mp3","mode":"flow", "features": ""}, //the stimulus digit
{"type": "AUDIO", "command": "PLAY", "soundsource": "Try again.mp3","mode":"flow", "features": ""}
]
},
Expand Down Expand Up @@ -256,11 +293,9 @@

"COMMENT": "@@@@@ CActions @@@@@ ",

"SET_VERSION":{"type": "COMMAND", "id": "Sbanner", "method": "setVersionID", "parms": "v.0.0.1:String","features":""},

"SET_DATASOURCE":{"type": "COMMAND", "id": "Sstimulus", "method": "setDataSource", "parms": "[saba,sifuri,mbili]:String","features":"!DATA_SSTIMULUS"},
"SET_VERSION":{"type": "COMMAND", "id": "Sbanner", "method": "setVersionID", "parms": "v.0.1.0:String","features":""},

"FW_SET_REC":{"type": "COMMAND", "id": "SfingerWriter", "method": "setRecognizer", "parms": "EN_STD_NUM:String","features":""},
"SET_DATASOURCE":{"type": "COMMAND", "id": "word_copy", "method": "setDataSource", "parms": "[0,sabalicious ontological test of line length,sifuri,mbili]:String","features":"!DATA_WORD_COPY"},

"REMINDER_TIMER": {"type": "TIMER", "id":"ReminderTimer", "startdelay":"0", "period":"6000", "repeat":"false", "action":"CREATEANDSTART", "ontimer":"HESITATION_TRACK", "features": "" },
//set the waiting time limit as 10 seconds
Expand All @@ -277,7 +312,7 @@
"FW_ENABLE":{"type": "COMMAND", "id": "SfingerWriter", "method": "enable", "parms": "TRUE:Boolean","features":""},
//enable FingerWriting

"GETWORD":{"type": "COMMAND", "id": "Sstimulus", "method": "next" ,"features":""},
"NEXT_WORD":{"type": "COMMAND", "id": "word_copy", "method": "next" ,"features":""},
//get a new digit from the list.

//"GETRESPONSE":{"type": "COMMAND", "id": "Sresponse", "method": "???" ,"features":""},
Expand Down
19 changes: 18 additions & 1 deletion app/src/main/assets/tutors/word_copy/tutor_descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,22 @@
"features":""
}
],
"navigatorType":"SIMPLE_NAVIGATOR"

// This maps soundpackages in type_audio (the soundMap <key>) to audio resources
//
// The effect sound packages are special as it is not language sensitive
//
// type - the classMap2 type
// language - the language feature to use - see TCONST.LANG_AUTO
// path - the resource path relative to assets/tutors/trackdata/LIBRARY/audio/<language>

"soundMap" : {
"tutor_effect": {"type": "SOUNDMAP", "language": "LANG_EFFECT", "path": "cmu/xprize/writing"},
"xprize_effect": {"type": "SOUNDMAP", "language": "LANG_EFFECT", "path": "cmu/xprize/global"},
"default": {"type": "SOUNDMAP", "language": "LANG_AUTO", "path": "cmu/xprize/writing"},
"xprize": {"type": "SOUNDMAP", "language": "LANG_AUTO", "path": "cmu/xprize/global"}
},


"navigatorType":"SIMPLE_NAVIGATOR"
}
1 change: 1 addition & 0 deletions app/src/main/java/cmu/xprize/robotutor/RoboTutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public void onBackPressed() {
// TODO: This is a temporary log update mechanism - see below
//
masterContainer.addAndShow(startView);
startView.startTapTutor();
setFullScreen();

if(tutorEngine != null) {
Expand Down
48 changes: 43 additions & 5 deletions app/src/main/java/cmu/xprize/robotutor/startup/CStartView.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
package cmu.xprize.robotutor.startup;

import android.content.Context;
import android.content.Intent;
import android.graphics.PointF;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
Expand All @@ -37,6 +39,7 @@
import cmu.xprize.robotutor.R;
import cmu.xprize.util.CErrorManager;
import cmu.xprize.util.IRoboTutor;
import cmu.xprize.util.TCONST;


public class CStartView extends FrameLayout {
Expand All @@ -46,10 +49,12 @@ public class CStartView extends FrameLayout {
private ImageButton start;
private IRoboTutor callback;

private final Handler mainHandler = new Handler(Looper.getMainLooper());
private HashMap queueMap = new HashMap();
private boolean _qDisabled = false;
private final Handler mainHandler = new Handler(Looper.getMainLooper());
private HashMap queueMap = new HashMap();
private boolean _qDisabled = false;
private int[] _screenCoord = new int[2];

private LocalBroadcastManager bManager;

static final String TAG = "CStartView";

Expand All @@ -72,6 +77,9 @@ public CStartView(Context context, AttributeSet attrs, int defStyleAttr) {

public void init(Context context, AttributeSet attrs) {
mContext = context;

// Capture the local broadcast manager
bManager = LocalBroadcastManager.getInstance(getContext());
}


Expand All @@ -97,6 +105,30 @@ public void onClick(View v) {



private void broadcastLocation(String Action, View target) {

target.getLocationOnScreen(_screenCoord);

PointF centerPt = new PointF(_screenCoord[0] + (target.getWidth() / 2), _screenCoord[1] + (target.getHeight() / 2));
Intent msg = new Intent(Action);
msg.putExtra(TCONST.SCREENPOINT, new float[]{centerPt.x, (float) centerPt.y});

bManager.sendBroadcast(msg);
}


protected void broadcastLocation(String Action, PointF touchPt) {

getLocationOnScreen(_screenCoord);

// Let the persona know where to look
Intent msg = new Intent(Action);
msg.putExtra(TCONST.SCREENPOINT, new float[]{touchPt.x + _screenCoord[0], (float) touchPt.y + _screenCoord[1]});

bManager.sendBroadcast(msg);
}


public void execCommand(String command, Object target ) {

long delay = 0;
Expand All @@ -107,9 +139,15 @@ public void execCommand(String command, Object target ) {

CHandAnimation hand = (CHandAnimation) findViewById(R.id.ShandAnimator);

PointF targetPoint = new PointF(getWidth() / 5, getHeight() /5);
float tapRegionX = (getWidth() * 3 / 4);
float tapRegionY = (getHeight() * 3 / 4);

float padRegionX = (getWidth() / 8);
float padRegionY = (getHeight() / 8);

PointF targetPoint = new PointF((int) (Math.random() * tapRegionX) + padRegionX, (int) (Math.random() * tapRegionY) + padRegionY);

hand.post(HA_CONST.ANIMATE_MOVE, targetPoint);
broadcastLocation(TCONST.POINT_AND_TAP, targetPoint);

post(HA_CONST.ANIMATE_REPEAT, HA_CONST.TUTOR_RATE);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public void enableTouchEvents() {
super.enableTouchEvents();
}


public void setVolatileBehavior(String event, String behavior) {

if (behavior.toUpperCase().equals(TCONST.NULL)) {
Expand Down
Loading

0 comments on commit 7fa5d20

Please sign in to comment.