Chapter 8. The liburbi in C++

Table of Contents

What is liburbi?
Components and liburbi
Getting started
Sending commands
Sending binary data and sounds
Receiving messages
Data types
UMessage
USound
UImage
Synchronous operations
Synchronous read of a device value
Getting an image synchronously
Getting sound synchronously
Conversion functions
The "urbiimage" example

What is liburbi?

Using URBI with a telnet client is too limited. You need to be able to send commands and receive messages using a programming language of your choice, or in a more general way, you need to be able to interface URBI with other languages.

That's why we call URBI an "Interface Language": it's more than a simple protocol because it's a full featured script language acting as a protocol. In most applications where you have computer vision or sound processing, you use URBI together with C++ or another fast language to do the algorithmic part. URBI is here to run the architecture of your behaviors, your action/perception loops and other high level elements, using the output of the fast C++/Java/Matlab code as inputs for its decisions.

What is liburbi? You could program a TCP/IP layer for C++ or for your favorite language but this is trivial and should be done once and for all. This is why we made liburbi. What you want to be able to do are things like:

  • Open a connection to your robot from within your favorite language (like C++)

  • Send a command to your robot from within that language

  • Ask for a variable value and receive it

  • Listen to incoming messages from your robot and react to them appropriately

Actually, the last point is the most important and, even if it might differ from the way you may be used to write programs, it is essential to adapt to this way of thinking (called "asynchronous programming") because it is best suited for robotics. Robots are fundamentally asynchronous systems. You usually wait for messages from your robot and react to them (it's also called "event-driven programming"). That's what a robot does most of the time: react to events[8].

This chapter is a brief introduction to liburbi. You should read the official liburbi documentation on http://www.urbiforge.com if you want a comprehensive description. If you program with C++, we suggest to use the UObject architecture described later in this tutorial, liburbi being only a complement to the new and more powerful UObject technology.



[8] Traditionally in AI, the way the robot reacts might by modified by higher level cognitive activities (hierarchical architecture) or by priorities (subsumption architecture) or by a complex combination of deliberative and reactive processes (hybrid architecture)