C# Class KinectRCCar.WpfUI.ControlLogic

Inheritance: IControlLogic, IDisposable
Exibir arquivo Open project: devinh/KinectRCCar

Public Methods

Method Description
ControlLogic ( IKinectService kinectService, ICarControllerService carControllerService, IWpfUISettings settings, IUnityContainer container ) : System
DisableControl ( ) : void
Dispose ( ) : void
Start ( ) : void
Stop ( ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
CalculateDirection ( System.Windows.Media.Media3D.Vector3D leftHand, System.Windows.Media.Media3D.Vector3D handsMidpoint ) : void

Calculates the Direction to have the car go. The direction is calculated as a percentage of the angle between the position of the leftHand and 0. The calculated angle is then divided by Pi/2 to determine the direction as a percentage. A positive direction is a direction to the right. A negative position is a direction to the left.

CalculateVelocity ( double handsMidpointZ, double positionZ ) : void

Calculates the velocity of the car. The velocity is calculated as a percentage of the distance the hands are from a set neutral point. The is able to move back and forth as the neutral point is calculated based on the distance the neutral point is from the user.

ControlCar ( Microsoft.Kinect.Skeleton skeletons ) : void
CountDownTimerReset ( ) : void
EnableControl ( ) : void
EnableDisableControl ( System.Windows.Media.Media3D.Vector3D handsMidpoint, double spineYPosition, System.Windows.Media.Media3D.Vector3D leftHand, System.Windows.Media.Media3D.Vector3D rightHand ) : void

Checks to see if the hands are in the starting position and in the "play area" before enabling control. Control is disabled if the hands drop outside the "play area.

GetJointVector ( JointType joint, Microsoft.Kinect.Skeleton sd ) : System.Windows.Media.Media3D.Vector3D
HandsInPlayArea ( System.Windows.Media.Media3D.Vector3D handsMidpoint, double spinePositionY ) : bool
HandsStable ( System.Windows.Media.Media3D.Vector3D leftHand, System.Windows.Media.Media3D.Vector3D rightHand ) : bool
KinectServiceOnSkeletonFrameReady ( object sender, SkeletonArrayReadyEventArgs e ) : void
OnControllingEvent ( bool isControlling ) : void
OnNewDirectionEvent ( double direction ) : void
OnNewVelocityEvent ( double velocity ) : void
OnTimeLeftTick ( System.TimeSpan tickTime ) : void
SetupCountdownTimer ( ) : void
StartControl ( ) : void
StopControl ( ) : void

Method Details

ControlLogic() public method

public ControlLogic ( IKinectService kinectService, ICarControllerService carControllerService, IWpfUISettings settings, IUnityContainer container ) : System
kinectService IKinectService
carControllerService ICarControllerService
settings IWpfUISettings
container IUnityContainer
return System

DisableControl() public method

public DisableControl ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Start() public method

public Start ( ) : void
return void

Stop() public method

public Stop ( ) : void
return void