Пример #1
0
    void Start()
    {
        StartPos   = boat.transform.position;
        Rbody      = this.GetComponent <Rigidbody>();
        recorder   = GetComponent <DataRecorder>();
        nextaction = new float[2];


        Reward = 0;
    }
Пример #2
0
        async Task IFilter <TContext> .Send(TContext context, IPipe <TContext> next)
        {
            var timingId = Interlocked.Increment(ref _nextTimingId);

            var instance = new DataRecorder(timingId, context);

            await next.Send(context).ConfigureAwait(false);

            instance.Complete(_reportProfileData, _trivialThreshold);
        }
Пример #3
0
    //Save the values of the data recorder to the DB.
    //When called, sets to the AWAITING_RESPONSE state
    //Once a response is received, changes to RESPONSE_RECEIVED
    //Sets response based on
    // 200 - SUCCESS (scores saved)
    // 404 - NOTFOUND (scores not saved)
    // ?   - OTHER (something else)
    IEnumerator SaveData(DataRecorder recorder)
    {
        UnityWebRequest.ClearCookieCache();

        if (currentState != DbConnectionState.READY)
        {
            Debug.LogWarning("Tried to connect to the DB before receiving response, will not process this request");
            yield break;
        }

        currentState = DbConnectionState.AWAITING_RESPONSE;
        yield return(StartCoroutine(CheckDbConnection()));

        if (currentState != DbConnectionState.AWAITING_RESPONSE)
        {
            yield break;
        }

        var www = new UnityWebRequest(baseURL + "save_data.php", "POST");

        byte[] bodyRaw = Encoding.UTF8.GetBytes(recorder.ToJSON());
        www.uploadHandler   = (UploadHandler) new UploadHandlerRaw(bodyRaw);
        www.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        www.SetRequestHeader("Content-Type", "application/json");

        yield return(www.SendWebRequest());

        DbResponseState state;

        if (www.responseCode == 200)
        {
            state = DbResponseState.SUCCESS;
        }
        else if (www.responseCode == 404)
        {
            state = DbResponseState.NOTFOUND;
        }
        else
        {
            Debug.LogError("Unexpected response when trying to save data: " + www.error);
            Debug.Log(www.downloadHandler.text);
            state = DbResponseState.OTHER;
        }

        if (disregardNext)
        {
            currentState = DbConnectionState.READY;
            lastResponse = null;
        }
        else
        {
            currentState = DbConnectionState.RESPONSE_RECEIVED;
            lastResponse = new DbResponse(state, www.downloadHandler.text, www.GetResponseHeaders());
        }
    }
Пример #4
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #5
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject); // prevent this game object from being destroyed if a new level is loaded
     }
     else
     {
         Destroy(gameObject);    // destroy this gameobject if one already exists
     }
 }
Пример #6
0
 private void dataRecorderToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if ((Recorder == null) || Recorder.IsDisposed)
     {
         Recorder = new DataRecorder(DB);
         Recorder.Show();
     }
     else
     {
         Recorder.BringToFront();
     }
 }
Пример #7
0
 void Start()
 {
     try
     {
         FilePathText.text = DataRecorder.WriteFile();
     }
     catch (System.Exception e)
     {
         Debug.LogException(e, this);
         FilePathText.text = "An error occured while saving the file.";
     }
 }
Пример #8
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #9
0
    /// <summary>
    /// Record varying data in a DataRecorder.
    /// </summary>
    /// <param name="DataRecorder">Plug a DataRecorder object.</param>
    /// <param name="data">Data to record.</param>
    /// <param name="record">Record data?</param>
    /// <param name="reset">Flush all data from the DataRecorder?</param>
    /// <returns name = "recordedData">The data stored in the DataRecorder.</returns>
    public static List <object> Record(DataRecorder DataRecorder, object data, bool record = true, bool reset = false)
    {
        if (record)
        {
            DataRecorder.Add(data);
        }

        if (reset)
        {
            DataRecorder.Flush();
        }

        return(DataRecorder.GetRecords());
    }
Пример #10
0
        public async Task DeployLldbServerAsync(SshTarget target, Metrics.IAction action)
        {
            DataRecorder record = new DataRecorder(action, DataRecorder.File.LLDB_SERVER);

            record.SetCopyAttempted(true);

            string localLldbServerPath = GetLldbServerPath();
            string remotePath          = Path.Combine(YetiConstants.LldbServerLinuxPath,
                                                      YetiConstants.LldbServerLinuxExecutable);

            await DeployToTargetAsync(record, new NothingToCancel(), target, localLldbServerPath,
                                      YetiConstants.LldbServerLinuxPath);
            await SetRemoteExecutableBitAsync(target, remotePath, record);
        }
Пример #11
0
    void Start()
    {
        //added gameobjects
        m_dr  = GameObject.Find("DataRecorder").GetComponent <DataRecorder>();
        m_bsd = GameObject.Find("BetweenSceneData").GetComponent <BetweenSceneData>();

        m_Player = FindObjectOfType <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, GameFlowManager>(m_Player, this);

        m_ObjectiveManager = FindObjectOfType <ObjectiveManager>();
        DebugUtility.HandleErrorIfNullFindObject <ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this);

        AudioUtility.SetMasterVolume(1);
    }
    // Use this for initialization
    void Start()
    {
        GameObject.DontDestroyOnLoad(this.gameObject);
        instance = this;

        _participantNumber      = GetNextParticipantNumber();
        participantNumText.text = _participantNumber.ToString();

        //create new file, overwrite if exists, with player number on top
        dataWriter = new StreamWriter(Application.persistentDataPath + "/" + _participantNumber.ToString() + dataFilename, false);

        dataWriter.WriteLine(_participantNumber.ToString());

        dataWriter.Close();
    }
Пример #13
0
 public void Submit()
 {
     if (_submitted || !SubmissionEnabled)
     {
         return;                                   //don't allow multiple submissions
     }
     //submit _curLevel to data storage object
     if (_submitCallback == null || _submitCallback.Invoke(_curLevel))
     {
         DataRecorder.RecordEvent(DataEvent.AnxietyLevel, _curLevel);
     }
     _submitted = true;
     CancelInvoke("Submit");
     Fader.FadeOut();
 }
Пример #14
0
    void Start()
    {
        // Create a new GestureRecognizer. Sign up for tapped events.

        gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);

        gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;

        // Start looking for gestures.
        gestureRecognizer.StartCapturingGestures();

        brainParts   = GameObject.Find("BrainParts");
        dataRecorder = (DataRecorder)FindObjectOfType(typeof(DataRecorder));
    }
Пример #15
0
        public async Task ExecuteCustomCommandAsync(IAsyncProject project, Gamelet gamelet,
                                                    Metrics.IAction action)
        {
            DataRecorder record = new DataRecorder(action, DataRecorder.File.GAME_EXECUTABLE);

            record.Gamelet(gamelet);
            string customDeployCommand = await project.GetCustomDeployOnLaunchAsync();

            bool attemptedCustomDeploy = !string.IsNullOrEmpty(customDeployCommand);

            record.SetAttemptedCustomCommand(attemptedCustomDeploy);
            if (attemptedCustomDeploy)
            {
                await CustomCommandAsync(project, gamelet, record, customDeployCommand);
            }
        }
Пример #16
0
    void Awake()
    {
        inputManager = GetComponent <InputManager>();
        trackPoints  = new Transform[track.childCount];

        for (int i = 0; i < trackPoints.Length; i++)
        {
            trackPoints[i] = track.GetChild(i);
        }
        car          = GetComponent <carController>();
        carRigidbody = GetComponent <Rigidbody>();
        trackBuilder = track.GetComponent <TrackBuilder>();

        tdr   = GetComponent <DataRecorder>();
        brain = GetComponent <NeuralBrain>();
    }
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                CommandID   menuCommandID = new CommandID(GuidList.guidCollectorCmdSet, (int)PkgCmdIDList.StopMonitoring);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                mcs.AddCommand(menuItem);
            }
            DataRecorder.Start();
        }
Пример #18
0
        async Task SetRemoteExecutableBitAsync(SshTarget target, string remoteTargetPath,
                                               DataRecorder record)
        {
            try
            {
                await _remoteCommand.RunWithSuccessAsync(target, "chmod a+x " + remoteTargetPath);

                record.Chmod(DataRecorder.NoError);
            }
            catch (ProcessException e)
            {
                Trace.WriteLine("Error setting executable permissions: " + e.ToString());
                record.Chmod(e);
                throw new DeployException(ErrorStrings.FailedToSetExecutablePermissions(e.Message),
                                          e);
            }
        }
    // Start is called before the first frame update
    public NetworkHelper(int port, string pingIP, int timeout, Mode initial)
    {
        mode = initial;
        switch (mode)
        {
        case Mode.Recording:
            recorder = new DataRecorder(GameController.getInstance().SaveLocation, ".sav", timeout);
            goto case Mode.Networked;

        case Mode.Networked:

            break;

        case Mode.Playback:
            loadSave(GameController.getInstance().loadedFile);
            break;
        }
    }
Пример #20
0
    void OnTriggerEnter(Collider otherObject)
    {
        if (otherObject.gameObject.CompareTag("Player"))
        {
            charController = GetComponent <CharacterController>();

            playerFPSController.GetComponent <CharacterController>().enabled            = false;
            playerFPSController.GetComponent <CharacterController>().transform.position = respawnPoint.transform.position;
            playerFPSController.GetComponent <CharacterController>().enabled            = true;

            levelHandler.deaths++;

            DataRecorder.recordDeathPosition3D(transform.position);

            //player.transform.position = spawn.transform.position;
            Debug.Log(otherObject.transform.name);
        }
    }
Пример #21
0
 void OnTriggerEnter(Collider other)
 {
     if (!chaseMode && other.CompareTag("Player"))
     {
         active = true;
         //car in
         DataRecorder dr = other.GetComponentInChildren <DataRecorder>();
         if (dr)
         {
             if (dr.getSpeed() - speedDiff < minSpeed)
             {
                 spawnSpeed = minSpeed;
             }
             else
             {
                 spawnSpeed = dr.getSpeed() - speedDiff;
             }
         }
     }
 }
Пример #22
0
    void Awake()
    {
        model = GetComponent <ModelBehavior> ();

        if (RecordData)
        {
            if (!Directory.Exists(model.OutputPath))
            {
                System.IO.Directory.CreateDirectory(model.OutputPath);
            }

            pararecorder = GetComponent <ParameterRecorder>();
            datarecorder = GetComponent <DataRecorder>();
        }

        ReplicatesCompleted = 0;
        HalfMaxSteps        = MaxSteps / 2;

        SetupSimulation();
    }
Пример #23
0
        /// <summary>
        /// Sets the final results of the list of current data records and writes this list to the corresponding data log file.
        /// </summary>
        /// <param name="finalResult">The final result.</param>
        public void WriteListOfDataRecordsToFile(TResult finalResult)
        {
            lock (this._lock)
            {
                this.AddFinalDataRecordIfMissing(finalResult);

                // Set final results.
                this._listOfDataRecords.ForEach(x => x.TunerDataRecord.FinalResult = finalResult);

                // Write data records to corresponding data log file.
                var dataLogFileName = GrayBoxUtils.GetDataLogFileName(
                    this._tunerDataRecord.GenerationId,
                    ProcessUtils.GetCurrentProcessId(),
                    this._actorId,
                    finalResult.TargetAlgorithmStatus);
                var dataRecorder =
                    new DataRecorder <TResult>(new FileInfo(Path.Combine(this._configuration.DataRecordDirectoryPath, dataLogFileName)));
                dataRecorder.WriteRows(this._listOfDataRecords);
            }
        }
    protected void InternalZoneCompleted()
    {
        curZoneCount += 1;

        Vector2 lastWaypoint    = data.waypoints[data.waypoints.Count - 1];
        Vector2 currentWaypoint = new Vector2(ZoneTransform.position.x, ZoneTransform.position.z);

        float dist = Vector2.Distance(lastWaypoint, currentWaypoint);

        //record our data:
        data.times.Add(timeSinceLastCollection);
        data.waypoints.Add(currentWaypoint);
        data.distancesWaypoint.Add(dist);
        data.distancesMoved.Add(currentWaypointDistanceMoved);

        //reset variables
        currentWaypointDistanceMoved = 0;
        timeSinceLastCollection      = 0f;

        //if we're done, add the final data and finish
        if (curZoneCount >= NumTestZones)
        {
            StepDetector.instance.OnStepDetected -= OnStepDetected;
            if (isPractice)
            {
                DataRecorder.FinishPractice();
            }
            else
            {
                data.totalDistanceTraveled = totalDistanceMoved;
                data.totalTime             = totalTime;
                data.totalSteps            = totalSteps;
                DataRecorder.FinishRun(data);
            }
        }
        else
        {
            bool obstacle = ShouldHaveObstacle(curZoneCount);
            SetZonePosition(obstacle);
        }
    }
        /// <summary>
        /// This function is the callback used to execute a command when the a menu item is clicked.
        /// See the Initialize method to see how the menu item is associated to this function using
        /// the OleMenuCommandService service and the MenuCommand class.
        /// </summary>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            DataRecorder.Stop();
            // Show a Message Box to prove we were here
            IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
            Guid       clsid   = Guid.Empty;
            int        result;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(uiShell.ShowMessageBox(
                                                                   0,
                                                                   ref clsid,
                                                                   "Collector",
                                                                   string.Format(CultureInfo.CurrentCulture, "Collector Stopped"),
                                                                   string.Empty,
                                                                   0,
                                                                   OLEMSGBUTTON.OLEMSGBUTTON_OK,
                                                                   OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
                                                                   OLEMSGICON.OLEMSGICON_INFO,
                                                                   0, // false
                                                                   out result));
        }
Пример #26
0
    void Awake()
    {
        //set up added parameters
        m_gm = GameObject.Find("GameManager").GetComponent <GameManager>();
        m_dr = GameObject.Find("DataRecorder").GetComponent <DataRecorder>();

        m_CurrentAmmo        = maxAmmo;
        m_LastMuzzlePosition = weaponMuzzle.position;

        m_ShootAudioSource = GetComponent <AudioSource>();
        DebugUtility.HandleErrorIfNullGetComponent <AudioSource, WeaponController>(m_ShootAudioSource, this, gameObject);

        if (useContinuousShootSound)
        {
            m_continuousShootAudioSource                       = gameObject.AddComponent <AudioSource>();
            m_continuousShootAudioSource.playOnAwake           = false;
            m_continuousShootAudioSource.clip                  = continuousShootLoopSFX;
            m_continuousShootAudioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.WeaponShoot);
            m_continuousShootAudioSource.loop                  = true;
        }
    }
Пример #27
0
    public Dictionary <string, double> refreshData(int frame)
    {
        switch (datamode)
        {
        case Mode.NetworkedUninit:
            robotTables = new SocketTables(socketTablesAddr);
            datamode    = Mode.Networked;
            goto case Mode.Networked;

        case Mode.Networked:

            break;

        case Mode.RecordingUninit:
            robotTables = new SocketTables(socketTablesAddr);
            recorder    = new DataRecorder(GameController.getInstance().SaveLocation, ".sav", recorderTimeout);
            datamode    = Mode.Recording;
            goto case Mode.Recording;

        case Mode.Recording:

            break;

        case Mode.PlaybackUninit:

            datamode = Mode.Playback;
            goto case Mode.Playback;

        case Mode.Playback:

            break;

        case Mode.Disconnected:

            break;
        }

        return(dataTable);
    }
Пример #28
0
        public override void Execute(DataRecorder recorder)
        {
            string reportsDir = glContext.ReportsDirFull;

            log.Info("--- Формируем отчет ---");
            string            reportId = DateTime.Now.ToString("yyyyMMdd_HHmmss");
            TemplateProcessor proc     = new TemplateProcessor(reportsDir, reportId);

            recorder.ReadRecords((dt, name, values) =>
            {
                List <DataObject> list = null;
                if (proc.Data.ContainsKey(name))
                {
                    list = proc.Data[name];
                }
                else
                {
                    list            = new List <DataObject>();
                    proc.Data[name] = list;
                }

                list.Add(new DataObject()
                {
                    Time = dt, Values = values
                });
            });
            recorder.Rotate();

            proc.ProcessFile(Path.Combine(glContext.BaseDir, Parameters["template"]));



            Directory.CreateDirectory(reportsDir);

            string reportFile = Path.Combine(reportsDir, reportId + ".report");

            File.WriteAllText(reportFile, proc.Report);
        }
Пример #29
0
        private void StartRecording(KinectRecordOptions options)
        {
            StopReplaying();
            StopRecording();

            string fileId = Guid.NewGuid().ToString();

            FilesUsed.Add(fileId, _fileLocation + fileId);

            if (null != KinectRecorder && KinectRecorder.IsRecording)
            {
                KinectRecorder.Stop();
            }

            _recordingStream = new FileStream(
                FilesUsed[fileId],
                FileMode.OpenOrCreate
                );

            if (null != DataRecorder && DataRecorder.IsRecording)
            {
                DataRecorder.Stop();
            }

            _dataOutStream = new FileStream(
                FilesUsed[fileId] + "_data",
                FileMode.OpenOrCreate
                );

            KinectRecorder = new KinectRecorder(options, _recordingStream);
            KinectRecorder.Start();

            DataRecorder = new PostProcessedRecorder(_dataOutStream);
            DataRecorder.Start();

            Status = Service.RecordingManagerStatus.Recording;
            OnRecordingStatusChanged(new RecordingStatusChangedEventArg(fileId));
        }
Пример #30
0
    void ClosePipe()
    {
        // Close the output stream.
        Debug.Log("Capture ended (" + _pipe.Filename + ").");
        DataRecorder.StopRecording();
        // Write pupil timestamps to a file
        string timeStampFileName = "Heatmap_Timestamps";

        byte[] timeStampByteArray = timeStampList.ToArray();
        File.WriteAllBytes(_pipe.FilePath + "/" + timeStampFileName + ".time", timeStampByteArray);
        DataRecorder.SaveRecording(_pipe.FilePath);
        _pipe.Close();

        if (!string.IsNullOrEmpty(_pipe.Error))
        {
            Debug.LogWarning(
                "ffmpeg returned with a warning or an error message. " +
                "See the following lines for details:\n" + _pipe.Error
                );
        }

        _pipe = null;
    }