Skip to content Skip to sidebar Skip to footer

Pepper Robot: Upload Python Modules

I'm programming a Pepper robot with Choregraphe and I'm using a real robot. The problem I have is how can I install python modules to the robot? because I need to use the requests

Solution 1:

Root access is deactivated for security reasons so you won't be able to install a package on the robot. If you wish to use external libraries you need to package them as part of your app, as explained below (from https://community.ald.softbankrobotics.com/en/forum/import-libs-py-choregraphe-3578):

You will need to add the path to your packages to Python's sys.path.

  1. Do to that from your Choregraphe Python box do something like this:

    import os, sys
    python_path = os.path.join(self.behaviorAbsolutePath(), 'lib')
    if python_path notin sys.path:
        sys.path.append(python_path)
    

This will make any Python files in the "lib" directory in your application importable. Make sure to import those files in your Choregraphe package, otherwise they won't be installed.

  1. If we do this from a Python module that is at the root of the project, you will need to use:

python_path = os.path.join(os.path.abspath(__file__), 'lib')

to get "current_path/lib" to be added to sys.path

Post a Comment for "Pepper Robot: Upload Python Modules"