THE LIDAR MOUNT.
Every wall-follow and gap-finder assumes that sample 0 points exactly where the car points. If the scanner sits a few degrees rotated, the whole scan rotates with it and the car steers into a wall it thinks is ahead. This one is a physical alignment, confirmed in software.
YAW AND TILT.
Two things can be off with a planar scanner. A yaw error rotates the whole scan, so the forward reading lands at the wrong index and every angle you read is shifted. A tilt error points the plane up or down, so the beam clips the floor or the ceiling at range and reads short. Mounting it flush and square fixes both at once.
WHAT YOU NEED.
A flat wall
A tape measure
FLUSH AND SQUARE.
- Sit the scanner flat on its mount so its scan plane is level with the floor, not nodding up or down.
- Square it to the chassis so the zero mark faces straight forward, in line with the car's centerline.
- Leave the screws finger-tight for now. You will nudge the yaw during the wall test, then lock it.
- Keep the cable strain-relieved so a tug on it cannot rotate the unit later.
THE WALL TEST.
Park the car one metre from the wall, nose square to it, in open space on the left and right. Then read forward and the two sides:
pythonimport racecar_core rc = racecar_core.create_racecar() def start(): pass def update(): scan = rc.lidar.get_samples() # 720 floats, cm forward = scan[0] # index 0 = straight ahead right = scan[180] # index 180 = 90 deg right (0.5 deg/index) left = scan[540] # index 540 = 90 deg left print(f"forward {forward:5.0f} cm right {right:5.0f} left {left:5.0f}") rc.set_start_update(start, update) rc.go()
- Forward should read your tape distance (about 100 cm). Much shorter means the plane is tilted down into the floor; much longer means it is aimed over the wall.
- The nearest point of the front arc should sit at index 0. If the closest reading is a few indices to one side, the mount is yawed by that many half-degrees. Rotate it the other way and re-read.
- Left and right should match in a symmetric space, a quick confirmation the zero is centered.
WHERE IT LIVES.
The teaching driver has no fine yaw-offset parameter for the scanner, so this alignment lives in the hardware. Once the wall test reads clean, tighten the mount and you are done. If you run the osracer stack for and navigation, the mount pose is also encoded as the base_link to lidar_link transform in its , covered on the TF frames page; keep the two in agreement.
