Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android_voice_message: now we use speech_recognition_msgs, instead of jsk_gui_msgs #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import android.speech.SpeechRecognizer;
import android.util.Log;
import android.widget.Button;
import jsk_gui_msgs.VoiceMessage;
import speech_recognition_msgs.SpeechRecognitionCandidates;
import android.view.View;

//add
Expand Down Expand Up @@ -307,4 +307,4 @@ public void onError(Node node, Throwable throwable) {
}


}
}
2 changes: 1 addition & 1 deletion jsk_android_apps/android_voice_message/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

dependencies {
compile 'org.ros.rosjava_messages:audio_common_msgs:[0.2,0.3)'
compile 'org.ros.rosjava_messages:jsk_gui_msgs:[1.0,1.1)'
compile 'org.ros.rosjava_messages:speech_recognition_msgs:[1.0,1.1)'
compile 'org.ros.android_core:android_15:[0.2,0.3)'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ You can subscribe the recognized voice text as:

and for Multi-byte users (like Japanese), you have to decode the text to UTF character. This is some example to show as Kanji/Hiragana

rostopic echo --filter "print('texts: [%s]\n---'%(', '.join(map(lambda x: '\'%s\''%(x.decode('utf-8')), m.texts))))" /Tablet/voice
rostopic echo --filter "print('transcript: [%s]\n---'%(', '.join(map(lambda x: '\'%s\''%(x.decode('utf-8')), m.transcript))))" /Tablet/voice

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import org.ros.node.topic.Publisher;

import java.util.List;
import jsk_gui_msgs.VoiceMessage;
import speech_recognition_msgs.SpeechRecognitionCandidates;


public class AndroidVoiceMessage extends RosActivity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import android.widget.Button;
import android.widget.TextView;
import android.widget.ImageView;
import jsk_gui_msgs.VoiceMessage;
import speech_recognition_msgs.SpeechRecognitionCandidates;
import android.view.View;
import android.media.AudioFormat;
import android.media.AudioManager;
Expand All @@ -46,8 +46,8 @@ public class AndroidVoiceMessageNode implements NodeMain,
VoiceNodeListenerInterface, Runnable {

// for text_message
private Publisher<jsk_gui_msgs.VoiceMessage> voice_pub;
private jsk_gui_msgs.VoiceMessage voice_msg;
private Publisher<speech_recognition_msgs.SpeechRecognitionCandidates> voice_pub;
private speech_recognition_msgs.SpeechRecognitionCandidates voice_msg;
private int startFlag = 0;
private int not_working_flag = 0;
private int mode = 1;
Expand All @@ -70,7 +70,7 @@ public class AndroidVoiceMessageNode implements NodeMain,

@Override
public GraphName getDefaultNodeName() {
return GraphName.of("jsk_gui_msgs/VoiceMessage");
return GraphName.of("speech_recognition_msgs/SpeechRecognitionCandidates");
}

public AndroidVoiceMessageNode(SensorManager manager, Context context,
Expand Down Expand Up @@ -103,7 +103,7 @@ public void onStart(final ConnectedNode connectedNode) {

try {
voice_pub = connectedNode.newPublisher("Tablet/voice",
"jsk_gui_msgs/VoiceMessage");
"speech_recognition_msgs/SpeechRecognitionCandidates");
audio_pub = connectedNode.newPublisher("audio",
"audio_common_msgs/AudioData");
startFlag = 1;
Expand Down Expand Up @@ -301,14 +301,14 @@ public void onResults(Bundle results) {
voice_msg = voice_pub.newMessage();
ArrayList<String> candidates = results
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
voice_msg.setTexts(candidates);
voice_msg.setTranscript(candidates);
textView.setText("recognized text candidates:\n");
for (int i = 0; i < candidates.size(); i++) {
textView.setText(textView.getText() + "" + (i + 1) + ") "
+ candidates.get(i) + "\n");
}
Log.v("voice", "publish ready");
voice_msg.setTexts(candidates);
voice_msg.setTranscript(candidates);
Log.v("test", "publish ready");
if (startFlag == 1) {
voice_pub.publish(voice_msg);
Expand Down