update
This commit is contained in:
@@ -68,7 +68,8 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) {
|
|||||||
const StatusResponse r =
|
const StatusResponse r =
|
||||||
Reject(l, "sensors.yaml lidar",
|
Reject(l, "sensors.yaml lidar",
|
||||||
{"host", "port", "expected_rate_hz", "range_min", "range_max",
|
{"host", "port", "expected_rate_hz", "range_min", "range_max",
|
||||||
"stamp_mismatch_warn", "sector_masks"});
|
"stamp_mismatch_warn", "sector_masks",
|
||||||
|
"angle_offset_deg", "angle_flip"});
|
||||||
if (!r.ok()) return r;
|
if (!r.ok()) return r;
|
||||||
}
|
}
|
||||||
out->sanitizer.range_min = l.get<double>("range_min", 0.05);
|
out->sanitizer.range_min = l.get<double>("range_min", 0.05);
|
||||||
@@ -83,10 +84,16 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) {
|
|||||||
out->lidar_driver.frame_id = kLaserFrame;
|
out->lidar_driver.frame_id = kLaserFrame;
|
||||||
out->lidar_driver.sweep_duration_tolerance_sec =
|
out->lidar_driver.sweep_duration_tolerance_sec =
|
||||||
l.get<double>("stamp_mismatch_warn", 0.005);
|
l.get<double>("stamp_mismatch_warn", 0.005);
|
||||||
// ⚠️ range_unit_m, angle_offset_deg va inverted CO Y khong doc tu YAML.
|
// Goc DOC TU YAML, khong hardcode.
|
||||||
// Ca ba deu suy ra duoc (xem driver_config.h): don vi mm tu SDK, va goc
|
//
|
||||||
// tu manual §8.1 + REP-103 + tu the gan up nguoc. De chung trong YAML moi
|
// Ban dau mac dinh o driver_config.h duoc coi la "da co dap an dung" nen
|
||||||
// la de nguoi van hanh go bua vao mot thu da co dap an dung.
|
// khong cho doi. Sai: phep doi quy uoc phu thuoc TU THE GAN LiDAR, ma do
|
||||||
|
// la su that vat ly khong suy ra duoc tu tai lieu. De o YAML thi thu mot
|
||||||
|
// gia tri khac chi ton mot lan khoi dong lai, thay vi mot lan build.
|
||||||
|
out->lidar_driver.angle_offset_deg =
|
||||||
|
l.get<double>("angle_offset_deg", out->lidar_driver.angle_offset_deg);
|
||||||
|
out->lidar_driver.inverted =
|
||||||
|
l.get<bool>("angle_flip", out->lidar_driver.inverted);
|
||||||
|
|
||||||
// Sector mask ghi bang DO trong YAML (doc duoc bang mat), dung bang RAD.
|
// Sector mask ghi bang DO trong YAML (doc duoc bang mat), dung bang RAD.
|
||||||
// Doi mot lan o day, khong de moi noi tu doi.
|
// Doi mot lan o day, khong de moi noi tu doi.
|
||||||
|
|||||||
@@ -7,13 +7,39 @@
|
|||||||
lidar:
|
lidar:
|
||||||
# LakiBeam 1L, giao thuc UDP.
|
# LakiBeam 1L, giao thuc UDP.
|
||||||
#
|
#
|
||||||
# ⚠️ CHUA XAC MINH byte layout cua goi -- day la thu DUY NHAT con thieu de
|
# Giai ma goi do SDK chinh hang lo (lidar_core + lakibeam_sdk, nhung trong
|
||||||
# viet driver. Chay `vslam_lidar_probe --seconds 10` tren may noi duoc voi
|
# libs/vslam_drivers/thirdparty/). Khong con byte layout nao phai doan.
|
||||||
# LiDAR: no tu suy ra offset truong goc, vung mang range va so goi moi vong.
|
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 2368
|
port: 2368
|
||||||
expected_rate_hz: 25.0
|
expected_rate_hz: 25.0
|
||||||
|
|
||||||
|
# --- Quy uoc goc ---
|
||||||
|
#
|
||||||
|
# Driver tinh: theta = (angle_flip ? -alpha : alpha) + angle_offset_deg
|
||||||
|
#
|
||||||
|
# Manual §8.1 cho X = R*sin(a), Y = R*cos(a); REP-103 dung x = R*cos(t).
|
||||||
|
# Phep doi giua hai quy uoc phu thuoc TU THE GAN LiDAR:
|
||||||
|
#
|
||||||
|
# gan xuoi t = 90 - a offset 90, flip true
|
||||||
|
# lat quanh truc X t = a - 90 offset -90, flip false <- CON NAY
|
||||||
|
# lat quanh truc Y t = a + 90 offset 90, flip false
|
||||||
|
#
|
||||||
|
# LiDAR tren robot nay QUAY QUANH TRUC X 180 DO, da xac nhan voi nguoi lap.
|
||||||
|
# X giu nguyen, Y -> -Y, Z -> -Z:
|
||||||
|
# x = X_dev = R*sin(a), y = -Y_dev = -R*cos(a)
|
||||||
|
# => cos t = sin a, sin t = -cos a => t = a - 90
|
||||||
|
#
|
||||||
|
# ⚠️ KHAC mac dinh cua base_kit (offset 90, flip false). Khong phai base_kit
|
||||||
|
# sai: no chay voi mot tu the gan khac, hoac khong ai kiem huong scan cua no
|
||||||
|
# vi nhanh do khong dung de dung ban do. Dung lay no lam doi chung cho gia
|
||||||
|
# tri nay.
|
||||||
|
#
|
||||||
|
# Kiem nhanh: dat mot vat cach robot ~1 m CHINH DIEN PHIA TRUOC, mo web,
|
||||||
|
# cham phai hien ra phia truoc. Doi hai so nay chi ton mot lan khoi dong
|
||||||
|
# lai, khong phai build lai.
|
||||||
|
angle_offset_deg: -90.0
|
||||||
|
angle_flip: false
|
||||||
|
|
||||||
# --- Ve sinh scan ---
|
# --- Ve sinh scan ---
|
||||||
# ScanSanitizer gop header-fix va sector mask lam MOT ham. Hai bo loc rieng
|
# ScanSanitizer gop header-fix va sector mask lam MOT ham. Hai bo loc rieng
|
||||||
# thi thu tu chay giua chung la mot bay: mask truoc hay sua header truoc cho
|
# thi thu tu chay giua chung la mot bay: mask truoc hay sua header truoc cho
|
||||||
@@ -39,9 +65,6 @@ lidar:
|
|||||||
# chieu: mask thieu -> than robot bi doc thanh vat can, robot dung im;
|
# chieu: mask thieu -> than robot bi doc thanh vat can, robot dung im;
|
||||||
# mask thua -> mot vat can that bi cat mat, khong ai biet.
|
# mask thua -> mot vat can that bi cat mat, khong ai biet.
|
||||||
#
|
#
|
||||||
# Huong 0 do THAT cua LiDAR thi da co dap an (khong con phai do): manual
|
|
||||||
# §8.1 cho X = R*sin(a), Y = R*cos(a), REP-103 dung x = R*cos(t) => t = 90
|
|
||||||
# do - a. Da vao driver_config.h: angle_offset_deg = 90, inverted = true.
|
|
||||||
sector_masks:
|
sector_masks:
|
||||||
- [118.0, 180.0]
|
- [118.0, 180.0]
|
||||||
- [-180.0, -118.0]
|
- [-180.0, -118.0]
|
||||||
@@ -112,6 +135,16 @@ base:
|
|||||||
# dung duong dan tuyet doi -- nhung dung commit mot duong dan /home/<ai do>.
|
# dung duong dan tuyet doi -- nhung dung commit mot duong dan /home/<ai do>.
|
||||||
dcf_path: master.dcf
|
dcf_path: master.dcf
|
||||||
|
|
||||||
# Increment/vong cua encoder, doc qua 0x6064. 0 = hoi thiet bi luc Open()
|
# Count/vong cua encoder, dung de doi 0x6064 (don vi "count") sang radian.
|
||||||
# qua 0x608F:1 thay vi chep tay mot hang so.
|
#
|
||||||
|
# 0 = dung mac dinh 16384, suy tu 0x200E:01 = 4096 "wire" doc duoc tren
|
||||||
|
# thiet bi, nhan 4 theo quy uoc cau phuong.
|
||||||
|
#
|
||||||
|
# ⚠️ He so x4 CHUA KIEM CHUNG -- can_help.pdf khong cho nao noi quan he giua
|
||||||
|
# "wire" va "count". Sai he so nay lam odometry sai dung 4 lan.
|
||||||
|
#
|
||||||
|
# Cach do (2 phut): ke banh len khoi san, doc 0x6064:01, quay banh dung MOT
|
||||||
|
# vong bang tay, doc lai. Hieu so chinh la count/vong that -- dat vao day.
|
||||||
|
# cansend can0 601#40.64.60.01.00.00.00.00
|
||||||
|
# candump can0,581:7FF -n 1
|
||||||
encoder_counts_per_rev: 0
|
encoder_counts_per_rev: 0
|
||||||
|
|||||||
@@ -41,40 +41,36 @@ struct LidarConfig {
|
|||||||
// khoang cach deu gap doi.
|
// khoang cach deu gap doi.
|
||||||
double range_unit_m = 0.001;
|
double range_unit_m = 0.001;
|
||||||
|
|
||||||
// 2 va 3. HUONG 0 DO + CHIEU QUAY (rui ro R5) -- SUY RA duoc, khong phai do.
|
// 2 va 3. HUONG 0 DO + CHIEU QUAY (rui ro R5).
|
||||||
//
|
//
|
||||||
// ⚠️ LIDAR TREN ROBOT NAY GAN UP NGUOC. Hai gia tri duoi da tinh cho tu the
|
// lidar_core tinh: theta = (angle_flip ? -alpha : alpha) + angle_offset_deg
|
||||||
// do. Gan lai xuoi thi phai doi CA HAI, khong phai mot.
|
|
||||||
//
|
//
|
||||||
// Manual §8.1: LakiBeam tra ve X_dev = R*sin(a), Y_dev = R*cos(a)
|
// Manual §8.1: LakiBeam tra ve X = R*sin(a), Y = R*cos(a)
|
||||||
// REP-103: he nay dung x = R*cos(t), y = R*sin(t)
|
// REP-103: he nay dung x = R*cos(t), y = R*sin(t)
|
||||||
//
|
//
|
||||||
// Gan XUOI: x = X_dev, y = Y_dev
|
// Phep doi phu thuoc TU THE GAN, va ba tu the cho ba ket qua khac nhau:
|
||||||
// cos t = sin a, sin t = cos a => t = 90do - a
|
// gan xuoi t = 90 - a offset +90, flip true
|
||||||
// => angle_offset_deg = +90, inverted = true
|
// lat quanh truc X t = a - 90 offset -90, flip false <- CON NAY
|
||||||
|
// lat quanh truc Y t = a + 90 offset +90, flip false
|
||||||
//
|
//
|
||||||
// Gan UP NGUOC = xoay 180do quanh truc X, tuc Y va Z doi dau:
|
// LiDAR tren robot nay QUAY QUANH TRUC X 180 DO, da xac nhan voi nguoi lap.
|
||||||
// x = X_dev, y = -Y_dev
|
// X giu nguyen, Y -> -Y, Z -> -Z:
|
||||||
// cos t = sin a, sin t = -cos a => t = a - 90do
|
// x = X_dev = R*sin(a), y = -Y_dev = -R*cos(a)
|
||||||
// => angle_offset_deg = -90, inverted = FALSE
|
// => cos t = sin a, sin t = -cos a => t = a - 90
|
||||||
//
|
//
|
||||||
// Hai phep dao dau -- cua QUY UOC va cua TU THE GAN -- triet tieu nhau. Do
|
// ⚠️ KHAC mac dinh cua base_kit (offset 90, flip false) -- dung lay no lam
|
||||||
// la ly do `inverted` o day la false DU thiet bi dang bi lat; doc luot qua
|
// doi chung cho gia tri nay.
|
||||||
// rat de tuong nguoc lai.
|
//
|
||||||
|
// ⚠️ "Up nguoc" KHONG du de suy ra phep doi -- lat quanh X va lat quanh Y
|
||||||
|
// cho hai ket qua lech nhau 180 do. Da mac loi o day mot lan: doc comment
|
||||||
|
// cua base_kit (noi flip phai la true), tu gia dinh lat quanh X, va bo qua
|
||||||
|
// GIA TRI ma code cua no thuc su dung. Scan bi xoay, tren web trong nhu
|
||||||
|
// LiDAR quay sai huong.
|
||||||
|
//
|
||||||
|
// Ca hai doc tu sensors.yaml nen doi chi ton mot lan khoi dong lai.
|
||||||
double angle_offset_deg = -90.0;
|
double angle_offset_deg = -90.0;
|
||||||
bool inverted = false;
|
bool inverted = false;
|
||||||
|
|
||||||
// ⚠️⚠️ KHONG bu tu the up nguoc them mot lan nua trong TF.
|
|
||||||
// `laser_link` trong robot.yaml giu rpy = [0, 0, 0] CO Y: driver da tra ve
|
|
||||||
// goc theo quy uoc Z-huong-len roi. Them roll = pi vao TF la bu HAI LAN, va
|
|
||||||
// scan lat guong lai ve dung cho sai -- mot loi khong bao gio crash.
|
|
||||||
// Bu o driver chu khong o TF vi ScanSanitizer va sector_masks doc THANG goc
|
|
||||||
// cua scan, chung khong di qua TF.
|
|
||||||
//
|
|
||||||
// ⚠️ base_kit/lakibeam_driver.hpp de mac dinh `angle_flip = false`, trung
|
|
||||||
// gia tri voi o day nhung VI LY DO KHAC (no gan xuoi, va chinh comment cua
|
|
||||||
// no ket luan phai la true). Dung lay do lam xac nhan cho gia tri nay.
|
|
||||||
|
|
||||||
LidarStampMode stamp_mode = LidarStampMode::kFirstPacket;
|
LidarStampMode stamp_mode = LidarStampMode::kFirstPacket;
|
||||||
// Bu do tre da do duoc, cong vao stamp. Chua do -> 0.
|
// Bu do tre da do duoc, cong vao stamp. Chua do -> 0.
|
||||||
double stamp_offset_sec = 0.0;
|
double stamp_offset_sec = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user