Manage robot resources: Synchronize movement, led, sound. Run specific actions when another behavior wants your resources
void waitForLocalResource (const string& ressourceName, const N2AL5ALPtrINS_7ALOwnerEEE& ownerPtr, const string& callbackName, const int& timeoutSeconds)
Waits for local resource, using a pointer to the owner
Resource name
Owner smart pointer. Object that inherit ALOwner
The name of the method called when another owner wants the resource
Timeout in seconds
Example in python :
from naoqi import ALProxy try: # create proxy on ALMemory memProxy = ALProxy("ALResourceManager","localhost",9559) #createResource in root memProxy.createResource("newResource","") #check resource is free free = memProxy.areResourcesFree(["newResource"]) print "resource free: ", free if (free != True): print "resource should be free" exit(1) # take resource memProxy.waitForResource("newResource", "newOwner", "callback", 1) # check resource not available for someone else try: memProxy.waitForResource("newResource", "newOwner2", "callback", 1) except RuntimeError,e: print "ok timeout", e # check resource not free free = memProxy.areResourcesFree(["newResource"]) print "resource free: ", free if (free != False): print "resource should be not available" exit(1) #release resource memProxy.releaseResource("newResource", "newOwner") # check resource free free = memProxy.areResourcesFree(["newResource"]) print "resource free: ", free if (free != True): print "resource should be true" exit(1) except RuntimeError,e: # catch exception print "error resource ", e
void waitForResource (const string& ressourceName, const string& ownerName, const string& callbackName, const int& timeoutSeconds)
Wait resource
Resource name
Owner name
callback name
Timeout in seconds
void waitForLocalResources (const vector<string>& resourceNameList, const N2AL5ALPtrINS_7ALOwnerEEE& owner, const string& callbackName, const int& timeoutSeconds)
Wait for local resources
Resources name
Owner pointer with hierarchy. Object that inherit ALHierarchyOwner and redefine isParent method to give hierarchy information
callback name
Timeout in seconds
void waitForLocalResourcesTree (const vector<string>& ressourceName, const N2AL5ALPtrINS_16ALHierarchyOwnerEEE& treeOwnerPtr, const string& callbackName, const int& timeoutSeconds)
Wait for resource tree. Parent and children are not in conflict. Local function
Resource name
Owner pointer with tree hierarchy
callback name
Timeout in seconds
bool areResourcesOwnedBy (const vector<string>& resourceNameList, const string& ownerName)
True if all the specified resources are owned by the owner
Resource name
Owner pointer with hierarchy
True if all the specify resources are owned by the owner
void releaseResource (const string& resourceName, const string& ownerName)
Release resource
Resource name
Existing owner name
void releaseLocalResource (const string& resourceName, const N2AL5ALPtrINS_7ALOwnerEEE& ownerName)
Release local resource
Resource name
Existing owner name
void releaseResources (const vector<string>& resourceNames, const string& ownerName)
Release resources list
Resource names
Owner name
void enableStateResource (const string& resourceName, const bool& enabled)
Enable or disable a state resource
The name of the resource that you wish enable of disable. e.g. Standing
True to enable, false to disable
bool areResourcesFree (const vector<string>& resourceNames)
True if resources free
Resource names
True if all the specify resources are free
void createResource (const string& resourceName, const string& parentResourceName)
Create a resource
Resource name to create
Parent resource name or empty string for root resource
string version ()
Returns the version of the module.
A string containing the version of the module.
AL::ALValue getMethodHelp (const string& methodName)
Retrieves a method's description.
The name of the method.
A structure containing the method's description.
AL::ALValue getModuleHelp ()
Retrieves the module's description.
A structure describing the module.
string getUsage (const string& name)
Gets the method usage string. This summarise how to use the method.
The name of the method.
A string that summarises the usage of the method.