internal override void CaptureData() { this.dataList.Clear(); //capture data is only called from inspector this.CheckRecorderValidity(); if (this.isValid == false) { Debug.LogError("Curve recorder configuration is invalid. Could not extract curve data."); return; } AnimationCurve anim = null; switch (this.transferFunction) { case TransferFunctionType.Visual: anim = vehicle.visualProcessingFunction.curve; break; case TransferFunctionType.Motor: anim = vehicle.visuoMotorFunction.curve; break; case TransferFunctionType.Rotation: anim = vehicle.rotationFunction.curve; break; case TransferFunctionType.Drag: anim = vehicle.vehicleDragFunction.curve; break; } //convert the rate to an interval that can be used to increment the x value float interval = MyRoutines.ConvertRateToInterval(this.outputDetails.dataCaptureRate); if (anim == null) { Debug.LogError("Could not resolve curve."); return; } if (anim.length == 0) { Debug.LogError("The curve does not contain any keyframes."); return; } float maxX = MyRoutines.AnimationCurveMaximumXValue(anim); float x = 0f; while (x < maxX) { this.dataList.Add(x, anim.Evaluate(x)); x += interval; } //add in value for last x value this.dataList.Add(maxX, anim.Evaluate(maxX)); //now save the data this.recording = true; this.SaveData(); this.recording = false; Debug.Log("Saved data to " + this.outputDetails.outputPath); }
private bool RecordEyeTestData() { //only record eye data if: //1. the eye test is enabled //2. there was no error while initializing the eyetest //3. the appropriate amount of time has lapsed since the last data serialization //4. the stop time has not been reached return((this.eyeTest.enabled == true) && (this.eyeTest.initializationError == false) && (Time.time >= (MyRoutines.ConvertRateToInterval(this.eyeTest.rate) + this.lastEyeTestTime) && (Time.time <= this.eyeTest.stopTime))); }
// Use this for initialization internal override void Start() { base.Start(); this.isActivated = false; //disable the vehicle motor this.vehicle.disableMotor = true; //initialize the vehicle's eye memory eyeMemoryLeft = new Queue <ColorInformation[, ]> (this.eyeMemoryCapacity); eyeMemoryRight = new Queue <ColorInformation[, ]> (this.eyeMemoryCapacity); //initialize the vehicle's eyes this.InitEye(this.leftEye); this.InitEye(this.rightEye); this.InvokeRepeating("ProcessScene", 0, MyRoutines.ConvertRateToInterval(this.lookRate)); }
// Use this for initialization void Start() { if (useRate) { InvokeRepeating("DepositMarker", 0, MyRoutines.ConvertRateToInterval(rate)); } else { //use a list of times //sort the times in increasing order List <float> t = new List <float>(this.times); t.Sort(); foreach (float f in t) { Debug.Log(f.ToString()); } q = new Queue <float> (t); } }
internal override void OnStart() { if (record) { //set data capture rate to zero to ensure that data capture is invoked from update int tempDataCaptureRate = this.outputDetails.dataCaptureRate; this.outputDetails.dataCaptureRate = 0; base.OnStart(); if (this.isValid) { Time.captureFramerate = this.outputDetails.dataCaptureRate; } this.outputDetails.dataCaptureRate = tempDataCaptureRate; this.captureInterval = MyRoutines.ConvertRateToInterval(this.outputDetails.dataCaptureRate); } else { this.recording = false; } }
internal virtual void OnStart() { this.dataList.Clear(); recording = false; this.CheckRecorderValidity(); if (this.isValid == false) { return; } //if datacapture rate is greater than zero then call CaptureData routine with relevant interval if (this.outputDetails.dataCaptureRate > 0) { this.InvokeRepeating("CaptureData", 0, MyRoutines.ConvertRateToInterval(this.outputDetails.dataCaptureRate)); this.runInUpdate = false; } else { runInUpdate = true; } //set recording to true recording = true; }