Giter Club home page Giter Club logo

incognite-lab / pepper-controller Goto Github PK

View Code? Open in Web Editor NEW
32.0 1.0 15.0 6.74 MB

Python controller for Pepper humanoid robot. It allows to write apps in Python. There are examples of simple applications for Pepper. We develop GUI to operate the robot and run custom apps

Home Page: http://incognite.ciirc.cvut.cz

Python 99.92% Shell 0.08%
gui human-robot-interaction humanoid-robot language navigation pepper pepper-robot python social-interactions vision

pepper-controller's Introduction

Pepper Controller

This is a software for controlling the humanoid robot Pepper. You can easily connect to the robot and control it either from the command line or you can implement the robot control into your existing python scripts. This software serves as an alternative to the official Choregraphe tool, which offers only graphical programming instead of full Python support. You can also control the robot, launch apps installed on the robot or teleoperate the robot from the GUI interface. The example scripts will help you to learn how to write your own Pepper app in a few lines of Python code, without the necessity to use Softbank software.

System requirements

Ubuntu up to 20.04

Python 2.7 (or Python 3.5.6 with limited functionality)

Pepper humanoid robot with NAOqi 2.5 (will not work with NAOqi 2.9 or newer)

Installation

Install dependencies for the GUI:

sudo apt-get install python-tk opencv-python

Clone this repository to your computer:

git clone https://github.com/incognite-lab/Pepper-Controller.git

cd Pepper-Controller

Python 2.7

If you want to use all functions from robot.py, you need the Python 2.7 version. Here is the installation procedure.

export PYTHONPATH=${PYTHONPATH}:~/pynaoqi/lib/python2.7/site-packages

  • Test the library:

python2

import qi

  • Install dependencies

pip2 install -r ./requirements.txt

Python 3.5.6

Alternatively, you can install the conda env for Python 3.5.6, which uses a half-remade qi library. However, some functionalities like touch detection etc. will not work. You can install it as follows:

conda env create -f python3env.yml
conda activate pepperenv                

GUI Interface

The easist way to control Pepper robot is via the GUI interface:

python2 peppergui.py

The window will appear:

Image

Firstly, you need to enter the correct IP address (press the robot's chest button to obtain it) to the upper left box and press "Connect"

After a successful connection, you can control the robot by pressing the buttons.

If you want Pepper to say any phrase, enter it in the text edit field and then press the "Say text" button.

The GUI provides support for running Choregraphe projects that are already installed on the robot. We currently do not provide any installable Choregraphe projects, but you can configure the GUI buttons for your own applications. To do that, please edit conf.yaml. For each application, you need to provide a name for the button and a path to your Choregraphe app in the form of applicationID/behavior_1. If you are not sure how to get these, please refer to Choregraphe documentation (it is label C on the second image).

Other properties of the GUI can be edited through the conf.yaml file.

GUI customization

If you want to customize GUI, there is a tool to easily edit the layout without programming skills. The GUI layout is based on Pygubu Designer (https://github.com/alejandroautalan/pygubu-designer)

Install Pygubu Designer:

pip2 install pygubu-designer

Run Pygubu Designer:

pygubu-designer

Open .ui file

File > Open > Pick "pepper_controller.ui"

You can modify the basic structure of the layout, add new fuctions or assign commands or applications to the specific buttons. The ui file contains whole structure of the the GUI.

Command line examples

If you want to control the robot from command line, just run Python 2 and type:

import naoqi

from pepper.robot import Pepper

robot = Pepper(PeppperIP,9559)

Now you can control Pepper from the command line. Pepper can say something:

robot.say("Hello, I am Pepper robot.")

If you want Pepper to show a website on tablet, type:

robot.show_web("https://www.google.com/")

You can also easily switch Autonomous life on or off:

robot.autonomous_life_off()

robot.autonomous_life_on()

Example of Pepper semantic segmentation based on Yolact under Python 3

Sample script in preparation

Video1

Writing custom application

As you can see from previous examples, it is pretty straigforward to write an application in Python without Choregraphe.

We prepared two examples that you can use as templates for the developmnent of your own application.

First one presents basic robot capabilities:

python hellopepper.py

Feel free to edit the script file according to your needs.

The second example shows a more complex application:

python demo.py

You can also use this script as a starting point to write your application.

Pepper class

The core module of uour software is a Pepper class. There are basic functions to operate robot from the Python environement. You can easily write your own software for the robot based on these functions.

List of methods

Here is a list all methods in Pepper class.

Language Vision Motorics System
getVoiceShape streamCamera stand show_image
getVoiceVolume get_face_properties rest autonomous_life
set_volume turn_off_leds turn_around autonomous_blinking
getVoiceSpeed blink_eyes detect_touch show_web
greet take_picture set_security_distance point_at
test_say show_map stop_behaviour tablet_show_settings
play_sound load_map start_animation restart_robot
stop_sound subscribe_camera start_behavior shutdown_robot
listen_to unsubscribe_camera hand autonomous_life_off
listen get_camera_frame track_object autonomous_life_on
ask_wikipedia get_depth_frame exploration_mode battery_status
speech_to_text show_tablet_camera robot_localization list_behavior
chatbot learn_face stop_localization get_robot_name
pick_a_volunteer recognize_person navigate_to unsubscribe_effector
recordSound move_forward share_localhost
changeVoice move_to_circle rename_robot
move_joint_by_angle upload_file
move_head_down download_file
move_head_up set_awareness
move_head_default
do_hand_shake

Authors

alt text

Incognite lab - CIIRC CTU

Michal Vavrecka

Gabriela Sejnova

Michael Tesar

Anastasia Ostapenko

Daniel Kubista

Petr Schimperk

Licensing

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Acknowledgement

The software development was supported by the Technological Agency of the Czech Republic grant No. TL02000362 HUMR - The Use of Humanoid Robot in Promoting Active Ageing in Older Men and Women.

pepper-controller's People

Contributors

danielkubista avatar gabinsane avatar michalvavrecka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pepper-controller's Issues

permission denied to connect to robot IP through peppergui

I opened the peppergui but could not connect to the robots IP address. I suspect it's the network security not letting me in, but I'm not sure. I made sure my laptop and the pepper robot are on the same network too. I am using Ubuntu 20.04. Here is the terminal output which contains the error:

/home/philip/.local/lib/python2.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
No handlers could be found for logger "playsound"
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in __call__
    return self.func(*args)
  File "peppergui.py", line 178, in on_connect_clicked
    self.robot = Pepper(self.ip_address, self.port)
  File "/home/philip/pepper_robot/Pepper-Controller/pepper/robot.py", line 66, in __init__
    self.app = qi.Application(["ReactToTouch","HumanGreeter", "--qi-url=" + connection_url])
  File "/usr/local/lib/python2.7/dist-packages/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages/qi/__init__.py", line 150, in Application
    _app = _ApplicationSession(args, autoExit, url);
RuntimeError: boost::filesystem::status: Permission denied: "/root/.local/bin/ReactToTouch"
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in __call__
    return self.func(*args)
  File "peppergui.py", line 178, in on_connect_clicked
    self.robot = Pepper(self.ip_address, self.port)
  File "/home/philip/pepper_robot/Pepper-Controller/pepper/robot.py", line 66, in __init__
    self.app = qi.Application(["ReactToTouch","HumanGreeter", "--qi-url=" + connection_url])
  File "/usr/local/lib/python2.7/dist-packages/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages/qi/__init__.py", line 150, in Application
    _app = _ApplicationSession(args, autoExit, url);
RuntimeError: boost::filesystem::status: Permission denied: "/root/.local/bin/ReactToTouch"

Inquiry on installation management tool for Naoqi OS

Not a question directly related to repo. Please be so kind to respond if you have the knowledge. This is an inquiry about the Naoqi OS. Afaik, the OS is based off of Gentoo Linux. Gentoo use portage (emerge) for software installation, removal, updates and upgrades correct? The Naoqi OS on my lab's pepper does not have emerge or equo ---bash: command not found. I'm at a loss on what the manager could be or if the OS even has a manager installed? If it does not have an installation manager, how will I be able to do things like:

  1. Install python2.7 libraries. pip (version 1.4.1) does not work, it does not seem to be able to access repos, or perhaps its another issue:
 pip install SpeechRecognition:
Downloading/unpacking SPeechRecognition
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement SPeechRecognition
Cleaning up...
No distributions at all found for SPeechRecognition
Storing complete log in /home/nao/.pip/pip.log 
  1. General package upgrades like upgrading pip or python.

Invalid syntax when trying to import Pepper

After following the readme and running from pepper.robot import Pepper, I receive an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pepper/robot.py", line 18, in <module>
    import speech_recognition
  File "/home/eli/.local/lib/python2.7/site-packages/speech_recognition/__init__.py", line 1513
    endpoint = f"https://api.assemblyai.com/v2/transcript/{transciption_id}"
                                                                           ^
SyntaxError: invalid syntax

This is on Ubuntu 20.04 wsl and python 2.7 as per the guide.

yolact suppsoed to be ran in python3 or 2?

I'm trying to run pepper.yo.py in python2 but get a syntax error:

    from yolact import Yolact
  File "/home/philip/pepper_robot/Pepper-Controller/pepper_yolact/ciircgym/yolact_vision/yolact.py", line 311
    def forward(self, convouts:List[torch.Tensor]):
                              ^
SyntaxError: invalid syntax

This seems like a syntax error caused by the python interpreter. I think the version of python I'm trying to use for execution may be to blame?

Request: Add Blockly support

Request: A really nice development would be to add Blockly where kids (of all ages) could program Pepper using graphical programming and have it deployed in real-time to the robot. Blockly->Python is there but I am unsure if it is Python2 or 3.

Inquiry on software developed for Pepper

Would any of the developers of this Pepper-Controller repo happen to know about the Robot Operating System (ROS) packages developed for the pepper robot? I ask here because it is hard to find resources of knowledge focused on the pepper and NAO robots,please forgive that this line of inquiry is not directly related to the Pepper-Controller repo itself.

If knowledge of the ROS packages is known, would the ROS (melodic specifically) packages work with a Naoqi OS of version 2.5.7.1 (can't recall if it's .1) or so?

can not stopped robot.listen()

How can I stop the Recording when using .listen() ? I tried your ask_wikipedia() function but it also was not be stopped

Connection to Pepper failing

System:

  • Ubuntu 20.04
  • Python 2.7
  • Pepper Controller 2.0.1
  • Pepper robot NAOqi 2.9.5.172

If i try to connect, the connect button gets stuck and nothing i happening. Pepper controller is then stuck for minutes. I have to kill it by closing the terminal window.
The IP is correct and Port to. If i put a wrong port number, i get an error connect: Connection refused.
If i put the right one in i dont get an output in Terminal.

Is there a maximum supported version of pepper naoqi version?

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.