Hello PCL

Posted: February 9, 2012 in C/C++, Point Cloud
Tags: ,

Hi, this article is about the very basic of PCL, how to install the dependencies, get PCL source code and build it :)

The first step is download all dependencies at the web page below:

http://pointclouds.org/downloads/windows.html

On that page, OpenNI version is still 1.3, you can use the newer one, OpenNI 1.5.2. My system is Windows 7 x64 but all the dependencies are 32bit (it should be okay)

The next step is install OpenNI and Kinect driver first (http://www.openni.org/Downloads/OpenNIModules.aspx):

  1. OpenNI 1.5.2 Dev Stable
  2. Primesense NITE 1.5.2 Dev Stable
  3. OpenNI Kinect Driver, https://github.com/avin2/SensorKinect

Then All PCL dependencies:

  1. QHull 6.2.0
  2. VTK 5.8.0
  3. FLANN 1.7.1
  4. Eigen 3.0.3
  5. Boost 1.47.0
  6. NVIDIA GPU Computing SDK (optional)

Get PCL source by using SVN

http://svn.pointclouds.org/pcl/trunk/

How to compile PCL Library using Visual Studio:

http://www.pointclouds.org/documentation/tutorials/compiling_pcl_windows_3rdparty_installers.php

Try out some OpenNI samples:

Hi, it’s been long time since my last post. I’ve just finished a project titled “Launch Launch Launch Saturn V”.  I made this using OGRE 3D and Bullet Physics. Oh yeah, if you want to look at the code you can get it from google code: http://code.google.com/p/azbullet/

std::vector

Posted: October 17, 2011 in C/C++, Programming
Tags: , ,

vector, in C++ can act as a ArrayList,  similar to Java or C#. vector itself is included as a part of STL. In this article i just introduce some basic usage of vector, the rest can read here.

Here’s the instantiation of vector:

std::vector<AnObject*> objectList;

To add a member, we can use push_back()

objectList.push_back(anObject);

vector’s size it very simple to be obtained:

objectList.size();

The fun part of using vector when we’re accessing its member, it’s same as we use array :D

objectList[a]->aMethod();

To delete a member, it is little different, we should use iterator:

objectList.erase(objectList.begin() + a);

When a is the index of a member we want to delete and objectList.begin() is a method to obtain the initial iterator.

To get ray intersect on worldGeometry is can be read here (http://www.ogre3d.org/tikiwiki/Intermediate+Tutorial+2&structure=Tutorials), but if Terrain or TerrainGroup is used, the code will be slightly different:

Ogre::Vector3 camPos = mCamera->getPosition();
Ogre::Terrain* pTerrain = mTerrainGroup->getTerrain(0, 0);
Ogre::Ray mouseRay(Ogre::Vector3(camPos.x, 5000.0f, camPos.z), Ogre::Vector3::NEGATIVE_UNIT_Y);
std::pair <bool, Ogre::Vector3> test;
test = pTerrain->rayIntersects(mouseRay, true, 0);

if (test.first)
{
    // do something
}

On the code above, instead RaySceneQUery, RayIntersect is used, a variable std::pair <bool, Ogre::Vector3> is used to store value of RayIntersects function, use test.fisrt to check if the Ray intersect with terrain, and test.second to get intersection point of Vector3.

This article is small tips that can be used to debug Ogre Project. By using this std::cout can be used.

Open your project Properties, then on Configuration Properties -> Linker -> System, change value of SubSystem to Console (/SUBSYSTEM:CONSOLE).

Then on your source code change

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )

to this

int main()

The last step, add #include<iostream>

DataTables is a jQuery plugin to visualize table that is pretty much awesome and has lot of features. Now, I want to talk about TableTools, an extension which has function to export data into files such as CSV, Excel, or PDF.  Here’s a screenshot:

The configuration of TableTools is pretty much easy, you just need litte additional code onto DataTables javascript code:

$('#mytable').dataTable({
    "sDom": 'Tlfrtip',
    "oTableTools": {
    "sSwfPath": "<!--?php echo $this--->config->item('base_url');?>application/libraries/jQuery/plugins/DataTables-1.8.1/media/swf/copy_cvs_xls_pdf.swf"
    }
});

Code at above, mytable is id of your table, and you should add “sDom”: ‘Tlfrtip’ for DataTables DOM display’s configuration, and the last (and the most important), add “sSwfPath”: “yourpath/copy_cvs_xls_pdf.swf”.

Notice the sSwfPath has absolute value (On the code above, i used CodeIgniter).  If you don’t specify this path correctly, TableTools won’t work.

Precompiled header is used to boost build time since an OGRE project will take quite long time when it is compiled. A complete tutorial to build precompiled header can be found here. But additional configurations will be needed when Visual Studio 2010 is used.

Right click project -> Properties -> Configuration -> All Configuration, C/C++ -> Precompiled Headers, the configurations will be like this :

Try to build the project and errors will appear:

Right click project (again) -> Configuration -> Active (Debug), C/C++ -> Command Line, add “-Zm134” to Additional Options.

Xdebug on Apache Webserver

Posted: July 28, 2011 in PHP
Tags: , , , , ,

Xdebug is necessary if you want to debug php website. Xdebug comes with a single dll file that is attached to Apache Webserver directory. It looks simple but it could be complicated in practical ways.

My notebook is running Windows 7 x64 and using Apache bundled with Xampp, so i download x64 bit of Xdebug, i didn’t realized this was wrong. Actually my Apache is x86 version so what i really needed is Xdebug x86 :)

Then what i did was copied my Xdebug dll file into C:\xampp\php\ext and then added this lines into php.ini file:

zend_extension="\xampp\php\ext\php_xdebug-2.1.1-5.3-vc6.dll"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Here’s a screenshot produced by php_info() :

A trick to know what Xdebug version that suits Apache version is quite simple, go to this page http://xdebug.org/find-binary.php, ctrl+c and ctrl+v your html code of php_info() .

If you have a presentation about your Android App it will be funny if your demo is on your little device screen and everyone can’t see your app from afar. Okay, i found this Android Screencast, what will display your device screen to your computer screen. This tool is quite handy, it works on my Samsung Galaxy SL I9003 (running Froyo) and my Windows 7 x64.

The main flaw of this app is the frame rate since it is very slow, maybe about 4-5 fps. Not very good if your Andoid has flashy animations. The color display isn’t very good too, maybe because this app is reducing the resolution display.

Despite its limitations, this app is one of the best that i can found in internet.

Here are steps to run this app:

  1. Download this app from here : http://code.google.com/p/androidscreencast/
  2. Download Android sdk. Place android-sdk-windows folder on root of your C:\
    http://developer.android.com/sdk/index.html
    …and install JRE(JDK) 6
    http://java.sun.com/javase/downloads/widget/jdk6.jsp
  3. Plug your device using USB Cable, make sure you’ve installed your device’s driver.
  4. Open cmd and type: javaws androidscreencast.jnlp
    since it’s not an exe file but the advantage is you can run this app from Linux or Mac.

 Other similar app, is AShot, but i don’t know why it isn’t working on my 64 bit OS.

Everybody knows android emulator works very slow even on my 2.1 GHz Core2 Duo laptop it can’t be helped. So i thought it’s better to debug using real device:

1. First of course, you need to install your android device on your computer. Then connect your android device to PC using usb cable (it’s possible to connect via wireless too).

2. On your android device, Go to Settings –> Applications –> Development –> check USB Debugging

3. that’s all, just two simple steps and let adb do the rest.

4. I’m using netbeans 7.0, here’s the screenshot, my device was on the list: