utilite


UtilLite : Lite Utilities c++ Library

News

June 2012 * Version 0.2.14 * Qt widgets and audio library added, see below New. February 2012 * Version 0.2.13 * Added API documentation.

Overview

UtilLite is a lite c++ library that includes cross-platform (Windows, Linux, Mac) useful utilities like : * threads and safe inter-thread communication (events-based), * logger, * timer, * New Qt widgets UPlot and USpectrogram * http://utilite.googlecode.com/svn/trunk/doc/image/UPlot.gif' width='300'> http://utilite.googlecode.com/svn/trunk/doc/image/USpectrogram.png' width='300'>

  • New audio library to capture frames from mic or a file (UAudioRecorder and UAudioPlayer, wav and mp3 supported),
    for fast algorithm prototyping and monitoring.

Installation

  • Build it from source : see svn and README.

Linux

  • FULL install (Qt widgets and audio library)
    • Install Fmodex libraries (on linux, includes should be installed in /usr/local/include/fmodex and libraries should be in /usr/local/lib)
       $ sudo apt-get install libqt4-dev libmp3lame-dev libfftw3-dev libopencv-dev
      
      $ svn checkout http://utilite.googlecode.com/svn/trunk/utilite utilite
      $ cd utilite/build
      $ cmake -DBUILD_AUDIO=ON -DBUILD_QT=ON -DBUILD_OPENCV=ON ..
      $ make
      $ make install
  • Minimum install
     $ svn checkout http://utilite.googlecode.com/svn/trunk/utilite utilite
    
    $ cd utilite/build
    $ cmake ..
    $ make
    $ make install
  • To build tests, add "-DBUILD_TESTS=ON". To not build examples, add "-DBUILD_EXAMPLES=OFF".

    Windows

  • Binaries recommended, see Downloads on the side of this page.
  • Source: FULL install (Qt widgets and audio library)
    1. Install MinGW
    2. Install Qt4 MinGW libraries
    3. Install OpenCV2.4+
    4. Checkout the UtiLite svn trunk (http://utilite.googlecode.com/svn/trunk/)
    5. Go to download section, and download all 3rdParty libraries. Extract them directly at the root of UtiLite directory.
    6. Then, in utilite/build directory:
      $ cmake -G"MinGW Makefiles" -DBUILD_AUDIO=ON -DBUILD_QT=ON -DBUILD_OPENCV=ON ..
      
      $ mingw32-make
      $ mingw32-make install

ROS

  1. First, you need to install the UtiLite standalone libraries. Follow Linux instructions above.
  2. Now install the UtiLite ros-pkg in your src folder of your Catkin workspace.
    $ cd ~/<YOUR_CATKIN_WORKSPACE>
    
    $ svn checkout http://utilite.googlecode.com/svn/trunk/ros-pkg src/utilite
    $ catkin_make

See UtiLite_ROS page for information about using launch files (input/output of the nodes).

Projects that use UtiLite

  • RTAB-Map

Small example

Create a custom event, called SpecialEvent :

class SpecialEvent : public UEvent {

public:
SpecialEvent(int code) : UEvent(code) {}
~SpecialEvent() {}

virtual std::string getClassName() const {
return "SpecialEvent";
}
};

Create an events handler :

class EventsPrinter : public UEventsHandler {

public:
EventsPrinter() {}
~EventsPrinter() {}

protected:
virtual void handleEvent(UEvent * e) {
if(e->getClassName().compare("SpecialEvent") == 0) {
UINFO("SpecialEvent \"%d\" received!", e->getCode());
}
}
};

The main :

int main(int argc, char * argv[])

{
ULogger::setType(ULogger::kTypeConsole);
ULogger::setLevel(ULogger::kInfo);

UDEBUG("This message won't be logged because the "
"severity level of the logger is set to kInfo.");
UINFO("This message is logged.");

EventsPrinter p;
UEventsManager::addHandler(&p);

UEventsManager::post(new SpecialEvent(1));
UEventsManager::post(new SpecialEvent(2));
UEventsManager::post(new SpecialEvent(5));
UEventsManager::post(new SpecialEvent(7));
UEventsManager::post(new SpecialEvent(11));

uSleep(10);
UEventsManager::removeHandler(&p);
return 0;
}

Output :

[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:53::main() This message is logged.

[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:32::handleEvent() SpecialEvent "1" received!
[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:32::handleEvent() SpecialEvent "2" received!
[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:32::handleEvent() SpecialEvent "5" received!
[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:32::handleEvent() SpecialEvent "7" received!
[ INFO] (2010-09-25 18:08:20) eventsExample.cpp:32::handleEvent() SpecialEvent "11" received!

More examples here.

Project Information