Table of Contents
How to use Hugr Framework ?
This document explains how to manipulate the Hugr framework.
If you are interested on how to program application using the Hugr framework, see Hugr Developer page.
The Hugr framework is a middleware library providing tools for applications to share information by simply reading and writing data-objects addressed by means of an application-defined name and a key.In some aspects, Hugr framework is related to OMG DDS (data distribution service) standard.
It is based on shared memory map called store where data are to be written or read by applications. Each application must register the data it wants to share on the store.
Then the data are available for other processes to be read or to be set accessing to the store.
Hugr store supports any kind of data type: basic ones as integer, double, boolean, float, str::string but also object type as long as primitives for handling the data type are available.
Using Hugr withing the Cycab Toolkit
In the Cycab toolkit context, the Hugr framework is the key stone that enables the 3D simulator, the control application, the sensors drivers,… to run concurrently regardless of how those programs are designed.
Thus, a control application written to run on the simulated robotic platform is the same as the application to be run on the real platform as they access the same common media, ie the Hugr store.
- when using the simulated robotic platform,
- the data in the store containing the odometric are given by the simulated odometric driver
- when using the real robot,
- the data in the store related to the odometric are given by the real odometric driver.
But as the control application is concerned : it handles the odometric data coming from the store, regardless of which process sets the data.
The next section presents a set of useful tools to be used on the Hugr store in order to manage the contents of the store while applications are using it. To illustrate our purpose, we suppose that you install the Cycab Toolkit package, and that you are ready to :
- Launch the Hugr manager:
- this manager is in charge of creating a Hugr store map to be used by the control application, the 3d simulator,…
- Run the manual driving control application :
Tools available to manage the Hugr Framework
Here are the binaries you can use to handle the contents of a Hugr store.
LD_LIBRARY_PATHenvironment variable such as to add the directory
- Store Manager
This is the binary you need to create a Hugr store map. This program creates and allocates a IPCV5 shared memory map. Once it is launched, any application needing the Hugr framework can register data on the store, read and update data from the created store.
hugrstoreallocates a store which size is 65536 bits. If the store is too short ? too big ? you can resize it using the flag
> ./hugrstore --help Allowed options: --help Display this help message -s [ --size ] arg Allocated store size -n [ --network ] The store can connect to other stores -g [ --group ] arg avahi groupname --name arg avahi name
- Hugr WEB interface
You can have access using a WEB browser to the contents of a Hugr store. For that, you need to run
hugrwebutility. This utility launched a WEB server which is linked to the Hugr store. Once the program is started, it will tell you on with port the WEB server is launched (by default, the port :
8000is chosen). Then you can connect to this WEB server using your favorite WEB browser and visit :
As an illustration, after launching :
manualDriving& #for manual driving control application
You get information on variable name, id, age, size, chunk size, relative address in the hugr store, type, value.An application that registers data should have been previously run such as to visualize a non empty content for the Hugr map.
>./hugrweb --help Allowed options: --help Display this help message --port arg Specify which port the web server will listen to --refresh arg Set the page refresh time (in seconds)
- Hugr Shell to handle store manager
To handle the Hugr store, once it has been created, you can use the Hugr shell tool. Here are the available Hugr shell commands :
- to list the content of the store :
If you precise the variable_name, <tt>ls</tt> lists the information about typeid, real size, actual size, relative address and timestamp related to the variable.
- to delete a variable and its content from the store :
- to check the consistency of the variables registered on the store :
- to quit Hugr shell session
>./hugrsh Hugr Shell> ls variable1 ID = 0 v_vector ID = 1 v_int ID = 2 v_float ID = 3 v_string ID = 4 v_t ID = 5 Hugr Shell> ls v_vector Variable name: "v_vector" TypeId: St6vectorIiSaIiEE Real size: 7336 Actual size: 8192 Relative address: 8192 Timestamp: 1563.66s Hugr Shell> quit
- Hugr Log handler
This binary enables to log into a file every modification of specific variables defined in the store. After that you can replay the modification of the store using the replay binary.
> ./hugrlog --help hugrlog var0 [var1 var2 ...] log hugr variables Allowed options: --help produce help message -o [ --output ] arg specify the output file
- Hugr Data Replay handler
This binary enables to replay into the store previous logged hugr sessions contained into a file produced using hugrlog binary.
> ./hugrreplay --help hugrreplay file [options] Generic options: --help produce help message -s [ --speed ] arg (=1) speed factor
As the Hugr store is implemented using IPCV5 shared memory, you can use the command
providing information on ipc facilities for which you have read access. In particular, you can get information about shared memory created but not deleted.
You can delete the unused IPC shared memories using the command :