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

can not access accelerometer, motor ( tilt) and led. Also does not work in glview. #376

Open
Blinky0815 opened this issue Mar 4, 2014 · 18 comments

Comments

@Blinky0815
Copy link

I am using Ubuntu 13.10. I have recently updated. I worked fine in the past.

@Blinky0815
Copy link
Author

Interestingly, it works with my other Kinect. The non-working kinect, however, tilts fine when connected to my xbox360.

@floe
Copy link
Contributor

floe commented Mar 8, 2014

What are the model numbers of the two different Kinect cameras (check sticker on the bottom)?

@ofTheo
Copy link
Contributor

ofTheo commented Apr 23, 2014

If you have model 1473 Kinect you will need to upload the audio firmware to the device on startup.
The easiest way to do this is by grabbing these files: https://github.com/openframeworks/openFrameworks/tree/master/addons/ofxKinect/src/extra

and call:

freenect_set_fw_address_nui(kinectContext, ofxKinectExtras::getFWData1473(), ofxKinectExtras::getFWSize1473());
freenect_set_fw_address_k4w(kinectContext, ofxKinectExtras::getFWDatak4w(), ofxKinectExtras::getFWSizek4w());

after freenect_init

The motor controls for 1473 are done via the audio device. So once this firmware is uploaded you can do normal motor and led controls as with the older 1414 Kinect.

@Sylvain00
Copy link

I also got the same problem (and it is now solved).

Actually, some of the Kinects (the most recent apparently) control the tilt, leds, and accelerometer via the audio device (on the older ones, I think it is via the camera device).

In libfreenect, there is a preprocessor option called BUILD_AUDIO, which must be set at compile time to allow handling tilt/led/acceleration on those devices. Note that libfreenect will most likely (I haven't checked it works, but I have seen some code handling this) check if it shoud use the audio or camera device to handle tilt/led/acceleration.

Solution : before compiling libfreenect, edit the "CMakeLists.txt", and replace the line :
OPTION(BUILD_AUDIO "Build audio support" OFF)
with
OPTION(BUILD_AUDIO "Build audio support" ON)

@Sylvain00
Copy link

It seems quite many people encouter this problem.

Could you please either indicate this option in compilation instructions, or set the BUILD_AUDIO option on by default (as libfreenect seems to check at run time whether it should use the audio or camera device) ?

@piedar
Copy link
Contributor

piedar commented Apr 28, 2014

With #372 there is a plan to make audio a runtime option. In the meantime, you can use a parameter with cmake rather than editing CMakeLists.txt.

cmake .. -L -DBUILD_AUDIO=ON

@Sylvain00
Copy link

Alright !

But as long as it is not yet in place, could you please mention the BUILD_AUDIO option in the build instructions ?
(https://github.com/OpenKinect/libfreenect, under Fetch & Build)

I think it can help some (or maybe a lot of) people ;)

@piedar
Copy link
Contributor

piedar commented May 4, 2014

I updated README.md to note that BUILD_AUDIO is required for tilt on newer models.

@Sylvain00
Copy link

Thank you :)

@rcp1
Copy link

rcp1 commented Nov 7, 2014

Sry guys to pick this up again,
I try desperatly since two weeks to set my Kinect model 1473 in Ubuntu 13.04 armhf on an UDOO Quad up. FIrst I installed ROS hydro (http://wiki.ros.org/hydro/Installation/UDOO), then I tried their ros-hydro-openni_launch and _camera packages, which recognize the camera device with ID 000000000, but do not publish any data on their /camera nodes (LED also still blinks, but atleast the IR camera starts if I want to see a depthimage via image_view).

After that I tried the package ros-hydro-freenect_stack packages, which did not work at all, so typical "device could not opened"...

Now I found this little gem and removed the freenect_stack packages and libraries, cloned the git rep of libfreenect 0.5.1 and builded it manually. With that configuration the regview worked, although slowly and with losing messages (LED still blinking), but the rest of the examples show:
"could not open audio: -1 Failed to open motor suddevice or it is not disabled. Failed to open audio subdevice or it is not disabled. Could not open device"

Finally I found this hidden option of building a non_redistributable version with audio support, so I removed again libfreenect from the system, edited the line in CMakeLists.txt to OFF, and rebuilt it. It downloaded the firmware update, wrote some audio.bin I think, and then I tried glview again from the bin dir and still the same message as before:
"could not open audio: -1 Failed to open motor suddevice or it is not disabled. Failed to open audio subdevice or it is not disabled. Could not open device"

Now I dont know how to go any further, can you help me?
I only want to use the rgb and depth camera, the best would be as a ros node? Is that possible with Model 1473? Do I need maybe Indigo? Or should I write my own ros node based on the regview-example?

Thanks in advance!

@piedar
Copy link
Contributor

piedar commented Nov 9, 2014

@Siegeszug The firmware fetcher downloads an old firmware version for original Kinect, but I don't have the knowledge or device to safely update it. You could try ofTheo's method. You would need to edit the the freenect_stack node to load the firmware after init.

@collinalexbell
Copy link

Bump

It seems as though BUILD_AUDIO is not even an option anymore in CMakeFiles

@piedar
Copy link
Contributor

piedar commented Dec 17, 2014

Audio is now always built, so BUILD_AUDIO was removed. Kinect audio is a messy problem due to the firmware. It's unlikely to ever be fully supported by libfreenect unless it is tackled by someone more knowledgeable than I.

@feidong0302
Copy link

In my model 1473 Kinect under ubuntu 14.04, in addition that using files from https://github.com/openframeworks/openFrameworks/tree/master/addons/ofxKinect/src/extra, src/usb_libusb10.c should be modified as followings, or else libusb_open function return -1 after calling libusb_reset_device(audioHandle) and libusb_close(audioHandle).

libusb_device_handle * audioHandle = NULL;
res = libusb_open(audioDevice, &audioHandle);
if (res != 0)
{
     // we need to do this as it is possible that the device was not closed properly in a previous session
    // if we don't do this and the device wasn't closed properly - it can cause infinite hangs on LED and TILT functions
    libusb_reset_device(audioHandle);
    libusb_close(audioHandle);
    res = libusb_open(audioDevice, &audioHandle);                                                      
}
if (res != 0)
{                       
    FN_ERROR("Failed to set the LED of K4W or 1473 device: %d\n", res);
}
else
{
    #if 0   
    // we need to do this as it is possible that the device was not closed properly in a previous session
    // if we don't do this and the device wasn't closed properly - it can cause infinite hangs on LED and TILT functions
    libusb_reset_device(audioHandle);
    libusb_close(audioHandle);
    res = libusb_open(audioDevice, &audioHandle);
    #endif
    if (res == 0)
    {

@hudongrui
Copy link

If you have model 1473 Kinect you will need to upload the audio firmware to the device on startup.
The easiest way to do this is by grabbing these files: https://github.com/openframeworks/openFrameworks/tree/master/addons/ofxKinect/src/extra

and call:

freenect_set_fw_address_nui(kinectContext, ofxKinectExtras::getFWData1473(), ofxKinectExtras::getFWSize1473());
freenect_set_fw_address_k4w(kinectContext, ofxKinectExtras::getFWDatak4w(), ofxKinectExtras::getFWSizek4w());

after freenect_init

The motor controls for 1473 are done via the audio device. So once this firmware is uploaded you can do normal motor and led controls as with the older 1414 Kinect.

Hi ofTheo,

I'm experiencing the same issue when running example codes provided by libfreenect, and trying to follow your instructions to fix. I am a bit confused about the step to call the two functions after freenect_init(). Where or in what files is freenect_init() called?

I'd really appreciate your help.

@piedar
Copy link
Contributor

piedar commented Dec 17, 2018

@hudongrui freenect_init() should be called from your own application. For example, see camtest.

@liuyu9661
Copy link

@hudongrui freenect_init() should be called from your own application. For example, see camtest.

Hi, Piedar.

I also get a same question. Example [camtest] is in C code. However, those two extra files are in C++. I'm little bit confused about if i can call functions of C++ in a C code when i run this example.

@damavand1
Copy link

hi all

dear @piedar

I do below steps, but I can't change led color in 1473 model yet

1- I renamed "glview.c" to "glview.cpp"
2- I download and copy "ofxKinectExtras.cpp" and "ofxKinectExtras.h" files next to "glview.cpp" file
3- I added "#include "ofxKinectExtras.h"" to "glview.cpp" file (about in line number 33)
4- I added this two lines below to line 502
freenect_set_fw_address_nui(f_ctx, ofxKinectExtras::getFWData1473(), ofxKinectExtras::getFWSize1473());
freenect_set_fw_address_k4w(f_ctx, ofxKinectExtras::getFWDatak4w(), ofxKinectExtras::getFWSizek4w());

After all I compile using this command:
g++ glview.cpp ofxKinectExtras.cpp -lfreenect -lglut -lGL

but LED and tilt not working yet :-(

I'm using raspberry pi 4 b and ubuntu

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

No branches or pull requests