Connecting to NAOqi
Using a proxy to a module
Once everything is set up, connecting to NAOqi's module is pretty easy:
from naoqi import ALProxy IP = "nao.local" PORT = 9559 loggerProxy = ALProxy("ALLogger", IP , PORT)
- Replace the IP by the real IP of your robot if Bonjour does not work.
- You should not change the 'PORT' unless you know what you are doing.
- The first argument, like in C++, is the name of the module you wish to connect to.
Now, you should see something like:
..::: THIS IS A RELEASE VERSION :::.. Registering module : ALFileManager Registering module : ALNetwork found module ALLogger at: 0.0.0.0:9559
After having successfully created the proxy, you can directly call the bound methods of the module:
loggerProxy.info("Python", "it works")
Warning: | Be careful! Even if the conversion from Python to C++ types works fine in most of the cases, you can encounter some problems if you use pylab's array instead of lists, or unicode strings instead of "str" objects. |
---|