ALResourceManager Tutorial

NAOqi Core - Overview | API | Tutorial


Introduction

This tutorial explains how to use the ALResourceManager module.

Note

The tutorial is written in Python.

Create a resource

# create proxy on resource manager
proxy = ALProxy("ALResourceManager","localhost",9559)

#createResource in root (parent resource is "")
proxy.createResource("newResource","")

Check if a resource is available

#check resource is free
free = proxy.areResourcesFree(["newResource"])

Wait resource become available (blocking call)

# take resource
# waitForResource(resource name, owner name, callback to notify you that someone want the resource, timeout)
proxy.waitForResource("newResource", "newOwner", "callback", 1)

Release resource taken with waitForResource

#release resource
proxy.releaseResource("newResource", "newOwner")