
Public Member Functions | |
| def | __init__ |
| def | get_proxy |
| def | get_version |
| def | is_looping |
| def | run |
Public Attributes | |
| pip | |
| pport | |
Private Member Functions | |
| def | __on_ros_shutdown |
Private Attributes | |
| __name | |
| __naoqi_version | |
| __proxies | |
| NAOqi stuff dict from a modulename to a proxy. | |
| __stop_thread | |
| ROS stuff. | |
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 nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.__init__ | ( | self, | |
| name | |||
| ) |
:param name: the name of the ROS node
Definition at line 56 of file nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.__on_ros_shutdown | ( | self | ) | [private] |
Callback function called whenever rospy.spin() stops
Definition at line 93 of file nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.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 126 of file nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.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 145 of file nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.is_looping | ( | self | ) |
:return: whether the thread is supposed to be running
Definition at line 120 of file nao_driver_naoqi.py.
| def nao_driver.nao_driver_naoqi.NaoNode.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 106 of file nao_driver_naoqi.py.
Definition at line 58 of file nao_driver_naoqi.py.
Definition at line 58 of file nao_driver_naoqi.py.
NAOqi stuff dict from a modulename to a proxy.
Definition at line 60 of file nao_driver_naoqi.py.
ROS stuff.
Definition at line 61 of file nao_driver_naoqi.py.
Definition at line 60 of file nao_driver_naoqi.py.
Definition at line 60 of file nao_driver_naoqi.py.