Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions AndroidArduinoOpenCV/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
<string name="hello">Roogle rover</string>
<string name="app_name">Roogle rover</string>






<!-- BluetoothChat -->
<string name="send">Send</string>
<string name="not_connected">You are not connected to a device</string>
<string name="not_connected">You are not connected to a device.</string>
<string name="bt_not_enabled_leaving">Bluetooth was not enabled. Leaving Bluetooth Chat.</string>
<string name="title_connecting">connecting...</string>
<string name="title_connected_to">connected: </string>
<string name="title_not_connected">not connected</string>
<string name="title_connecting">Connecting...</string>
<string name="title_connected_to">Connected: </string>
<string name="title_not_connected">Not connected.</string>

<!-- DeviceListActivity -->
<string name="scanning">scanning for devices...</string>
<string name="select_device">select a device to connect</string>
<string name="scanning">Scanning for devices...</string>
<string name="select_device">Select a device to connect</string>
<string name="none_paired">No devices have been paired</string>
<string name="none_found">No devices found</string>
<string name="title_paired_devices">Paired Devices</string>
Expand All @@ -26,4 +27,4 @@
<!-- Options Menu -->
<string name="connect">Connect a device</string>
<string name="discoverable">Make discoverable</string>
</resources>
</resources>
Binary file modified GestureVoiceCommander/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This project contains sample code for making a arduino robot recognize dots in front of it using OpenCV, send its results to MyRobots.com and also control the robot using another Android using either voice or gestures to tell the robot to turn or do other things.

The Tutorial folder breaks it down into manageble chunks:
* https://github.com/AndroidMontreal/UpAndRunningWithAndroid/tree/master/Tutorial
* [Tutorial](Tutorial)

Issues which explain the code and let you see the diffs between each step:
* https://github.com/AndroidMontreal/UpAndRunningWithAndroid/issues?milestone=1&state=open
Expand Down
Binary file not shown.
Binary file added Tutorial/MakeItUnderstandWatch.apk
Binary file not shown.
8 changes: 6 additions & 2 deletions Tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
This is essentailly a three part tutorial to make an Android into a remote control (voice or touch screen controleld) for a robot, garage opener, stereo etc
This is essentailly a three part tutorial to make an Android into a remote control (voice, touch or watch controlled) for a robot, garage opener, stereo etc

The steps are in this milestone:
The steps are in this milestone:
https://github.com/AndroidMontreal/UpAndRunningWithAndroid/milestones/Up%20and%20Running%20

Step one - Make it Talk

Step two - Make it Listen

Step three - Make it Understand

Bonus credit:

Step three - Control it with a watch
11 changes: 9 additions & 2 deletions Tutorial/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ android {

defaultConfig {
applicationId "com.androidmontreal.gesturevoicecommander"
minSdkVersion 7
targetSdkVersion 17
minSdkVersion 18
compileSdkVersion 21
targetSdkVersion 23
}

dependencies {
wearApp project(':wear')
compile 'com.google.android.gms:play-services:7.8.0'
compile 'watch.nudge.phonegesturelibrary:phone-gest-lib:0.8.4'
}

buildTypes {
Expand Down
41 changes: 25 additions & 16 deletions Tutorial/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,52 @@
See the License for the specific language governing permissions and
limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidmontreal.gesturevoicecommander" >
package="com.androidmontreal.gesturevoicecommander">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17" />
<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application>
<application
android:icon="@drawable/ic_launcher">
<activity
android:name="GestureBuilderActivity"
android:icon="@drawable/ic_gesturebuilder"
android:label="@string/application_name" >
</activity>
android:name=".GestureBuilderActivity"
android:label="@string/application_name"></activity>
<activity
android:name="CreateGestureActivity"
android:name=".CreateGestureActivity"
android:label="@string/label_create_gesture" />
<activity
android:name=".practice.MakeItTalk"
android:label="Text To Speech" >
</activity>
android:label="Text To Speech"></activity>
<activity
android:name=".practice.MakeItListenAndRepeat"
android:label="Speech Recognition" >
</activity>
android:label="Speech Recognition"></activity>
<activity
android:name=".practice.MakeItUnderstandGestures"
android:label="Gesture or Speech Recognition" >
android:label="Speech Recognition" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".robots.Robot"
android:label="Gesture or Speech Recognition" >
</activity>
<activity
android:name=".robots.DeviceListActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/select_device"
android:theme="@android:style/Theme.Holo.Dialog">
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

import com.androidmontreal.gesturevoicecommander.GestureBuilderActivity;
import com.androidmontreal.gesturevoicecommander.R;
import com.androidmontreal.gesturevoicecommander.robots.RoverLexicon;
import com.androidmontreal.gesturevoicecommander.robots.Lexicon;

import watch.nudge.phonegesturelibrary.AbstractPhoneGestureActivity;

/**
* Building on what we saw in MakeItListenAndRepeat, now lets make it understand
Expand All @@ -35,7 +37,7 @@
*
* @author cesine
*/
public class MakeItUnderstandGestures extends Activity implements OnInitListener, OnGesturePerformedListener {
public class MakeItUnderstandGestures extends AbstractPhoneGestureActivity implements OnInitListener, OnGesturePerformedListener {
private static final String TAG = "MakeItUnderstandGesture";
private static final int RETURN_FROM_VOICE_RECOGNITION_REQUEST_CODE = 341;
private static final boolean D = true;
Expand All @@ -52,10 +54,10 @@ public class MakeItUnderstandGestures extends Activity implements OnInitListener
private GestureLibrary gestureLib;

/* A little lexicon we made for the DFR Rover at Cloud Robotics Hackathon */
private RoverLexicon lexicon;
private Lexicon lexicon;

@Override
protected void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mTts = new TextToSpeech(this, this);
Expand All @@ -71,8 +73,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
setContentView(gestureOverlayView);

lexicon = new RoverLexicon();

lexicon = new Lexicon();
}

protected void promptTheUserToTalk() {
Expand Down Expand Up @@ -113,7 +114,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}

@Override
protected void onDestroy() {
public void onDestroy() {
if (mTts != null) {
mTts.stop();
mTts.shutdown();
Expand Down Expand Up @@ -164,6 +165,45 @@ public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
sendRobotThisCommand(predictions.get(0).name);
}
}
@Override
public void onSnap() {
sendRobotThisCommand(lexicon.stop());
}

@Override
public void onFlick() {
sendRobotThisCommand(lexicon.explore());
}

@Override
public void onTwist() {
sendRobotThisCommand(lexicon.rotateRight());
}

//These functions won't be called until you subscribe to the appropriate gestures
//in a class that extends AbstractGestureClientActivity in a wear app.

@Override
public void onTiltX(float x) {
Log.e(TAG, "This function should not be called unless subscribed to TILT_X " + x);
if (x < 0){
sendRobotThisCommand(lexicon.turnLeft());
} else {
sendRobotThisCommand(lexicon.turnRight());
}
// throw new IllegalStateException("This function should not be called unless subscribed to TILT_X.");
}

@Override
public void onTilt(float x, float y, float z) {
Log.e(TAG, "This function should not be called unless subscribed to onTilt." + x + " " + y + " " + z);
}

@Override
public void onWindowClosed() {
Log.e("MainWatchActivity","This function should not be called unless windowed gesture detection is enabled.");
}


public String sendRobotThisCommand(String command) {
String guessedCommand = lexicon.guessWhatToDo(command);
Expand Down
Loading