Using OpenKinect project with CFClient

Firmware/software/electronics/mechanics
Post Reply
roamingbot
Beginner
Posts: 6
Joined: Wed Feb 20, 2013 5:36 pm

Using OpenKinect project with CFClient

Post by roamingbot »

Marcus, I am trying to build libfreenect under Windows on a Win8 machine using MSVC. When compiling I get the following errors. I am assuming that some library is missing or misplaced, but I cannot figure out which one. Do you have any suggestions where to look? Thanks in advance.

Error 7657 error LNK2019: unresolved external symbol _glutSwapBuffers@0 referenced in function "void __cdecl DrawGLScene(void)" (?DrawGLScene@@YAXXZ) C:\Users\Peter\Desktop\CrazyFlie\cfclient\libfreenect-unstable\vc\examples\glview.obj
..............
Error 7668 error LNK2019: unresolved external symbol _glutInit@8 referenced in function "void * __cdecl gl_threadfunc(void *)" (?gl_threadfunc@@YAPAXPAX@Z) C:\Users\Peter\Desktop\CrazyFlie\cfclient\libfreenect-unstable\vc\examples\glview.obj
Error 7669 error LNK1120: 12 unresolved externals C:\Users\Peter\Desktop\CrazyFlie\cfclient\libfreenect-unstable\vc\bin\Release\glview.exe
roamingbot
Beginner
Posts: 6
Joined: Wed Feb 20, 2013 5:36 pm

Re: Using OpenKinect project with CFClient

Post by roamingbot »

To answer my own question. I searched and found that in spite of the excellent description on how to build the libfreenect, the indicated reference to glut32.lib cannot be found if it is put in the Visual Studio/VC directory. So changing the reference to another location solved this problem and I could successfully build the libfreenect and example programs. Now on to testing the Kinect and then to generate the Python wrappers. I will post progress in case anyone is interested in the Windows (Win8) version of this.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Using OpenKinect project with CFClient

Post by marcus »

Hi,

Glad to hear that you are making progress on the build. Keep us updated on the pregress :-)

/Marcus
roamingbot
Beginner
Posts: 6
Joined: Wed Feb 20, 2013 5:36 pm

Re: Using OpenKinect project with CFClient

Post by roamingbot »

Just to report on progress. Generating the freenect under windows is not easy. Especially without much experience with building projects like this. I am mostly an assembler programmer and also work in AI using a variety of languages like Java, using Eclipse. So after many struggles with CMake and MSVC 10.0 I finally got a first version working. The main problem was that the suggested reference to GLUT in the MSVC directory was not picked up by the build process. After replacing it to a reference to my own directory it finally worked. I then started testing with my Kinect. That proved to be a problem, since I have a Kinect for Windows device and that version uses different drivers. Tried a new branch in which the K4W drivers were being tested but could not get that to work.
So I ordered another Kinect for XBox and while waiting for it to arrive, started working on building the Python Wrappers.
It would continually generate errors when compiling freenect.c and finally discovered that the procedure was assuming that the .py extension was expecting to automatically start up python. Since I had not set this direct execution link, python would load the python.py script but did not execute it. After that it did build the freenect.c file and then I had some more success. Today the new Kinect arrived and all the example programs worked, which was a happy event.
So then I went on to testing the python interface and it proved that the freenect.pyd library had not been generated correctly.
There exists a conflict with some libraries that are defined both as inputs and outputs. So the current status is that I am now finding out what goes wrong there and hopefully I can then get the python wrappers to work. So there is a lot to learn and also a lot of small differences between versions of compilers and OS to work out. Will keep you posted on further progress.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Using OpenKinect project with CFClient

Post by marcus »

One option could be to try the Bitcraze VM, the install processes seems to be a lot easier on Linux. But I'm not sure about the USB performance (and the performance overall) when running the virtual machine.
roamingbot
Beginner
Posts: 6
Joined: Wed Feb 20, 2013 5:36 pm

Re: Using OpenKinect project with CFClient

Post by roamingbot »

Further progress. I finally was able to successfully generate the Freenect library and run all the example programs with the Kinect.
The following things were causing the problems. First of all I had to use the unstable build. The master version generated errors.
Then I created a release build. Using Debug or other builds also generated errors.
Freenect.lib as defined as both input and output which confused CMake. So I copied the contents to a second directory, so they were separated.
That solved the problems and generated an error-free Freenect.pyd and Freenect.dll
So then I started testing a Python example. After I got that working I moved on to the main goal, building the CfClient for Kinect.
I used Eclipse Kepler with the Pydev plugin and loaded the project.
On the first try I got an error message that the python2.6 library was conflicting with the rest of the system.
Since the Windows version of Freenect only works with python 2.6 and the CfClient is using 2.7 there seems to be a possible conflict.
On a second try the system started up and the control panel appeared but there were errors in the kinect.py module.
So that is the current status. Trying to find out how to get rid of those errors and then how to get the kinect to connect and show its control screen.
roamingbot
Beginner
Posts: 6
Joined: Wed Feb 20, 2013 5:36 pm

Re: Using OpenKinect project with CFClient

Post by roamingbot »

Success at last. Since the descriptions for installing the Python Wrappers of Freenect mentioned Python2.6 consistently, that is what I used to build the library. But that does not work together with the CFClient Kinect version, which needs to be built from version 2.7.
So I started all over again and generated Freenect with new libraries and other dependencies for version 2.7. I had expected a lot of trouble with that but fortunately it generated without any problems, given the restrictions that only a release version is used and the library had to be copied to prevent the error with overlapping input and output files. Still not sure if this is the proper solution but it worked.
Then I copied the freenect.dll, freenect.pyd and pthreadvc2.dll files to the project lib folder and ran setup for CFClient.
I then ran into trouble with OpenCV which also needs to be for Python 2.7. So in installed version 2.4.6 and then running from Eclipse, the project started up and I got the RGB screen.
So now I can start working on the software, mount a red ball on the CF and start studying Python and get something going.
Learned a lot and hope go get into developing my own program to control CF autonomously.
I have tried controlling CF manually but am not very good at that. Also have an ARDrone and a LadyBug and cannot control those either.
Having the computer control them is a much more interesting option for me.
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Using OpenKinect project with CFClient

Post by tobias »

Nice to hear that you are making progress!
Post Reply