public KinectTester() { InitializeComponent(); sensor = new SmartKinectSensor(); renderCanvas = new RenderCanvas(TimeSpan.FromSeconds(10)); sensor.EnableSkeletonRenderingSensor(); renderCanvas.ImageRendered += DisplayRenderedImage; capturedLabel.Visible = false; jointController = new JointController(); gestureController = new GestureController(); skeletonRender = new SkeletonRenderer(sensor.Sensor); sensor.SkeletonController.AddFunction(jointController); sensor.SkeletonController.AddFunction(gestureController); sensor.SkeletonController.AddFunction(skeletonRender); skeletonRender.SkeletonRendered += renderCanvas.SkeletonFrameCaptured; gestureController.GestureCaptured += GestureCaptured; jointController.JointTrackingCaptured += JointTrackingCaptured; ArduinoSerialPort serialPort = new ArduinoSerialPort("COM5", 115200); serialPort.Open(); bodyTracker = new KinectBodyTracker(sensor, serialPort); GestureBuilderForm test = new GestureBuilderForm(sensor); test.Show(); // InitializeArduino(); }
private void ArduinoSetup() { ledON = false; toggleLED.BackColor = Color.Red; serialPort = new ArduinoSerialPort("COM5", 115200); serialPort.Open(); cwAnalogPinMapping = new PinMapping(11); ccwAnalogPinMapping = new PinMapping(10); pinMapping = new PinMapping(13); eStop = new PinMapping(8); serialPort.ComponentMappings.Add(cwAnalogPinMapping); serialPort.ComponentMappings.Add(ccwAnalogPinMapping); serialPort.ComponentMappings.Add(pinMapping); serialPort.ComponentMappings.Add(eStop); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); pinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPinMode(SetPinModeStateCodes.OutputStateCode); pinMapping.FeedbackEvent += new SkynetUtilities.FeedbackRecievedEventHandler(ResponsePackageRecieved); this.replyPackageTextBox.Text = "0"; eStop.SetPin(true); stopped = false; }
public KinectBodyTracker(SmartKinectSensor smartSensor, ArduinoSerialPort arduinoSerialPort) { this.skeletonController = smartSensor.SkeletonController; this.arduinoSerialPort = arduinoSerialPort; this.joints = new Joints(); this.previousTimeStamp = DateTime.MinValue; this.frameCount = 0; CreateEmergencyStop(); LoadJointProfiles(); ConnectSkeletonController(); }
public void InitializeArduino() { serialPort = new ArduinoSerialPort("COM5", 115200); serialPort.Open(); cwAnalogPinMapping = new PinMapping(11); ccwAnalogPinMapping = new PinMapping(10); eStop = new PinMapping(8); serialPort.ComponentMappings.Add(cwAnalogPinMapping); serialPort.ComponentMappings.Add(ccwAnalogPinMapping); serialPort.ComponentMappings.Add(eStop); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); cwAnalogPinMapping.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPinMode(SetPinModeStateCodes.OutputStateCode); eStop.SetPin(true); }