From ee27c17f7c87ccd83e58d89254a07978353cb1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20S=C3=B6derlund?= Date: Tue, 6 Aug 2019 07:19:11 +0200 Subject: [PATCH] Don't recalculate timing offsets in inner loop Moving the timing offset calculation up one loop has no effect on the results, since it depends on the packet, but not any specific block. --- spherical_point_cloud.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spherical_point_cloud.go b/spherical_point_cloud.go index 5506d34..ed43813 100644 --- a/spherical_point_cloud.go +++ b/spherical_point_cloud.go @@ -24,10 +24,10 @@ type SphericalPoint struct { func (s *SphericalPointCloud) UnmarshalPacket(packet *Packet) { // duration is in nanoseconds and Velodyne timestamp in microseconds s.Timestamp = time.Duration(packet.Timestamp) * time.Microsecond + timingOffsets := calculateTimingOffset(packet.ReturnMode) for i := range packet.Blocks { block := &packet.Blocks[i] azimuth := block.Azimuth - timingOffsets := calculateTimingOffset(packet.ReturnMode) for j := range block.Channels { channel := &block.Channels[j] if j == 16 {