[2015/11/19] How to register a service locally using the python SDK on naoqi os

Obtaining an ADE account

https://www.aldebaran.com/ja Please get an account at the above site. If you have pepper, I think you already have it. If you don't have one, please get it.

Participation in the developer program

https://community.aldebaran.com/ja/developerprogram Sign up for the Developers Program. ss1.png

Get the SDK

https://community.aldebaran.com/en/resources/software Download the SDK that suits your environment. Python 2.7 SDK version name OS name bit number Example: My environment is ubuntu 64bit and pepper version is 2.4.2, so It's like [Python 2.7 SDK 2.4.2 Linux 64].

ss2.png

Building a python environment (optional)

Optional for building a python environment. Because This is because OSs other than Windows have the version SDK required for this article installed by default.

If you have already built a python 3.x system or other environment for machine learning or scientific calculations, I think that pyenv is included, but I will link the article below.

Building a Python environment on Mac using pyenv

Installation of python naoqi & qi module

Below, official materials Python SDK - Installation Guide

Since you will be working in the terminal, define the environment. Editor: emacs (I think there are vi, nano, etc.) OS: Mac (almost the same for linux)

Download pynaoqi-python2.7-2.4.2.26-mac64 from the above site & method. I think it is in zip format, so unzip it to a directory of your choice.

Start up the terminal and add the following to ~ / .bash_profile with various editors.

$ export PYTHONPATH=${PYTHONPATH}:/path/to/python-sdk $ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/path/to/python-sdk

The part of / path / to / python-sdk is not as it is, I just downloaded and unzipped it. The path to the directory.

Start up the terminal and check the import $ source .bash_profile $ python >>> import qi >>> import naoqi If there is no problem, go to the next.

Recommended site for Windows Apple (Japan)

Install qibuild

qiBuild documentation - Getting started ・ What to prepare

  1. path to cmake bin $ which cmake Please get it.

-Install with pip. $ sudo pip install qibuild

\ $ qibuild config --create a config file with wizard At the very beginning, you will be asked for the path to bin of cmake, but otherwise it is better if you select 1. ss3.png

・ Operation check $ qibuild --version qibuild version 3.10.1 Using Python code from /usr/local/lib/python2.7/dist-packages Using CMake code from /usr/local/share/cmake

Try to make a service

Python - How to write a qimessaging service Finally the main subject. Can be used locally with pepper apps and dialogs such as ^ pCall and call Let's register the service.

myfooservice.py


import qi
import sys

class MyFooService:
  def __init__(self, session):
    print "hello,"

  def bang(self):
    return "world"

def main():
    # Create and Start the Application
    app = qi.ApplicationSession(sys.argv)
    app.start()

    # Get the Session
    session = app.session

    # Create the Service
    mf = MyFooService(session)

    # Register It
    session.registerService("MyFooService", mf)

    # Run the Application
    app.run()

if __name__ == "__main__":
    main()


Register with pepper on LAN from local environment

Yes, in the previous section you have successfully created a python file that will be the masterpiece of the service. All you have to do is register. What you need below.

  1. pepper ip or domain (192.168.0.x or pepper1.local)
  2. Actual machine pepper ssh password Change to the directory of the file you created earlier.

$ cd /path/to/sakki/no/faile/myfooservice.py \ $ python myfooservice.py --qi-url = tcp: //pepper1.local (or 192.168.0.11)

Then, I think it will look like the following. ss4.png

I'm wondering if you can say that, but how about it?

Operation check on the actual machine

Let's verify why it can be used in the actual machine. What you need below

  1. pepper ip or domain (192.168.0.x or pepper1.local)
  2. Actual machine pepper ssh password

Log in with ssh. $ ssh [email protected]

Make sure your service is properly registered. $ qicli info MyFooService $ qicli call MyFooService.bang

ss7.png

the end

That's it. Next time, I'll write how to incorporate the service into an actual application and run it. If you have any questions, please leave a comment.

Recommended Posts

[2015/11/19] How to register a service locally using the python SDK on naoqi os
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
[Hyperledger Iroha] Notes on how to use the Python SDK
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
[Circuit x Python] How to find the transfer function of a circuit using Lcapy
Think about how to program Python on the iPad
How to write a GUI using the maya command
How to set up a Python environment using pyenv
[AWS IoT] Register things in AWS IoT using the AWS IoT Python SDK
How to build a Django (python) environment on docker
How to make a Python package using VS Code
[Introduction to Python] How to stop the loop using break?
How to execute a command using subprocess in Python
How to enjoy Python on Android !! Programming on the go !!
How to build a Python environment on amazon linux 2
How to set a shared folder with the host OS in CentOS7 on VirtualBOX
How to register on pypi
How to unit test a function containing the current time using freezegun in python
How to run a trained transformer model locally on CloudTPU
How to build a new python virtual environment on Ubuntu
How to use the __call__ method in a Python class
Try a similar search for Image Search using the Python SDK [Search]
How to transpose a 2D array using only python [Note]
How to deploy the easiest python textbook pybot on Heroku
How to generate a query using the IN operator in Django
How to get the last (last) value in a list in Python
How to register a package on PyPI (as of September 2017)
How to know the number of GPUs from python ~ Notes on using multiprocessing with pytorch ~
How to easily draw the structure of a neural network on Google Colaboratory using "convnet-drawer"
How to install python using anaconda
How to write a Python class
How to get the Python version
[Python] How to import the library
Control the motor with a motor driver using python on Raspberry Pi 3!
How to determine the existence of a selenium element in Python
How to change the log level of Azure SDK for Python
A note on how to check the connection to the license server port
[Introduction to Python] How to split a character string with the split function
How easy is it to synthesize a drug on the market?
How to get followers and followers from python using the Mastodon API
How to check the memory size of a variable in Python
[Introduction to Python] How to use the in operator in a for statement?
How to check the memory size of a dictionary in Python
[For beginners] How to register a library created in Python in PyPI
I tried to register a station on the IoT platform "Rimotte"
How to update a Tableau packaged workbook data source using Python
How to update the python version of Cloud Shell on GCP
How to send a request to the DMM (FANZA) API with python
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
[Python] I tried to make a simple program that works on the command line using argparse.
How to generate a new loggroup in CloudWatch using python within Lambda
How to divide and process a data frame using the groupby function
[Python] What is a formal argument? How to set the initial value
How to run the practice code of the book "Creating a profitable AI with Python" on Google Colaboratory
How to read pydoc on python interpreter
[Python] How to make a class iterable
How to draw a graph using Matplotlib
[Kivy] How to install Kivy on Windows [Python]
[Python] How to convert a 2D list to a 1D list
[Python] Explains how to use the range function with a concrete example
[Introduction to Python] How to sort the contents of a list efficiently with list sort