-
August 2015
-
Moving To GitHub from GoogleCode.
-
June 2012
-
Version 0.2.14
-
Qt widgets and audio library added, see below New. February 2012
-
Version 0.2.13
-
Added API documentation.
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
- New audio library to capture frames from mic or a file (UAudioRecorder and UAudioPlayer, wav and mp3 supported),for fast algorithm prototyping and monitoring.
$ cd utilite/build
$ cmake ..
$ make
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
$ 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".
FULL install (Qt widgets and audio library)
- Install MinGW
- Install Qt4 MinGW libraries
- Install OpenCV2.4+
- Checkout the UtiLite svn trunk (http://utilite.googlecode.com/svn/trunk/)
- Go to download section, and download all 3rdParty libraries. Extract them directly at the root of UtiLite directory.
- Then, in utilite/build directory:
$ cmake -G"MinGW Makefiles" -DBUILD_AUDIO=ON -DBUILD_QT=ON -DBUILD_OPENCV=ON ..
$ mingw32-make
$ mingw32-make install
First, you need to install the UtiLite standalone libraries. Follow Linux instructions above. 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).
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.