SoftBank Robotics documentation What's new in NAOqi 2.8?

ALResourceManager API

NAOqi Core - Overview | API | Tutorial


Namespace : AL

#include <alproxies/alresourcemanagerproxy.h>

Methods

bool ALResourceManagerProxy::areResourcesFree(const std::vector<std::string>& resourceNames)

True if resources free

Parameters:
  • resourceNames – List of resource names
Returns:

True if all the specified resources are free

bool ALResourceManagerProxy::areResourcesOwnedBy(const std::vector<std::string>& resourceNameList, const std::string& ownerName)

True if all the specified resources are owned by the owner

Parameters:
  • resourceNameList – List of resource names
  • ownerName – Owner pointer with hierarchy
Returns:

True if all the specify resources are owned by the owner

void ALResourceManagerProxy::createResource(const std::string& resourceName, const std::string& parentResourceName)

Create a resource

Parameters:
  • resourceName – Resource name to create
  • parentResourceName – Parent resource name or empty string for root resource
void ALResourceManagerProxy::createResourcesList(const std::vector<std::string>& resourceNameList, const std::string& strModule)

Create the resources listed in pResourceNameList

Parameters:
  • resourceNameList – List of resource names to create
  • strModule – Parent resource name or empty string for root resource
void ALResourceManagerProxy::deleteResource(const std::string& resourceName)

Delete a resource

Parameters:
  • resourceName – Resource name to delete
void ALResourceManagerProxy::deleteResource(const std::string& resourceName, const bool& deleteChildResources)

Deprecated since version 1.22: use ALResourceManagerProxy::deleteResource with a single parameter instead.

Delete a root resource.

Parameters:
  • resourceName – Resource name to delete
  • deleteChildResources – Delete child resources if true. Warning: resource management has been simplified, do not use this parameter anymore.
void ALResourceManagerProxy::enableStateResource(const std::string& resourceName, const bool& enabled)

Enable or disable a state resource

Parameters:
  • resourceName – The name of the resource that you wish enable of disable. e.g. Standing
  • enabled – True to enable, false to disable
bool ALResourceManagerProxy::isInGroup(const std::string& resourceGroupName, const std::string& resourceName)

True if a resource is in another parent resource

Parameters:
  • resourceGroupName – Group name. Ex: Arm
  • resourceName – Resource name
Returns:

void ALResourceManagerProxy::releaseResources(const std::vector<std::string>& resourceNames, const std::string& ownerName)

Release the resources listed

Parameters:
  • resourceNames – List of resource names
  • ownerName – Owner name
void ALResourceManagerProxy::acquireResource(const std::string& resourceName, const std::string& moduleName, const std::string& callbackName, const int& timeoutSeconds)

Wait and acquire the specified resource. Once acquired the callback is called if someone else want to take the resource. The callback takes only two parameters which are the resourcename and the current owner name. In the callback you can decide to release the resource by calling ALResourceManagerProxy::releaseResource If timeoutSeconds is less than 0, an infinite wait is performed, if timeoutSeconds is zero the function is non-bloquing, else the function waits at most timeoutSeconds to acquire the resource, or throws if the resource is still not available. The function throws in case of error.

Parameters:
  • resourceName – Resource name
  • moduleName – Module name where the callback will be called. It’s mandatory to specify a moduleName.
  • callbackName – Callback name of the function that will be called on moduleName when a conflict is detected
  • timeoutSeconds – Timeout in seconds
void ALResourceManagerProxy::acquireResourcesTree(const std::vector<std::string>& resourceNameList, const std::string& moduleName, const std::string& callbackName, const int& pnTimeOutMillisec)

Wait and acquire the specified resource. Once acquired the callback is called if someone else want to take the resource. The callback takes only two parameters which are the resourcename and the current owner name. In the callback you can decide to release the resource by calling ALResourceManagerProxy::releaseResource If timeoutSeconds is less than 0, an infinite wait is performed, if timeoutSeconds is zero the function is non-bloquing, else the function waits at most timeoutSeconds to acquire the resource, or throws if the resource is still not available. The function throws in case of error.

Parameters:
  • resourceNameList – List of resource names
  • moduleName – Module name where the callback will be called. It’s mandatory to specify a moduleName.
  • callbackName – Callback name of the function that will be called on moduleName when a conflict is detected
  • timeoutSeconds – Timeout in seconds
void ALResourceManagerProxy::releaseResource(const std::string& resourceName, const std::string& ownerName)

Deprecated since version 1.22: use ALResourceManagerProxy::releaseResources instead.

Release resource

Parameters:
  • resourceName – Resource name
  • ownerName – Existing owner name
AL::ALValue ALResourceManagerProxy::getResources()
Returns:the full list of resources
bool ALResourceManagerProxy::isResourceFree(const std::string& ResourceName)
Returns:a bool indicating if the resource is free or not
AL::ALValue ALResourceManagerProxy::ownersGet()
Returns:the list of owners for each resources
std::vector<std::string> ALResourceManagerProxy::waitForOptionalResourcesTree(const std::vector<std::string>& pResourceNameList, const std::string& pOwner, const std::string& pLooseCallbackName, const int& pnTimeOutMillisec, const std::vector<std::string>& pOptionalResourceNameList)

Deprecated since version 1.22: due to technical improvements, this method is not useful anymore. Do not use.

void ALResourceManagerProxy::waitForResourcesTree(const std::vector<std::string>& pResourceNameList, const std::string& pOwner, const std::string& pLooseCallbackName, const int& pnTimeOutMillisec)

Deprecated since version 1.22: due to technical improvements, this method is not useful anymore. Do not use.

void ALResourceManagerProxy::waitForResource(const std::string& resourceName, const std::string& ownerName, const std::string& callbackName, const int& timeoutSeconds)

Deprecated since version 1.22: use ALResourceManagerProxy::acquireResource instead