Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freenect Driver #6

Closed
wants to merge 18 commits into from
Closed

Freenect Driver #6

wants to merge 18 commits into from

Conversation

piedar
Copy link

@piedar piedar commented Jan 5, 2013

This driver allows OpenNI2 to use libfreenect for Kinect support by forming a bridge between their interfaces. It doesn't have a whole lot of features yet - only depth and video streams at 640x480 - but as it matures it should be a boon on non-Windows platforms where the Kinect SDK is not supported.

@tomoto
Copy link
Collaborator

tomoto commented Jan 5, 2013

Hello Benn,

Thank you very much for sharing your good job!

This is very interesting, but I guess you may want to publish it as your own separate project rather than expecting OpenNI to merge it. I do not think OpenNI can merge it because freenect is an unofficial hack -- actually a possible violation of EULA of Kinect sensor -- and OpenNI will not support anything that could put its users at a business risk. Kinect connectivity supported by OpenNI will be limited to what Microsoft's Kinect SDK supports as Eran stated in http://community.openni.org/openni/topics/cant_run_any_sample_programs_of_openni_2_0_0_on_ubuntu_12_10#reply_10928889.

If you want to make this work available to those who are interested, I think you can publish it as your own project exactly as Avin did with his SensorKinect driver.

Please don't be mistaken, I am not trying to act as a cop or a lawyer of Microsoft. I just wanted to put my two cents to avoid an unhappy scenario where "you were waiting for something unlikely to happen and got frustrated", but instead I wanted you to consider you might have a better option to make your work valuable for other people.

Best Regards,
Tomoto

@piedar
Copy link
Author

piedar commented Jan 5, 2013

Tomoto,

Thanks for your advice. I was not aware that Kinect hardware itself comes with a software license. If that indeed prevents OpenNI2 from merging this driver, I will rename my repo and merge FreenectDriver into its master branch.

Regards,
Benn

PS: If nothing else, please cherry-pick piedar/OpenNI2@ed61634. It fixes driver search so that drivers are actually loaded from the path specified in OpenNI.ini and not just from the current directory.

@tomoto
Copy link
Collaborator

tomoto commented Jan 7, 2013

Hi Benn,

I have a few comments regarding your commit ed61634:

Regards,
Tomoto

@piedar
Copy link
Author

piedar commented Jan 7, 2013

Dear Tomoto,

The issue was that xnOSGetFileList() expects a search pattern and a path as its first and second parameters. Before, it was given a pattern that included full directory and a NULL path. This resulted in acsFileList being populated with local file names when it should have full paths, since these end up being used in XnLinuxSharedLibs in the call to dlopen().

By the way, I like what you're doing in #7 - I'll do some testing later today.

Regards,
Benn

@tomoto
Copy link
Collaborator

tomoto commented Jan 8, 2013

Hi Benn,

Hmm, it sounds weird. As to my reading of the code, using local file names for dlopen() is as intended since the current directory is moved to the specified directory before dlopen(). Looks like it should achieve the goal, and actually it does in my environment. Do you know the condition and the logical reason why it gave you a problem?

One possibility I could think of is that xnOSSetCurrentDir() failed for some reason such as a lack of permission, but I don't know. I think you can tell exactly what happened.

Thanks,
Tomoto
P.S. I feel I should set up a Linux environment on my machine...

@tomoto
Copy link
Collaborator

tomoto commented Jan 8, 2013

Hi Benn,

I did not experience any issues with the previous loadLibraries() implementation while I was coding and testing my path resolution fix (#7) on Linux. So I will hold off from changing this function. If you still have the issue, please revert back to me with the exact condition to reproduce the issue and, if possible, the mechanism how it happens.

Thanks,
Tomoto

@piedar
Copy link
Author

piedar commented Jan 8, 2013

Dear Tomoto,

I just tested the latest at #7 and it appears your changes have rendered ed61634 unnecessary.

Regards,
Benn

…o populateFrame() for more correct buffer sizes and data types
@piedar piedar closed this Jan 10, 2013
@piedar
Copy link
Author

piedar commented Jan 11, 2013

I deleted my FreenectDriver branch, which closed this pull request. This project will continue at https://github.com/piedar/OpenNI2-FreenectDriver. The master branch there is based on the develop branch here. If it somehow ends up that this driver can be merged, please open a new pull request.

@tomoto
Copy link
Collaborator

tomoto commented Jan 11, 2013

Hi Benn,

Thanks. I mentioned about your work in the community forum by the way.
http://community.openni.org/openni/topics/about_kinect_support_on_mac_linux

Hope it helps those who need this reach to the right place.
Tomoto

@gasol2b
Copy link

gasol2b commented Jan 17, 2013

Hello:

First off all sorry for my english.

I am a beginner in ubuntu world, and now i was trying to test the kinect with my pc. I saw Nite2 and your freenectdriver, and i am decided to make works its in this way. Buuut i have one problem :(

I have installed OpenNI2 (previously the prerequisites), from this link like says in the README:
https://github.com/OpenNI/OpenNI2

Fine, I think it´s ok installed.

After this, i installed opengl to be able to install libfreenect. I had compiled and installed libfreenect (https://github.com/OpenKinect/libfreenect) making "build" directory, and inside, i do "cmake .." --> "make" --> "sudo make install".
I think, until now, all is ok

FINE!!. Now i guess than i finally can install the freenectdriver!!. OK, i proceed:
I unzip the file in a folder and inside of this i do "make". Then it´s compiling and it gives to me a lot of compilation error. The first of all is: "libfreenect.hpp:103:63: error: 'freenect_resolution' has not been declared ". And after of this a lot more.

I am doing something wrong? (surely yes). What happens?. Can you say me what?

I can't be able to find a solution

Thank You

@piedar
Copy link
Author

piedar commented Jan 18, 2013

gasol2b,

freenect_resolution is declared in libfreenect.h. Make sure one of the following exists: /usr/include/libfreenect.h or /usr/include/libfreenect/libfreenect.h. The file should be the same as the one at https://raw.github.com/OpenKinect/libfreenect/master/include/libfreenect.h. But if the file was not found, the compiler should have said something like "fatal error: libfreenect.h: No such file or directory".

You may also try installing libfreenect from the Ubuntu repositories instead of compiling it yourself - simply install the 'freenect' package. If you still can not make it work, please create a bug report and include the full output of the command that failed. You can put it in a file like this:

make > make-output.txt

@d3ce1t
Copy link

d3ce1t commented Feb 26, 2013

Thank you, piedar, very much for your work.

However I have encountered an issue when attempting to use your OpenNI2-Freenect branch (https://github.com/piedar/OpenNI2-FreenectDriver).

After following the build instructions (apt-get installing all dependencies and freenect package), compiling and generating the OpenNI2 package (which I suppose It has included the freenect driver), I uncompressed the generated package into a folder and ran the install.sh script.

However, I get the following error message when trying to run Samples/Bin/SimpleViewer:

------ start error message ------
After initialization:

SimpleViewer: Device open failed:
DeviceOpen using default: no devices found

---- end of error message -----

I don't know if there are some steps that I have forgotten. Do you have some idea?

Thank you very much in advance,

@piedar
Copy link
Author

piedar commented Feb 26, 2013

d3ce1t,

I've never actually used the install.sh script. You should first figure out where the drivers got installed and make sure libFreenectDriver.so is among them.

PS: If you are still in the build directory, you should also try moving into the directory that contains the SimpleViewer executable.

@d3ce1t
Copy link

d3ce1t commented Mar 4, 2013

Thank you for your answer. I've checked that libFreenectDriver.so is among them. But it's not included in the redist package.

I will explain what I've done in order to clarify this topic:

$ unzip OpenNI2-FreenectDriver-master.zip
$ cd OpenNI2-FreenectDriver-master
$ make
$ find -name libFreenectDriver.so
./Bin/Intermediate/x64-Release/libFreenectDriver.so
./Bin/x64-Release/OpenNI2/Drivers/libFreenectDriver.so

As we can see, there is the driver. But when I create the package:

$ cd Redist
$ ./ReleaseVersion.py x64

There isn't any libFreenectDriver.so file inside the package. That's alright? Maybe I should to install the generated package and then copying the libFreenectDriver.so into the Driver directory of the installation directory?.

Thank you very much :)

UPDATE: I just did what I've commented of copying the driver and using the generated package and It is just working now :). In order to make samples to work you must copy the driver into the Samples/OpenNI2/Drivers directory too.

@lucmaga
Copy link

lucmaga commented Mar 14, 2013

Hello piedar, Thanks for the good working.

I have some trouble to compiling it:

http://pastebin.com/ZT55MLEh

So I compile this file for myself adding the flag -lrt to solve the problem. After this I execute make again to be sure all was compiled and then try to execute the Samples but got the "no devices found" even with the libFreenectDriver.so in the Drivers directory. I think might be this compilation problem. Can you help me with this?

Thanks =)

@d3ce1t
Copy link

d3ce1t commented Mar 14, 2013

Hi lucmaga. Have you installed package dependencies? I mean, sudo apt-get install g++ python libusb-1.0-0-dev freeglut3-dev doxygen graphviz. And then do make.

I just made that and later followed the instructions I post above and It compiles without errores and works on Ubuntu 12.10

@lucmaga
Copy link

lucmaga commented Mar 15, 2013

Hi d3ce1t. All dependencies are up to date. I'm running under Fedora 18. Doesn't appear to be a dependence problem. If you guys have some clue to solve this problem please let me know. I will install Ubuntu in a other machine to try it out.

Thanks for the help =)

@schnelle
Copy link

schnelle commented Apr 2, 2013

Hey lucmaga
I had similar issues on my Fedora 18

I added the following to line 73 of OpenNI2/ThirdParty/PSCommon/BuildSystem/CommonCppMakefile

LDFLAGS += -lpthread -lrt $(LIB_DIRS_OPTION) $(USED_LIBS_OPTION)

was:
LDFLAGS += $(LIB_DIRS_OPTION) $(USED_LIBS_OPTION)

It is important that pthread and rt are linked prior to the rest.

hth,
Dirk

@offbit
Copy link

offbit commented Jul 3, 2013

Hi piedar,
First of all, great job with the freenect for Openni2! Really useful stuff. One question, have you tried the Nite2 Api with your driver? do you get a segmentation fault or is it just my setup.

Thanks!

@piedar
Copy link
Author

piedar commented Jul 3, 2013

@Techabilly When I first tested with NITE 2 I got a segmentation fault. I fixed that one, but I haven't tried it recently so more incompatibilities may have popped up in the meantime. I'll take another look soon.

KHeresy pushed a commit to KHeresy/OpenNI2 that referenced this pull request May 30, 2014
Make compatible with VS2013 express and remove unnecessary include.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants