Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Wednesday, 26 October 2011

The combined usage of a Gyro and Accelerometer

A new explanatory article have appeared on the ITE Project wiki. It provides mathematical background for linking together Gyro and Accelerometer readings in order to determine the robot's 3D motion trajectory.

Navigation Module - Mathematical Background

Sunday, 24 July 2011

SETI Astropulse on AMD/ATI GPU (Radeon HD 5000 and 6000 series)

It was reported on Lunatics web site that they were able to develop ATI version of Astropulse 5.05.
However instructions granted only for advanced users and the forum is not working now (site is read-only).
Update from 31 July 2011: As it appeared, there is an automatic installer for BOINC from Lunatics here. It will install optimized clients for Astropulse and Multibeam for CPU and AMD/ATI GPU.
Below are the steps for manual installation.
Therefore, this page provides step-by-step installation instructions.

Prerequisites (for each computing host):
1) You must have BOINC installed.
2) You must be connected to SETI@home
3) You must have AMD/ATI Radeon HD 5000 or 6000 series installed and active (for example, I'm using Radeon HD 6850)

Installation steps:
1) Close the BOINC manager. (Tray icon -> right click -> Exit. You will not probably need to stop all active computing processes, however, it is recommended.)

2) Go to lunatics download page and download file from their mirror.

3) Open the BOINC installation folder (for example and below the path C:\Program Files\BOINC is assumed)

4) Open Data->Projects->setiathome.berkeley.edu (full path will look like:
"C:\Program Files\BOINC\Data\Projects\setiathome.berkeley.edu") - this is a SETI project folder.

5) Extract downloaded archive (ap_5.06_win_x86_SSE2_OpenCL_ATI_r521.rar) to the SETI project folder. Extracted files must be located in the SETI project (without any folders) so that their path is:
  1.  C:\Program Files\BOINC\Data\Projects\setiathome.berkeley.edu\ap_5.06_win_x86_SSE2_OpenCL_ATI_r521.exe
  2.  C:\Program Files\BOINC\Data\Projects\setiathome.berkeley.edu\ap_5.06_win_x86_SSE2_OpenCL_ATI_r521.pdb
  3. C:\Program Files\BOINC\Data\Projects\setiathome.berkeley.edu\AstroPulse_Kernels_r521.cl
6) Download the following file app_info.xml (File->Save As after opening in your browser) and copy it into SETI project folder too:
    "C:\Program Files\BOINC\Data\Projects\setiathome.berkeley.edu\app_info.xml"

7) Go to AMD Support&Drivers download page and download latest Catalyst driver package (AMD Radeon™ Video Card Drivers). For example:
    Windows XP - 32 bit
    Windows Vista and 7 - 32 bit
    Windows Vista and 7 - 64 bit

Anyways we are looking for the newest driver supporting OpenCL (GPU computing platform).

8) Install or update with the downloaded driver. Reboot if requested.

9) Start the BOINC manager manually. (Start menu->Programs->BOINC->BOINC Manager)

10) Go to the Projects tab. Select Seti@home, then click "Your Preferences" button in the bottom left button group ("Web sites"). This will lead you to the Project preferences. (Alternatively open page). Log in and edit SETI@home preferences.

11) Make sure the option "If no work for selected applications is available, accept work from other applications?" is checked. Update preferences

12) Go back to your BOINC Manager window. On the Projects tab, select Seti@home and press Update in the Commands button group on the left.

Sooner or later your host will download tasks for Astropulse 5.05 (my received immediately). One AP workunit is processed in about 60 minutes on Radeon HD 6850.
 Computed workunit will appear as the following on an Account Tasks page:
Computed Astropulse workunit example (Radeon HD 6850)
Explanations:
This showed how to perform anonymous platform installation for BOINC. The downloaded package runs multiple OpenCL kernels on your GPU (source file is the AstroPulse_Kernels_r521.cl). It will be hard to use computer while GPU is computing, so make sure to disable the "Use GPU while computer is in use" option in the BOINC Tools->Computing Preferences. According to the source code, the memory requirement is up to 128 MB of GPU RAM.

Questions:
Any questions comment here or ask at the SETI message board thread (which seems to be active).

Friday, 28 January 2011

Building and installing ODE for Visual C++ 2008 / 2002 / 2005 / etc

This is a small step-by-step instructions to make your ODE compile in MSVC 2008 (2002+).
Complete printer-friendly ODE manual can be found here.
1) First, download the latest ODE package from SourceForge (I've downloaded ODE ver. 0.11.1)
2) Unpack package .tar.bz2, .zip or .tar.gz with, for example 7-zip (I've unpacked it to E:\Projects\SDK\ODE\ode-0.11.1). Try avoiding spaces in the path.

3) Go to build dir and create shortcut to premake4.exe (Quick Start Guide to Premake4.3,User guide). Open shortcut properties and type vs2008 (for VStudio 2008) after the name premake4.exe, so it will look like this: "\ode-0.11.1\build\premake4.exe vs2008" (without quotes). For Visual Studio 2005 - type vs2005, and vs2002 for Visual Studio 2002.
Tip: There is no such option like vs2010 for latest studios, so you have to choose maximal available solution version like vs2008 and then run .sln and apply solution conversion in appeared dialog to make solution compile for you. To get all options for premake, you shall run premake4.exe --help from command line (win+R, type cmd, then CD to your ODE build dir).
4) Go to created folder \ode-0.11.1\build\vs2008 and open solution ode.sln
5) If you have solution configuration toolbox opened, you will notice DebugDoubleDLL configuration selected by default at start up. These configurations will be determined by the way you would like to use your project. I'm trying to use static linking most of the time to minimize dependencies and total executable size, so my choice is DebugSingleLib configuration. I have chosen single precision because of speed required, - double precision will decrease ODE computational speed 2-5 times (since you will lost SSE optimizations this way), but if you need better convergence and precision, - the Double configuration is your choice. Anyways, the Single precision configuration will be slow in debug mode, since optimizer will be turned on only in Release mode.
6) Build your solution (Build->Build solution).
After build, a lot of .obj files will be generated inside solution dir (e.g. "ode-0.11.1\build\vs2008\obj\DebugSingleLib").
But, in case of static linking, you will need the only one .lib file, placed inside "ode-0.11.1\lib\DebugSingleLib\ode_singled.lib"
You will add this path to your linker when making your project later.
7) Now, it would be nice to make also a Release build. So, change project configuration to ReleaseSingleLib. But do not haste to build it now. First, check if project configuration is correct - ODE project properties->C++->Code Generation page. Look at Runtime Library field, - it is highly required for you to make sure it is the same as in your Release project configuration (the project, where you would like to use ODE). If you just left it as it is - "Multi-threaded DLL" - your release project will require "Visual studio 20xx runtime" installation from end-user, which is not good.
Tip: In all of my release project configurations I always change this option to "Multi-threaded (/MT)" (and also when building any other library from sources like OpenCV, Qt, qwt etc.). /MT configuration might also be little bit faster than dynamic, but this is not just that simple question.
Also check if you would like using SSE or SSE2 with ODE. I always choose "Streaming SIMD Extensions (/arch:SSE)" in Enable Enhanced Instruction Set field, since SSE2 does not give much more speed for my machine. If you strike for performance, you shall do a little benchmarks for it later. Also change Floating point model to Fast, to make sure SSE will not conflict with precise configuration. Now, build release configuration. As previously, you will get alot of .obj files, and in case of successful build, - go to ode-0.11.1\lib\ReleaseSingleLib to check if ode_single.lib is generated for your release build config.

8) Now it is time to test your project working with ODE. Create new or open an existing Win32 or Console application.
9) Set debug configuration, in Project Properties->C/C++-> Additional include directories add full path to ODE include directory (e.g. "E:\Projects\SDK\ODE\ode-0.11.1\include" in my case). Go to Linker->General page and add directory for your debug library (e.g. "E:\Projects\SDK\ODE\ode-0.11.1\lib\DebugSingleLib"). In Linker->Input->Additional Dependencies field type ode_singled.lib.
10) Do the same for your release configuration, except place another linker path for release library ("E:\Projects\SDK\ODE\ode-0.11.1\lib\ReleaseSingleLib") and input library ode_single.lib. Now it is right time to check if C/C++->Code Generation-> Runtime library is the same in runtime version as was in ODE when you compiled it, - in our case it must be /MT.
Notice: to use different runtime libraries configuration in several projects, you have to use dynamic linking, and also ignore conflicts in Linker-> Ignore Specific Library (just type there a library that brings conflict). Also, it would be great to check if debug library is the same as in ODE debug build configuration.
11) Open your main header file, or precompiled header like stdafx.h and write to the end:
#include <ode/ode.h>
#include <windows.h>  // you might also include windows for timing functions
12) In the beginning of your main function (main(), t_main(), WinMain(), etc)
write single line:
dWorldID odeWorld = dWorldCreate();

and rebuild your project's solution. Make sure it builds successfully.
If you have compiler error, like undefined symbol dWorldCreate - make sure to include ode.h headers properly and add ODE include path to your solution like in step 9.
If you get some unresolved external symbol error, go to step 9 and retry it.
If problem still unsolved, go to step 3 and rebuild ODE debug config.
If you get some multiple definitions linker errors - check steps 7 and 9 for C++ runtime library /MT.
In a later article I will write about how to start using ODE in a game-like application and will give some tips.
Locations of visitors to this page