Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
naoqi_driver.naoqi_node.NaoqiNode Class Reference
Inheritance diagram for naoqi_driver.naoqi_node.NaoqiNode:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, name)
 
def get_proxy (self, name, warn=True)
 
def get_version (self)
 
def is_looping (self)
 
def run (self)
 

Public Attributes

 pip
 
 pport
 

Private Member Functions

def __on_ros_shutdown (self)
 

Private Attributes

 __name
 
 __naoqi_version
 
 __proxies
 NAOqi stuff dict from a modulename to a proxy. More...
 
 __stop_thread
 ROS stuff. More...
 

Detailed Description

A ROS Node wrapper that can help you connect to NAOqi and deal with ROS shutdown
To start your node, just call:
my_node = MyNode('my_node')
my_node.start() # that will spawn your node in a thread (and run whatever is in the run() function
rospy.spin()
# when killing ROS, the node will automatically stop its main loop, exit, and then unsubscribe from ALMemory events
# and call whatever you have in unsubscribe()
Then, if your node needs to process data, you just needs to have a run function:

def run(Self):
    #do some initialization
    while self.is_looping():
        # do something
    # do some post processing

Definition at line 39 of file naoqi_node.py.

Constructor & Destructor Documentation

def naoqi_driver.naoqi_node.NaoqiNode.__init__ (   self,
  name 
)
:param name: the name of the ROS node

Definition at line 56 of file naoqi_node.py.

Member Function Documentation

def naoqi_driver.naoqi_node.NaoqiNode.__on_ros_shutdown (   self)
private
Callback function called whenever rospy.spin() stops

Definition at line 95 of file naoqi_node.py.

def naoqi_driver.naoqi_node.NaoqiNode.get_proxy (   self,
  name,
  warn = True 
)
Returns a proxy to a specific module. If it has not been created yet, it is created
:param name: the name of the module to create a proxy for
:return: a proxy to the corresponding module

Definition at line 128 of file naoqi_node.py.

def naoqi_driver.naoqi_node.NaoqiNode.get_version (   self)
Returns the NAOqi version.
A proxy for ALMemory is automatically created if needed as self.memProxy.
You can then simply have code that runs or not depending on the NAOqi version.
E.g. if distutils.version.LooseVersion('1.6') < get_version()    ....
:return: a distutils.version.LooseVersion object with the NAOqi version

Definition at line 147 of file naoqi_node.py.

def naoqi_driver.naoqi_node.NaoqiNode.is_looping (   self)
:return: whether the thread is supposed to be running

Definition at line 122 of file naoqi_node.py.

def naoqi_driver.naoqi_node.NaoqiNode.run (   self)
This is a virtual method that corresponds to the code of the Node that runs continuously
It should have a while loop calling the self.is_looping() function
# code example
#do some initialization
while self.is_looping():
    # do something
# do some post processing

Definition at line 108 of file naoqi_node.py.

Member Data Documentation

naoqi_driver.naoqi_node.NaoqiNode.__name
private

Definition at line 64 of file naoqi_node.py.

naoqi_driver.naoqi_node.NaoqiNode.__naoqi_version
private

Definition at line 63 of file naoqi_node.py.

naoqi_driver.naoqi_node.NaoqiNode.__proxies
private

NAOqi stuff dict from a modulename to a proxy.

Definition at line 68 of file naoqi_node.py.

naoqi_driver.naoqi_node.NaoqiNode.__stop_thread
private

ROS stuff.

Definition at line 91 of file naoqi_node.py.

naoqi_driver.naoqi_node.NaoqiNode.pip

Definition at line 87 of file naoqi_node.py.

naoqi_driver.naoqi_node.NaoqiNode.pport

Definition at line 88 of file naoqi_node.py.


The documentation for this class was generated from the following file:


naoqi_driver_py
Author(s): Armin Hornung, Armin Hornung, Stefan Osswald, Daniel Maier, Miguel Sarabia, Severin Lemaignan
autogenerated on Thu Jul 16 2020 03:18:30