Giter Club home page Giter Club logo

Comments (12)

gabinsane avatar gabinsane commented on June 9, 2024

Hi, you were actually able to connect to the robot's IP address, which is happening already on line 56:

self.session.connect("tcp://{0}:{1}".format(ip_address, port))

The qi.Application() call that caused the crash is trying to register asynchronous callbacks to be able to detect approaching humans or hand touch. I am not sure if the permission issues are on your computer or coming from the robot. You can try to re-run the GUI with sudo. If that doesn't help, it can be the robot's factory permission settings - we have an old version of Pepper from 2017 and this is running.
Anyway, if that is the case, you can comment out this line (lines 66 and 67 in robot.py), the rest of the functions should be fine.

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@gabinsane Thanks for replying! I will try that. If you would be so kind to answer an intermediate question, I was looking at how you guys implemented ALAudioRecorder. I tried to do something similar and I'm getting errors I don't understand. If you would please take a look.

Algorithm Flow
[i] Detect speech with ALAudioRecorder API, create .wav file,

[ii] Retreive .wav file and use as input for .recognize_google.

[iii] Retrieve text from audio and send text to a server via socket

My Code

#!/usr/bin/env python2.7
from naoqi import ALProxy
import time
import socket
import speech_recognition

recognizer = speech_recognition.Recognizer()
lang="en-US"

# Create a TCP client socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('localhost', 8888))


ROBOT_IP = "130.191.48.26"

# Creates a proxy on the speech-recognition module
asr = ALProxy("ALSpeechRecognition", ROBOT_IP, 9559)
mem = ALProxy("ALMemory", ROBOT_IP, 9559)
aur = ALProxy("ALAudioRecorder", ROBOT_IP, 9559)
asr.setLanguage("English")

#aur.stopMicrophonesRecording()
print ("start recording")
aur.startMicrophonesRecording("/home/philip/nao/speech.wav", "wav", 48000,[0, 0, 1, 0])
time.sleep(5)
aur.stopMicrophonesRecording()
print ("record over")

audio_file = speech_recognition.AudioFile("/home/philip/nao/speech.wav")
with audio_file as source:
    audio = recognizer.record(source)
    recognized = recognizer.recognize_google(audio, language=lang)
data = recognized
client_socket.send(data.encode())

# Close the client socket
client_socket.close()

Error: (I run the server first in a separate terminal)

[I] 1690577561.537542 5598 qimessaging.session: Session listener created on tcp://0.0.0.0:0
[I] 1690577561.537844 5598 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:43961
[I] 1690577561.537853 5598 qimessaging.transportserver: TransportServer will listen on: tcp://130.191.48.17:43961
[W] 1690577561.537902 5603 qi.path.sdklayout: No Application was created, trying to deduce paths
start recording
Traceback (most recent call last):
  File "subscribe_to_speech_socket.py", line 25, in <module>
    aur.startMicrophonesRecording("/home/philip/nao/speech.wav", "wav", 48000,[0, 0, 1, 0])
  File "/usr/local/lib/python2.7/dist-packages/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages/naoqi.py", line 194, in __call__
    return self.__wrapped__.method_missing(self.__method__, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages/naoqi.py", line 264, in method_missing
    raise e
RuntimeError: 	ALAudioRecorder::startMicrophonesRecording
	AudioSndFile Open has failed

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@gabinsane After commenting out lines 66 and 67 I am able to connect to the robot. However, some of the functionalities do not work properly when I click on their gui buttons. For some, I get "Not Installed errors" (Pretty much all the Applications) or RunTime errors. For teleoperation(move forward and so on), I do not get any error outputs on terminal but when I click on the buttons but nothing happens.

from pepper-controller.

michalvavrecka avatar michalvavrecka commented on June 9, 2024

The applications are not part of the Pepper Controller, they are developed separatelly and are installed directly into Pepper. You can assign your own applications to the buttons in the config file. The teleoperation requires to turn off autonomous life.

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@michalvavrecka Thanks for the reply! If you would be so kind to answer some follow ups:

[i] What is the config file located?
[ii] How do I turn off autonomous life?
[iii] Would you happen to know what I'm doing wrong in the code I provided in the previous post. I don't understand the AudioSndFile Open has failed error.

from pepper-controller.

gabinsane avatar gabinsane commented on June 9, 2024

[i] What is the config file located?

it is in root of the project. Please read the README, it is all written there.

[ii] How do I turn off autonomous life?

GUI button in the left section Auto Life - you can click Change button to change the current state. Also for the robot to move, you need to push the charger socket on the robot down.

[iii] Would you happen to know what I'm doing wrong in the code I provided in the previous post. I don't understand the AudioSndFile Open has failed error.

You are trying to save the recording to your computer, but that's not possible because the recording is running on the robot. You have to save it to a folder located on the robot and then transfer it to your computer. Check the listen() function in robot.py

from pepper-controller.

gabinsane avatar gabinsane commented on June 9, 2024

Closing this issue as the original question was answered

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@gabinsane " Also for the robot to move, you need to push the charger socket on the robot down", I am not sure what this means. Right now the current set up we have at the lab is: Robot always on charge, charger is plugged to robot, other end of charger is plugged to socket on wall. So we should unplug the charger?

from pepper-controller.

gabinsane avatar gabinsane commented on June 9, 2024

@gabinsane " Also for the robot to move, you need to push the charger socket on the robot down", I am not sure what this means. Right now the current set up we have at the lab is: Robot always on charge, charger is plugged to robot, other end of charger is plugged to socket on wall. So we should unplug the charger?

Yes, this is written in the default user manual sent with the robot. The robot cannot move around when charging or when the charger socket is open https://support.aldebaran.com/support/solutions/articles/80000953766-pepper-charging-the-battery

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@gabinsane Thank you guys so much for the help! I got the speech recognition to work. If I may ask another question. Would you happen to know if the ALTextToSpeech has problems with long sentences? or text with comas and periods? Is there a built in parser that the API uses to recognize such breaks in text or do I have to create my own parser?

from pepper-controller.

gabinsane avatar gabinsane commented on June 9, 2024

We didn't have problems with speech synthesis, the robot seems to reflect the periods and commas quite alright. There is therefore no additional parser for this implemented in our API

from pepper-controller.

PhilipAmadasun avatar PhilipAmadasun commented on June 9, 2024

@gabinsane cool! Is there a way to delete the speech.wav file created by the ALAudioRecorder API via the python script? Or do we have to manually remove the speech.wav file. Does this question make sense?

  • Speech.wav file is created in the robot system
  • Is there python code that will remove the speech.wav file without having to ssh to the robot OS and manually removing the speech.wav file

Also: I currently having to use time.sleep to set a time frame for the AudioRecoder to get data. Would you know of a more sophisticated way to do this? Instead of setting a time frame can I instead set to code to know when I've stopped talking.

from pepper-controller.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.