private async Task Controller_OnCameraFrameProcessingResult(CameraFrameProcessingResult arg)
        {
            // TODO: if the spot detector is confident there's a laser and has been for X seconds then:
            // - move head if the spot is high, lower head if it's low
            // - use angle of head to determine whether spot is far or near by height
            // - if spot is left, turn left a little (and vice versa for right)

            // TODO: if the spot seemed to be near, and then it disappeared, we might have caught it
            // TODO: if the spot is nearby and not moving, initiate a pounce?

            // TODO: if the spot detector hasn't seen the spot for a while, abandon the chase
        }
Example #2
0
        private async Task Controller_OnCameraFrameProcessingResult(CameraFrameProcessingResult result)
        {
            if (RecoveredSinceTrigger() && result != null && result.Boxes.Count() > 0)
            {
                // This is the minimum confidence for Vector to talk about.
                var thresholdConfidence = 0.5f;

                var sortedBoxes = result.Boxes
                                  .Where(b => b.Confidence > thresholdConfidence && !string.IsNullOrWhiteSpace(b.Label))
                                  .OrderByDescending(b => b.Dimensions.Width * b.Dimensions.Height * b.Confidence);

                if (sortedBoxes.Count() > 0)
                {
                    RecordTrigger();
                    var label      = sortedBoxes.First().Label;
                    var confidence = sortedBoxes.First().Confidence;

                    var msg = "I'm not sure, but I thought I saw ";
                    switch (confidence)
                    {
                    case float n when n >= 0.6f && n < 0.7f:
                        msg = "I think I see ";
                        break;

                    case float n when n >= 0.7f && n < 0.8f:
                        msg = "I see ";
                        break;

                    case float n when n >= 0.8f:
                        msg = "I'm confident I see ";
                        break;
                    }

                    var description = YoloNamer.ParseLabel(label);
                    var speech      = msg + (description ?? label);
                    controller.EnqueueAction(new SimpleSpeechAction(this, speech));
                }
            }
        }