From b6bd23829527603cb9cf3fad60c1eced7efd0a26 Mon Sep 17 00:00:00 2001 From: trung09122002 Date: Sat, 19 Sep 2026 18:40:12 +0700 Subject: [PATCH] update --- CMakeLists.txt | 6 +++++- app/src/app_config.cc | 12 +++++++++++- configuration_files/sensors.yaml | 7 +++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2f3fff..4534126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,9 +129,13 @@ endif() # $VSLAM_CONFIG_DIR / $VSLAM_RESOURCE_DIR -- do la cach mot ban cai khong theo # FHS van tim thay config cua no. # --------------------------------------------------------------------------- +# *.dcf di cung *.yaml: lely doc file DCF luc khoi dong, nen mot ban cai +# thieu no se build xong, cai xong, roi chet luc chay voi mot loi tu trong +# ruot lely. Loc theo duoi file la cho rat de bo sot khi them mot loai file +# cau hinh moi. install(DIRECTORY configuration_files/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vslam/configuration_files - FILES_MATCHING PATTERN "*.yaml") + FILES_MATCHING PATTERN "*.yaml" PATTERN "*.dcf") install(DIRECTORY resources/ DESTINATION ${CMAKE_INSTALL_LOCALSTATEDIR}/lib/vslam/resources) diff --git a/app/src/app_config.cc b/app/src/app_config.cc index 3e9e05d..571928d 100644 --- a/app/src/app_config.cc +++ b/app/src/app_config.cc @@ -173,7 +173,17 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) { out->base_driver.can_channel = b.get("can_channel", "can0"); out->base_driver.can_node_id = static_cast(b.get("can_node_id", 1)); - out->base_driver.dcf_path = b.get("dcf_path", ""); + // Duong dan TUONG DOI duoc giai theo thu muc config, giong moi file khac. + // Tuyet doi thi giu nguyen. + // + // Ly do khong de nguoi dung go duong dan tuyet doi: no se la + // /home//... trong mot file duoc commit, tuc chay duoc tren dung + // mot may. Da mac dung loi nay o test/www -- xem git log. + { + const std::string p = b.get("dcf_path", "master.dcf"); + out->base_driver.dcf_path = + (!p.empty() && p.front() == '/') ? p : (dir + "/" + p); + } out->base_driver.encoder_counts_per_rev = static_cast(b.get("encoder_counts_per_rev", 0)); diff --git a/configuration_files/sensors.yaml b/configuration_files/sensors.yaml index 33ddca4..56c13df 100644 --- a/configuration_files/sensors.yaml +++ b/configuration_files/sensors.yaml @@ -106,8 +106,11 @@ base: can_node_id: 1 # File DCF sinh bang `dcfgen` tu master.yml. lely KHONG chay duoc neu thieu. - # Duong dan TUYET DOI, va phai ton tai luc khoi dong. - dcf_path: /opt/vslam/share/vslam/master.dcf + # + # Duong dan TUONG DOI duoc giai theo chinh thu muc config nay, nen no chay + # duoc ca tu cay nguon lan sau khi cai vao /etc/vslam. Muon tro ra ngoai thi + # dung duong dan tuyet doi -- nhung dung commit mot duong dan /home/. + dcf_path: master.dcf # Increment/vong cua encoder, doc qua 0x6064. 0 = hoi thiet bi luc Open() # qua 0x608F:1 thay vi chep tay mot hang so.