I’m happy to announce that I finally did the re-coding of KinDriver, now called KinDrive.
The new version is made with the Beta 2 SDK, is a lot more stable, simpler and faster than the old one. It lacks of speech recognition and remote-controlability, but I splitted the two main features (tracking and keypressing) into separate assemblies, so it’s very easy to build a whole new application out of it!
Here comes the code part: (if you aren’t interested in using coding, skip to the last paragraph)
In this assembly there are three classes: KinDriveTracker, Point3D and DriveInformation
TCD.Mathematics.Point3D is just a helper class for 3D vectors/points with some useful calculation-methods (like calculating the distance etc.)
DriveInformation exposes two properties, Throttle and Steer, as well as a constructor that takes a SkeletonFrame as a parameter. Tracking and steer/throttle calculations are done by this very same constructor.
KinDriveTracker is a class that handles the tracking. By calling Initialize() and Start() the Kinect gets initialized and the tracking begins. For every SkeletonFrame, DriveInformation is beeing calculated. The OnNewDriveInformation event is raised, so everyone can subscribe to the data.
The DynamicInput class does all the Keypressing for you. The constructor can take parameters for the assigned keys (default: WASD) and some Steer-specific options..
After you constructed the class, you can call Run() to start sending keys. (the parameter is the frequency of keypresses – default: 5 (per second)).
To provide the DriveInformation to DynamicInput, just set the DynamicInput.CurrentInfo property to the DriveInformation you get from the OnNewDriveInformation event.
In the zip-package at the end of this post, you find three directories:
KeystrokeVisualizer is a WPF application that draws a graph for the pressed/unpressed state of any key you like. You can plot multiple keys simultaneously as well.
KinDriveTracker is a console application that does tracking only. The output it generates are the Steer and Throttle values:
KinDriveComplete is a WPF application that does the same as KinDriveTracker plus pressing the WASD-keys for dynamic durations, depending on the DriveInformation that is tracked. (Try this one with KeystrokeVisualizer to see the visual output!)
NOTE: I’ll publish the source code too.