Chapter 3. Synchronous operations

Table of Contents

Getting variables values
Images and sounds

In synchronous operations, the interactions with the Urbi server are controlled by the matlab function calls. These functions send Urbi commands and wait for the server reply before exiting.

Note

These functions block the connection when called. If the Urbi server sends messages during the function execution, these messages will be lost. In robotics, a better approach is often to use asynchronous operation as decribed in the next section, that make it possible to process all incoming messages and execute related functions.

Getting variables values

Although you could simply use urbiSend followed by urbiGet to get any variable value, a few convenience functions are provided that encapsulate these function calls.

urbiGetVariable can be used to get any variable value. The first return value is the value field of the corresponding umessage and therefore changes with the variable type. The time stamp and the message type are also returned by the function:

>> [x,ts,type]=urbiGetVariable(myrobot,'x')
x =
     2

ts =
    60802173

type =
numeric