Fix Family B angle decode + add LR-1FMI model
parse_family_b() dùng sai hệ số góc 0.25°/LSB; theo spec Olei chính hãng (Olei.LidarSensor/LidarDataBlock.GetAngleDegrees) AngleRaw là 0.01°/LSB. Sai 25× khiến điểm bị gán nhầm góc → một phòng bị bôi thành vòng tròn trên RViz. Đã verify với thiết bị thật OLELR-1FMI: sau khi sửa ra 2400 điểm/vòng, 0–359.9°, đúng hình học môi trường. - Đổi hệ số góc 0.25° → 0.01° trong parse_family_b(). - Bỏ qua block invalid (AngleRaw >= 0xFF00) theo spec. - Dò ranh giới vòng quay PER-POINT thay vì per-packet (một gói có thể chứa >1 vòng), tránh gộp nhiều vòng vào một scan. - Thêm model LR-1FMI (360°, 0.01°/LSB, ~2400 pts/rev) vào bảng model + kModelTable, đặt "1FMI" trước "1F" để khớp đúng chuỗi tên. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
40
examples/sick_example.cpp
Normal file
40
examples/sick_example.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// sick_example.cpp — quick try-out of the SICK TiM driver (SOPAS/CoLa-A, TCP)
|
||||
//
|
||||
// Verified against a real SICK TiM781S — see the caveat in
|
||||
// include/lidarlib/sick_lidar.hpp for exactly what was (and wasn't) confirmed.
|
||||
#include "lidarlib/sick_lidar.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
int main() {
|
||||
lidarlib::SickDriver drv(lidarlib::MODEL_SICK_TIM571, "192.168.0.1", 2111);
|
||||
|
||||
if (!drv.open()) {
|
||||
fprintf(stderr, "Không kết nối được TCP tới lidar SICK\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
lidarlib::ScanResult result;
|
||||
if (!drv.recv_scan(result, 2000)) {
|
||||
fprintf(stderr, "Timeout hoặc lỗi nhận telegram\n");
|
||||
break;
|
||||
}
|
||||
const lidarlib::LaserScan& scan = result.scan;
|
||||
const lidarlib::ExtraInfo& info = result.info;
|
||||
printf("Scan #%d: %zu điểm, ts=%u ms, err=0x%02X, model=%s\n",
|
||||
i, scan.ranges.size(), scan.timestamp_ms, info.error_status,
|
||||
info.detected_model.c_str());
|
||||
|
||||
for (size_t j = 0; j < 20 && j < scan.ranges.size(); ++j) {
|
||||
float angle_deg = (scan.angle_min + j * scan.angle_increment) * 180.f / 3.14159265f;
|
||||
printf(" [%zu] angle=%.2f° dist=%.3fm intensity=%.0f\n",
|
||||
j, angle_deg, scan.ranges[j], scan.intensities[j]);
|
||||
}
|
||||
}
|
||||
|
||||
drv.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Build:
|
||||
// g++ -std=c++17 -O2 -Iinclude -o sick_example examples/sick_example.cpp src/sick_lidar.cpp
|
||||
Reference in New Issue
Block a user