Files
vslam_cpp/libs/vslam_slam/include/vslam/rtabmap_params.h

87 lines
3.2 KiB
C++

#ifndef VSLAM_RTABMAP_PARAMS_H
#define VSLAM_RTABMAP_PARAMS_H
// 26 key cua RTAB-Map tro thanh DU LIEU YAML thay vi <param> rai rac trong
// rtabmap.launch.
//
// ================== VI SAO PHAI KIEM TEN KEY ==================
// Go sai ten mot key RTAB-Map hien tai KHONG bao loi gi -- no bi bo qua im
// lang va he chay bang gia tri mac dinh. `Reg/Force3DoF` go thanh
// `Reg/Force3Dof` nghia la pose thanh 6-DoF ma khong ai biet, cho toi khi
// ban do bat dau nghieng.
//
// `BuildRtabmapParams` doi chieu MOI key voi
// `rtabmap::Parameters::getDefaultParameters()` va tra loi neu co key la.
#include <map>
#include <string>
#include <vector>
#include "vslam/config.h"
#include "vslam/slam_types.h"
#include "vslam/vslam_common.h"
namespace vslam {
// Ghi de theo MOI TRUONG -- khoi `profiles:` cua slam.yaml. Chi chua nhung
// key KHAC nhau giua mo phong va robot that; phan con lai dung chung.
struct SlamProfile {
std::map<std::string, double> numbers; // odom_sigma_m, odom_sigma_rad
std::map<std::string, std::string> rtabmap; // key RTAB-Map
};
struct RtabmapConfig {
// TAT mac dinh: tren may chua build RTAB-Map thi node van phai chay duoc
// day du phan con lai.
bool enabled = false;
SlamMode mode = SlamMode::kMapping;
std::string database_path;
// Bat tui tu thi giac. Keo theo yeu cau co anh -- xem ghi chu trong
// rtabmap.launch: Kp/MaxFeatures dieu khien viec PHAT HIEN, con
// Reg/Strategy=1 (ICP tren LiDAR) van la thu TINH phep bien doi. Nen bat
// thi giac khong danh doi do chinh xac.
bool visual_loop = false;
// Gui depth vao RTAB-Map (luu trong DB) va bat ban do voxel 3D. KHONG doi
// luoi -- xem ghi chu trong BuildRtabmapParams.
bool camera_3d = false;
// Do chac cua odom MOI LIEN KET gui RTAB-Map. Xem slam.yaml.
double odom_sigma_m = 0.01;
double odom_sigma_rad = 0.005;
// Optimizer. "1" = g2o. KHONG dung "2" (GTSAM): apt jammy arm64 khong co
// GTSAM va PPA borglab khong publish arm64.
std::string optimizer_strategy = "1";
// Cac key RTAB-Map doc tu khoi `rtabmap:` cua slam.yaml. Ghi de len mac
// dinh, va bi ghi de boi cac suy dien tu mode/visual_loop o tren.
std::map<std::string, std::string> overrides;
// "sim" va "real" tu khoi `profiles:`. CHUA ap: LoadRtabmapConfig chi doc
// va kiem, ben goi chon mot cai bang ApplySlamProfile() vi chi no biet dang
// chay mo phong hay robot that.
std::map<std::string, SlamProfile> profiles;
};
// Tra ve tap tham so day du. `unknown` nhan ten cac key khong co trong bang
// mac dinh cua RTAB-Map -- nguoi goi PHAI coi do la loi khoi dong, khong
// duoc chi log.
std::map<std::string, std::string> BuildRtabmapParams(
const RtabmapConfig& cfg, std::vector<std::string>* unknown);
// Doc khoi `rtabmap:` + cac key cap cao tu ConfigNode. Nem neu khoi
// `profiles:` sai luat (xem slam.yaml).
RtabmapConfig LoadRtabmapConfig(const ConfigNode& node);
// Ap `profiles.<name>` len cfg: sigma odom va cac key RTAB-Map cua profile.
// Loi neu khong co profile do -- KHONG lang le chay bang mac dinh cua struct.
StatusResponse ApplySlamProfile(const std::string& name, RtabmapConfig* cfg);
// Tra ve true neu RTAB-Map duoc build kem optimizer nay.
bool OptimizerAvailable(const std::string& strategy);
} // namespace vslam
#endif // VSLAM_RTABMAP_PARAMS_H