Beispiel #1
0
        public static void load_session(
            DeviceType deviceType,
            int external_PID,
            List <Frame> frames,
            Dataset ds)
        {
            string sessionPath = App_datapath;

            sessionPath += GetDevicePath(deviceType, forTraining: false);
            sessionPath += $"{external_PID:D3}";
            sessionPath += "/session_1";

            RecordedSession rs = RecordedSession.Load(
                sessionPath,
                deviceType: deviceType,
                isSession: true,
                external_PID: external_PID);

            List <Tuple <int, string> > command = rs.Commands;
            List <Vector> trajectory            = rs.PlayerData.trajectory;
            List <float>  timestamps            = rs.PlayerData.timestamps;

            for (int i = 0; i < trajectory.Count; i++)
            {
                Frame frame = new Frame(
                    trajectory[i],
                    timestamps[i],
                    command[i].Second,
                    ds.GestureNameToId(command[i].Second),
                    command[i].First);

                frames.Add(frame);
            }
        }
Beispiel #2
0
        public static void GetAllCommands(
            List <GestureCommand> commands,
            Dataset dataset,
            DeviceType deviceType,
            int pid
            )
        {
            int deviceToUse = (int)deviceType;

            // Both Vives should be mapped to device 2
            if (deviceType == DeviceType.VIVE_POSITION || deviceType == DeviceType.VIVE_QUATERNION)
            {
                deviceToUse = 2;
            }

            commands.Clear();

            for (int ii = 0; ii < Truth.truth.Count; ii++)
            {
                if (deviceToUse != Truth.truth[ii].device)
                {
                    continue;
                }

                if (pid != Truth.truth[ii].pid)
                {
                    continue;
                }

                GestureCommand cmd = new GestureCommand();
                cmd.gid      = dataset.GestureNameToId(Truth.truth[ii].gname);
                cmd.start    = Truth.truth[ii].start;
                cmd.end      = Truth.truth[ii].end;
                cmd.detected = false;

                commands.Add(cmd);
            }
        }