Skip to content

Commit 4bcb3f6

Browse files
committed
Use realistic values for min/max range, normalize to meters.
1 parent db6b18f commit 4bcb3f6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ros_ws/src/lidar/lidar/lidar_node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ def publish_scan(self, frame: bytes) -> None:
116116
msg.angle_min = math.radians(fsa)
117117
msg.angle_max = math.radians(lsa)
118118
msg.angle_increment = math.radians(step)
119-
msg.range_min = 0.0
120-
msg.range_max = float(0x3FFF)
119+
msg.range_min = 0.02 # radius of scanner head is 2 cm
120+
msg.range_max = 10.0 # assumed
121121
# time between full 360 sweep: approx 6 rotations per second
122-
msg.scan_time = 1.0 / 6
122+
msg.scan_time = 1.0 / 5.8
123123
# time between rays: 6 fps, 36*16 rays per scan
124124
msg.time_increment = msg.scan_time * 10 / (360 * 16)
125125

@@ -128,7 +128,7 @@ def publish_scan(self, frame: bytes) -> None:
128128
dist = (frame[idx] + (frame[idx + 1] << 8)) & 0x3FFF
129129
intensity = frame[idx + 2]
130130
idx += 3
131-
msg.ranges.append(float(dist))
131+
msg.ranges.append(dist / 1000.0) # normalize to meters
132132
msg.intensities.append(float(intensity))
133133

134134
self.publisher.publish(msg)

0 commit comments

Comments
 (0)