Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st
Init Analysis: Difference between revisions
(deprecate in favor of Protocol Documentation) |
(→TODO) |
||
Line 73: | Line 73: | ||
* Try switching the order in which inits are sent. | * Try switching the order in which inits are sent. | ||
* Send random data for the 17th init, and see what command turns off the projector. (Actually, we got a USB dump from rrivera, so this shouldn't be needed) | * Send random data for the 17th init, and see what command turns off the projector. (Actually, we got a USB dump from rrivera, so this shouldn't be needed) | ||
* See if the datasheets from [[ | * See if the datasheets from [[Hardware_info#datasheets]] prove relevant |
Revision as of 12:07, 23 November 2010
Concept
This page should be superceded by the info in the camera section of Protocol Documentation. Not that anything here is wrong, just that that page is substantially more informative.
We'd like to know exactly what the Kinect init sequence is doing, since right now we're just replaying USB control commands blindly. Here's where we'll document what happens when we try to init the Kinect in different ways.
Minimal init sequence
# Depth camera 03,126f,12000300,0000 03,1278,06000200,0000 # RGB camera 03,127f,0c000000,0000 03,1281,0d000100,0000 03,1282,0e001e00,0000 03,1283,05000100,0000
The inits for the two cameras can be interleaved, but the inits for each camera need to follow the given order.
Actually, that's not strictly true. For the depth camera, you can't reorder the inits, but the RGB camera will work if you reorder inits...kinda. If the above init ordering is [1,2,3,4], then the following things happen:
- Sending [2, 1, 3, 4] will horizontally flip the RGB camera image. This will persist (including across device reboots) until init 28 is sent.
- TODO: test more permutations
Partial init behavior
I modified marcan's code to send only the first N inits in the send_init() function. I recompiled the source for each test, and unplugged and replugged the Kinect between each test. Results, in "sent N of 28 inits" order:
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Nothing visibly interesting
- Receive a single full-size depth frame, then nothing
- Receive nothing.
- Receive nothing.
- Receive a single full-size depth frame, nothing else
- IR projector blinks on for ~1/4th second, then turns back off
- IR projector blinks on for ~1/4th second, get one correct-size depth frame, projector turns off
- IR projector turns on, stays on. Depth cam streams correct data. Nothing from the RGB cam yet.
- Same visible effects as previous
- Same as previous
- Same as previous
- Projector on, depth camera screwy, sends increasingly large buffers, no RGB.
- Projector on, depth camera works, rgb streams fuzz, mostly large frames of random data. Depth camera works consistently hereafter.
- RGB frames stream, but look like random data. Frames vary in size: I saw sizes from ~321092 to ~329472 bytes.
- RGB frames stream, but look like random data. Much larger frame-size variation than previous.
- Receive 2 RGB frames, RGB frame transfers stop.
- Receive 3 RGB frames of different sizes, then RGB streaming stops. Timing note: RGB frames start arriving after init 21.
- Receive 3 RGB frames of different sizes, then RGB streaming stops.
- Get some RGB updates, but most are very small, likely invalid (~3kB)
- All systems go.
The RGB camera will stream at 30FPS if you omit all but four of the inits. It seems the minimum commandset to get RGB streaming at 640x480 is:
- First xfer
- init 23 - if skipped, you get a whole lot of "Invalid magic" messages
- init 25 - if skipped, you get a whole lot of "Invalid magic" messages
- init 26 - if skipped, you get image data, but it looks strange and appears to either starve USB bandwidth or CPU when you move objects, since we stop receiving depth frames.
- init 27 - if skipped, no frames try to stream at all. This suggests that this is the "start streaming RGB frames" command.
The depth camera only requires inits 7 and 16. Skip either one, and the depth camera doesn't stream any data at all. Switch their order, and you get a whole bunch of "Invalid magic" packets.
TODO
- Restart the init sequence after the 1st init, 2nd, etc.
- Try switching the order in which inits are sent.
- Send random data for the 17th init, and see what command turns off the projector. (Actually, we got a USB dump from rrivera, so this shouldn't be needed)
- See if the datasheets from Hardware_info#datasheets prove relevant