From bbf3e02cdcd596bd8b512a8d9c78451da66657e4 Mon Sep 17 00:00:00 2001 From: Hyunseok Yang Date: Fri, 14 Aug 2020 15:54:42 +0900 Subject: [PATCH] Code cleanup in Devices - IMU - Lidar --- Assets/Scripts/Devices/IMU.cs | 8 ++------ Assets/Scripts/Devices/Lidar.cs | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Devices/IMU.cs b/Assets/Scripts/Devices/IMU.cs index 824f2999..3d5fc49d 100644 --- a/Assets/Scripts/Devices/IMU.cs +++ b/Assets/Scripts/Devices/IMU.cs @@ -6,7 +6,6 @@ using System.Collections; using UnityEngine; -using Stopwatch = System.Diagnostics.Stopwatch; using messages = gazebo.msgs; namespace SensorDevices @@ -86,14 +85,11 @@ void FixedUpdate() protected override IEnumerator MainDeviceWorker() { - var sw = new Stopwatch(); + var waitForSeconds = new WaitForSeconds(UpdatePeriod); while (true) { - sw.Restart(); GenerateMessage(); - sw.Stop(); - - yield return new WaitForSeconds(WaitPeriod((float)sw.Elapsed.TotalSeconds)); + yield return waitForSeconds; } } diff --git a/Assets/Scripts/Devices/Lidar.cs b/Assets/Scripts/Devices/Lidar.cs index 2248b069..7a8dcfd2 100644 --- a/Assets/Scripts/Devices/Lidar.cs +++ b/Assets/Scripts/Devices/Lidar.cs @@ -262,7 +262,6 @@ private IEnumerator LaserCameraWorker() protected override IEnumerator MainDeviceWorker() { - // var waitForSeconds = new WaitForSeconds(UpdatePeriod * adjustCapturingRate); var sw = new Stopwatch(); while (true) {