public int Decide(ControllerOutput controllerOutput)
        {
            var inputs = GetDecideInputs(controllerOutput);
            var result = DecisionTree.Decide(inputs);

            return(result);
        }
        public int Decide(ControllerOutput controllerOutput)
        {
            var inputs = GetDecideInputs(controllerOutput);
            var output = NeuralNetwork.Compute(inputs).Max(out var result);

            return(result);
        }
        public int Decide(ControllerOutput controllerOutput)
        {
            var inputs = GetDecideInputs(controllerOutput);
            var result = KNearestNeighbors.Decide(inputs);

            return(result);
        }
Exemple #4
0
        public void Add(ControllerOutput controllerOutput)
        {
            var dataSetInstance = Mapper.Map <Gesture>(controllerOutput);

            dataSetInstance.SetClass(OutputClass);

            DataSet.Add(dataSetInstance);
        }
Exemple #5
0
    private void CreateButton <T>(MenuSettings <T> settings) where T : UnityEngine.Object
    {
        EditorGUILayout.BeginHorizontal();
        T[]      objs  = FindObjectsOfType <T>();
        string[] names = objs.Select(x => x.name).ToArray();
        string   msg   = "";

        if (ArrayUtility.Contains(names, settings.name))
        {
            msg = "Duplicate name"; GUI.enabled = false;
        }
        if (settings.name == "")
        {
            msg = "Empty Name"; GUI.enabled = false;
        }
        EditorGUILayout.LabelField(msg, GUILayout.Width(197));
        if (GUILayout.Button("Create", LayoutSettings.buttonOp))
        {
            GameObject obj = new GameObject(settings.name);
            //Controller.
            if (typeof(T) == typeof(ControllerOutput))
            {
                //Create Controller.
                ControllerObject cont = (ControllerObject)obj.AddComponent(System.Type.GetType(string.Format("Gimbl.{0}", contType.ToString())));
                cont.InitiateController();
                //Create general Output Object and link.
                ControllerOutput contOut = obj.AddComponent <ControllerOutput>();
                contOut.master = cont;
                // Select created.
                settings.selectedObj = contOut as T;
            }
            //Actor.
            if (typeof(T) == typeof(ActorObject))
            {
                ActorObject act = obj.AddComponent <ActorObject>();
                act.InitiateActor(actorModels[selectedModel], trackCam);
                settings.selectedObj = act as T;
            }
            //Path.
            if (typeof(T) == typeof(PathCreator))
            {
                CreatePath(settings as MenuSettings <PathCreator>, obj);
            }
            settings.name = "";
        }
        EditorGUILayout.EndHorizontal();
    }
        protected double[] GetDecideInputs(ControllerOutput controllerOutput)
        {
            var result = controllerOutput
                         .GetType()
                         .GetProperties()
                         .Select(x =>
            {
                var value = x.GetValue(controllerOutput) as float?;
                return(value);
            })
                         .Where(x => x.HasValue)
                         .Select(x => x.Value)
                         .ToArray()
                         .ToDouble();

            return(result);
        }
        public ControllerOutput GetControllerOutput(Hand hand)
        {
            var controllerOutput = new ControllerOutput()
            {
                GrabAngle        = hand.GrabAngle,
                IsThumbExtended  = IsFingerExtended(hand, Finger.FingerType.TYPE_THUMB),
                IsIndexExtended  = IsFingerExtended(hand, Finger.FingerType.TYPE_INDEX),
                IsMiddleExtended = IsFingerExtended(hand, Finger.FingerType.TYPE_MIDDLE),
                IsPinkyExtended  = IsFingerExtended(hand, Finger.FingerType.TYPE_PINKY),
                IsRingExtended   = IsFingerExtended(hand, Finger.FingerType.TYPE_RING),
                ThumbIndexAngle  =
                    GetAngleBetweenFingers(hand, Finger.FingerType.TYPE_THUMB, Finger.FingerType.TYPE_INDEX),
                IndexMiddleAngle =
                    GetAngleBetweenFingers(hand, Finger.FingerType.TYPE_INDEX, Finger.FingerType.TYPE_MIDDLE),
                MiddleRingAngle =
                    GetAngleBetweenFingers(hand, Finger.FingerType.TYPE_MIDDLE, Finger.FingerType.TYPE_RING),
                RingPinkyAngle =
                    GetAngleBetweenFingers(hand, Finger.FingerType.TYPE_RING, Finger.FingerType.TYPE_PINKY)
            };

            return(controllerOutput);
        }