public void showSkeleton(HumanSkeleton skel) { // Visualize the points if we are not playing currently if (gmt.ready()) { if (kinectPointsId != -1) { gmt.removePoints(kinectPointsId); } kinectPointsId = gmt.showPoints(skel.JointPositions.ToList()); } }
void kinect_NewData(object sender, NewDataEventArgs e) { HumanSkeleton skel = new HumanSkeleton(arrayToList(e.data)); viz.showSkeleton(skel); lock (currentRecordingSequence) { if (currentRecordingSequence.Count == 0) { currentRecordingSequence.Add(Tuple.Create(stopwatch.ElapsedMilliseconds, skel)); } else { long startMs = currentRecordingSequence[0].Item1; long endMs = stopwatch.ElapsedMilliseconds; long msDelta = (endMs - startMs); if (msDelta > maxTimeWindow) { // We need to remove elements from the front until we are within the delta while ((endMs - startMs) > maxTimeWindow && currentRecordingSequence.Count > 0) { currentRecordingSequence.RemoveAt(0); if (currentRecordingSequence.Count > 0) startMs = currentRecordingSequence[0].Item1; } } currentRecordingSequence.Add(Tuple.Create(endMs, skel)); startMs = currentRecordingSequence[0].Item1; msDelta = (endMs - startMs); if (msDelta > maxTimeWindow / 2 && currentRecordingSequence.Count > (maxTimeWindow / 30) / 2) { // We have a valid capture if we have at least half our max time window SequenceAvailable = true; } } } }
public AngleConverter(HumanSkeleton hk) { this.hk = hk; this.angles = new float[(int)NaoJointAngle.count]; getArmAngles(); }