This commit is contained in:
trung09122002
2026-09-21 10:23:51 +07:00
parent dea92c46d2
commit 641db2e914
6 changed files with 49 additions and 6 deletions

View File

@@ -242,10 +242,23 @@ struct BaseConfig {
std::string dcf_path;
// Encoder resolution cua ZLAC8015D, dem/vong SAU hop so, doc qua 0x6064.
// 0 = doc tu thiet bi luc Open() (0x608F:1 Encoder Increments) thay vi tin
// mot hang so chep tay.
//
// ⚠️ 0 = dung mac dinh 16384 trong zlac_base.cc (4096 wire x 4 cau phuong),
// va con so do CHUA duoc kiem chung. base_kit KHONG giup duoc gi o day: ho
// chi doc van toc (0x606C, don vi rpm) nen khong bao gio can biet count/vong
// -- tham so nay khong ton tai trong motor_params.yaml cua ho.
// Cach do: quay banh tay dung mot vong, so hieu 0x6064:1 truoc/sau.
uint32_t encoder_counts_per_rev = 0;
// Thoi gian ramp gui xuong 0x6083/0x6084 (Profile acceleration/deceleration),
// don vi ms tu 0 den toc do dinh muc. SO CANG LON, RAMP CANG CHAM.
//
// 1200 la gia tri base_kit dung (motor_params.yaml: acc_dec_val). Mac dinh
// cua ZlacMotorDriver::enableHardware() la 500, tuc tang toc NHANH GAP 2.4
// LAN, du de banh truot that tren san tron. base_kit da chinh so nay tren
// chinh con robot nay nen no thang -- day la tham so cua THIET BI.
uint32_t accel_ramp_ms = 1200;
// --- Dung khi protocol = kVendorSerial ---
std::string port = "/dev/ttyUSB0";
uint32_t baud = 115200;

View File

@@ -116,7 +116,7 @@ class ZlacWrapper : public BaseInterface {
"(systemctl status motor_control zlac_ros)"
"\n - dcf_path: " + cfg_.dcf_path);
}
if (!impl_->enableHardware()) {
if (!impl_->enableHardware(cfg_.accel_ramp_ms)) {
impl_.reset();
return StatusResponse::Error(
StatusCode::kUnavailable,
@@ -129,7 +129,8 @@ class ZlacWrapper : public BaseInterface {
VSLAM_INFO("base: ZLAC8015D tren " << cfg_.can_channel << " node "
<< static_cast<int>(cfg_.can_node_id) << ", banh r="
<< cfg_.wheel_radius << " m cach nhau " << cfg_.wheel_separation
<< " m, " << counts_per_rev_ << " count/vong");
<< " m, " << counts_per_rev_ << " count/vong, ramp "
<< cfg_.accel_ramp_ms << " ms");
running_ = true;
poll_thread_ = std::thread([this] { PollLoop(); });

View File

@@ -69,12 +69,19 @@ mot khung ga khac:
| Tham so | base_kit | o day | Vi sao |
|---|---|---|---|
| `angle_offset_deg` / `angle_flip` | 90 / false | 180 / true | phep thu: nguoi dung ben TRAI robot, man hinh phai hien ben TRAI |
| `acc_dec` (0x6083/84) | 1200 | 1200 | DA KEO VE. Mac dinh cua `enableHardware()` la 500 -- nhanh gap 2.4 lan |
| `box_min_y` / `box_max_y` | -0.25 / 0.0 | -0.25 / 0.25 | bon cot o day doi xung (y = +-0.136); hop mot ben bo sot hai cot |
| toan bo `robot.yaml` | -- | -- | vi tri banh / LiDAR / camera do tren robot nay |
Quy tac gon: **do duoc tren robot nay thi PHEP DO thang; khong do duoc thi
`base_kit` thang.**
⚠️ Va co loai thu ba: cai `base_kit` KHONG BIET. `encoder_counts_per_rev` la
mot -- `motor_params.yaml` khong co tham so encoder nao, vi `zlac_ros_node`
chi doc van toc (`0x606C`, don vi rpm da co san) nen khong bao gio phai doi
count sang radian. Chi du an nay doc `0x6064`, nen chi du an nay phai do.
Dung tim cau tra loi o ben do.
Moi lan lech khoi `base_kit` deu co mot phep do dung sau, khong lan nao la so
thich. Truoc khi keo mot gia tri cua ho ve, hoi: gia tri nay noi ve THIET BI
hay ve KHUNG GA?