drivers: IMU WT61PC noi thang UART (mcu.protocol: wt61pc), bo ESP32 -- doc quyen cong, tach khung co resync, canh bao khi im

This commit is contained in:
trung09122002
2026-10-02 14:01:19 +07:00
parent a8388102d8
commit be2aa17e3e
13 changed files with 1088 additions and 8 deletions

View File

@@ -206,13 +206,27 @@ StatusResponse LoadAppConfig(const std::string& dir, AppConfig* out) {
{
const StatusResponse r =
Reject(mc, "sensors.yaml mcu",
{"port", "baud", "sync_window", "max_skew_warn",
{"protocol", "port", "baud", "sync_window", "max_skew_warn",
"expected_imu_rate_hz", "ticks_per_rev", "imu_lag_sec",
"expect_timestamps"});
if (!r.ok()) return r;
}
out->sensors.imu_hz = mc.get<double>("expected_imu_rate_hz", 200.0);
// esp = ESP32 + USB-CDC (cach cu). wt61pc = cam bien noi thang UART/USB-FTDI.
// Sai ten thi tu choi, khong doan: chon nham thi IMU im lang.
{
const std::string p = mc.get<std::string>("protocol", "esp");
if (p == "esp") {
out->mcu_driver.protocol = McuProtocol::kEspText;
} else if (p == "wt61pc") {
out->mcu_driver.protocol = McuProtocol::kWt61pc;
} else {
return StatusResponse::Error(
StatusCode::kInvalidArgument,
"sensors.yaml mcu.protocol = \"" + p + "\" khong biet. Chon: esp | wt61pc.");
}
}
out->mcu_driver.port = mc.get<std::string>("port", "/dev/ttyACM0");
out->mcu_driver.baud = static_cast<uint32_t>(mc.get<int>("baud", 115200));
out->mcu_driver.imu_frame_id = kImuFrame;