Drop the separate calibration terms, keep one set of offsets
The split existed to stop a footprint change from silently discarding a field correction tuned into the same number. Two knobs per axis is a cost paid on every read of the config, and the person tuning these is the one who knows which part is which, so the simpler shape wins. The derivation stays where it matters: the formula for offset_x - half the robot, the padding, the wing projection, the clearance - is written out in the runtime config next to the value, so recomputing it after a footprint change does not start from a guess.
This commit is contained in:
@@ -273,17 +273,13 @@ Detection VPatternMatcher::match(const std::vector<Line>& lines) const
|
||||
best.measured_wing_length[1] = len2;
|
||||
|
||||
// Pose đích = đỉnh dịch theo offset của profile, trong hệ của CHÍNH hình: x dọc pháp tuyến
|
||||
// hướng ra phía robot, y sang trái. `calib_*` cộng thẳng vào offset — cùng hệ quy chiếu, chỉ
|
||||
// khác nguồn gốc: offset suy ra từ hình học, calib đo được ngoài hiện trường.
|
||||
const double dx = profile_.offset_x + profile_.calib_x;
|
||||
const double dy = profile_.offset_y + profile_.calib_y;
|
||||
const double dyaw = profile_.offset_yaw + profile_.calib_yaw;
|
||||
|
||||
// hướng ra phía robot, y sang trái.
|
||||
const double cos_y = std::cos(yaw);
|
||||
const double sin_y = std::sin(yaw);
|
||||
best.x = apex.x + cos_y * dx - sin_y * dy;
|
||||
best.y = apex.y + sin_y * dx + cos_y * dy;
|
||||
best.yaw = std::atan2(std::sin(yaw + dyaw), std::cos(yaw + dyaw));
|
||||
best.x = apex.x + cos_y * profile_.offset_x - sin_y * profile_.offset_y;
|
||||
best.y = apex.y + sin_y * profile_.offset_x + cos_y * profile_.offset_y;
|
||||
best.yaw = std::atan2(std::sin(yaw + profile_.offset_yaw),
|
||||
std::cos(yaw + profile_.offset_yaw));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user