ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to power off Kinect from software

asked 2015-01-25 08:33:29 -0600

Kristof gravatar image

updated 2015-02-13 15:03:52 -0600

I have a Kinect connected to the onboard Linux-based PC on my robot. However, in many scenarios I am not using the Kinect, so I would like to be able to turn it off from command line to save power.

I tried the following:

echo '1-1' > /sys/bus/usb/drivers/usb/unbind

This works, in the sense that the power light of the Kinect goes off for a moment, and the USB device is removed. However, the Kinect gets redetected within a second - re-enabling it.

Following results in the same behaviour:

echo '1' > /sys/bus/usb/devices/1-1/remove

Note that I am using a 3.4 kernel, and following does not work:

echo '0' > /sys/bus/usb/devices/1-1/power/autosuspend_delay_ms" echo 'auto' > /sys/bus/usb/devices/1-1/power/control"

Is there a way to disable the Kinect from software?

Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-02-13 13:26:39 -0600

Kristof gravatar image

updated 2015-02-13 14:33:54 -0600

I found that the command

echo '1-1' > /sys/bus/usb/drivers/usb/unbind

works, but it needs to be repeated twice in a well timed way.

What works reliably for me is the following:

echo '1-1' > /sys/bus/usb/drivers/usb/unbind; sleep 2.5; echo '1-1' > /sys/bus/usb/drivers/usb/unbind

Note that the 2.5 seconds sleep is crucial - 2 seconds will not work (too fast), 3 seconds neither (too slow). This was so on both machines on which I tested this. It seems that the sweet spot is when the Kinect USB Hub is detected, but not yet any of the actual Kinect devices:

[ 3451.492033] usb 1-1: new high-speed USB device number 109 using ehci-pci
[ 3451.624348] usb 1-1: New USB device found, idVendor=0409, idProduct=005a
[ 3451.624351] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3451.624860] hub 1-1:1.0: USB hub found
[ 3451.624970] hub 1-1:1.0: 3 ports detected

When troubles finding the sweet spot, you can just "bruteforce" it, as follows:

for (( i=0 ; i < 10 ; i++)) ; do echo '1-1' > /sys/bus/usb/drivers/usb/unbind; sleep 0.5; done

Finally, to re-enable:

echo '1-1 > /sys/bus/usb/drivers/usb/bind
edit flag offensive delete link more
2

answered 2015-01-26 01:00:41 -0600

ahendrix gravatar image

The kinect is powered by an external 12V power supply, so turning it completely off from software will probably require special hardware. There may be ways to reduce the Kienct's power consumption without turning it completely off.

There are a few steps that I would take if I was investigating this:

  • Measure the power consumption of your system, without the kinect plugged in. This gives you a baseline "zero" to compare future results against.
  • Plug in the kinect, and measure the power consumption without the ROS drivers running.
  • Run the ROS drivers, and measure the power consumption. I suspect most of the power draw associated with the kinect is actually associated with streaming data from it and processing that data.
  • Start up the rest of your ROS nodes, and measure the increased power consumption associated with running your algorithms. (I suspect this is significant).

Now look at all of your power measurements, compute (or measure) their affect on your battery life, and figure out which steps actually cause the system to use more power.

I suspect the big power consumers in your system are actually the kinect drivers and the algorithms, and that you can significantly reduce your power consumption just by stopping those nodes when you're not using them. The capabilites package may be useful for implementing this.

edit flag offensive delete link more

Comments

I did some measurements with a crude power meter (resolution: 0.01A), and found following: - Kinect connected to power supply only: 0.00 A - Kinect connected to power supply, and to USB: 0.06A going to 0.04A - Kinect driver running: 0.06A going to 0.04A - Kinect app running: >0.06A

Kristof gravatar image Kristof  ( 2015-01-26 11:42:52 -0600 )edit

So yes, it seems you are right, it is not worth bothering about those 40mA extra being used while idling.

Also thanks for the capabilities pointer, will definitely look into that!

Kristof gravatar image Kristof  ( 2015-01-26 11:43:19 -0600 )edit

But the Kinect V2 will give us a reason to worry about in the future. With 12.2V: Kinect connected to power supply only: 0.00 A - Kinect connected to power supply, and to USB: ~0.38A - Kinect app running: ~1.18A(+-0,06A)

MichaelKorn gravatar image MichaelKorn  ( 2015-01-27 05:55:09 -0600 )edit

I just detected a major flaw in my current measurement setup, and retested: Kinect connected to power supply only: 0.00 A (baseline) - Kinect connected to power supply, and to USB: 0.50A stabilizing at 0.38A - Kinect driver running: 0.38A - Kinect app running: >0.45A

Kristof gravatar image Kristof  ( 2015-02-09 12:22:29 -0600 )edit

... which is in line with what @MichaelKorn reports.

So it seems to make sense to try disabling the kinect completely - as that would save about 0.38A

Kristof gravatar image Kristof  ( 2015-02-09 12:23:35 -0600 )edit

You'll probably need to build a custom circuit to disconnect power to the kinect when you're not using it. To determine if that's a worthwhile effort or not, try to figure out your current battery life, total power consumption, and how much run-time you'll gain by disabling the kinect.

ahendrix gravatar image ahendrix  ( 2015-02-10 03:37:17 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2015-01-25 08:32:39 -0600

Seen: 708 times

Last updated: Feb 13 '15