GithubHelp home page GithubHelp logo

davesnowdon / naoutil Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 6.0 103 KB

A project containing useful utility code for NAO developers (mostly in python). Includes support for i18n and JSON serialisation of arbitrary classes

License: GNU Lesser General Public License v3.0

Shell 1.14% Python 98.86%

naoutil's People

Contributors

axelvoitier avatar davesnowdon avatar dnajd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

naoutil's Issues

Add support for location detection

It would be useful for NAO to be able to recognise locations. One mechanism for doing this could be the use of wifi access points and signal strength. If a GPS sensor is attached then that could be used too.

naoutil should provide an interface to name & recognise locations that abstracts the technology used.

Everything working well except audioPlayer

I am using the env from naoutil and everything works nicely except when I try to use the audio player. I get this error:

type object 'ALProxy' has no attribute 'audioPlayer'

Improve logging

Get access to the logging attributes in choreographe boxes so allow debug, warn etc logging calls

Exception when run on windows 7

Looks like missing dependences for avahi

Traceback (most recent call last):
File "src\main\python\recorder\main.py", line 30, in
from core import Robot, get_joints_for_chain, is_joint, get_sub_chains
File "C:\Users\dns\dev\nao\nao-recorder\src\main\python\recorder\core.py", li
ne 12, in
from naoutil import broker
File "C:\Users\dns\dev\nao\nao-recorder\src\main\python\naoutil\broker.py", l
ine 14, in
from naoutil import avahi
File "C:\Users\dns\dev\nao\nao-recorder\src\main\python\naoutil\avahi.py", li
ne 11, in
import dbus, gobject
ImportError: No module named dbus

Support reading config items from file

NaoEnvironment makes it easier to use the i18n to localize text but it does not help with reading non-localized files. jprops & i18n provide all the necessary code to read JSON and properties files but a convenient method to read non-localized properties is required.

Memory Callbacks

I was trying to use the memory callbacks and even with the README.md example you have:

 def myEventCallback(dataName, value, message):
      nao.naoscript.get(32)
 memory.subscribeToEvent('RightBumperPressed', myEventCallback)
 raw_input("Press ENTER to stop subscribing to RightBumperPressed\n")
 memory.unsubscribeToEvent('RightBumperPressed')

I get this error:

memory.subscribeToEvent('RightBumperPressed', myEventCallback)
Exception TypeError: "in method 'module_getName', argument 1 of type 'AL::module _'" in <bound method _SubscriberModule.del of <naoutil.memory._SubscriberModule; >> ignored
Traceback (most recent call last):
File "", line 1, in
File "/home/dnajd/development/personal/FluentNao/src/main/python/naoutil/memory.py", line 58, in subscribeToEvent
_SubscriberModule().subscribeToEvent(dataName, callback)
File "/home/dnajd/development/personal/FluentNao/src/main/python/naoutil/memory.py", line 20, in getinstance
instance = cls() # Keep a strong ref until it is returned
File "/home/dnajd/development/personal/FluentNao/src/main/python/naoutil/memory.py", line 28, in init
ALModule.init(self)
File "/home/dnajd/development/personal/FluentNao/src/main/python/naoutil/init.py", line 31, in init
_ALModule.init(self, self.moduleName)
File "/home/dnajd/development/opensource/pynaoqi-python-2.7-naoqi-1.14-linux64/naoqi.py", line 133, in init
inaoqi.module.init(self, param)
File "/home/dnajd/development/opensource/pynaoqi-python-2.7-naoqi-1.14-linux64/inaoqi.py", line 217, in init
this = _inaoqi.new_module(_args)
RuntimeError: module::module
Could not create a module, as there is no current broker in Python's world.

Backward compatibility with previous argument names for broker creation.

Following PEP-8 compliant renaming, following argument names of broker.Broker() and broker.create() are not available anymore:
brokerIp => broker_ip
brokerPort => broker_port
naoIp => nao_id
naoPort => nao_port

They should be made backward compatible. A deprecation warning should also be raised.

Move data dir outside behaviour dir

Choreographe will delete "unknown" directories inside the behaviour, so the default data dir location should be outside to protect it from choreographe.

NaoEnvironment should choose a default name and allow clients to override it.

Run pylint on code

Or better add script to allow run of pylint to report on any code problems

Have an environment variable to specify a prefered robot when finding a NAO

When finding a NAO (broker creation and (future) functions to find a nao around), support the use of an environment variable to suggest a preferred robot.

When no nao_id argument is given when calling the function resolving nao ip/port, the environment variable will be looked up before suggesting any default (local robot, first in list, nao.local).

Better test infrastructure

Work on a test infrastructure allowing to do unit testing with fake ALModules, or using modules from a local naoqi, or from virtual machine naoqi, or from a simulation naoqi.

Memory callbacks appear to be broken

At least this seems to be the case on Fedora18 when the broker is started using an IP address (if I don't use an IP address my robot is not located).

I can reproduce this in the python shell (which previously worked)

from naoutil import broker
myBroker = broker.Broker("testy", nao_id="192.168.0.71", nao_port=9559)
def my_event_callback(data_name, value, message):
print 'Event', data_name, value, message
memory.subscribe_to_event('RightBumperPressed', my_event_callback)

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.