This commit is contained in:
trung09122002
2026-09-19 19:51:36 +07:00
parent ce06dde31e
commit 00ae3a381e
3 changed files with 28 additions and 10 deletions

View File

@@ -119,6 +119,11 @@ CliffResult CliffDetect::Bail(CliffBail why, bool immediate, UnixTime now) {
r.judged = false;
r.bail = why;
r.bail_held = held;
// Mang theo mat phang khop duoc gan nhat: voi offset_large / residual_large
// / slope_clamped thi day chinh la bang chung noi vi sao bail.
r.lvl_z0 = last_lvl_z0_;
r.lvl_slope = last_lvl_slope_;
r.lvl_mad = last_lvl_mad_;
// immediate = true -> mot khung du de bao nguy (hinh hoc vo nghia, robot
// dang nghieng / nhoai len vat)
// immediate = false -> mot khung xau la nhieu nhat thoi; nhung mu LIEN TUC
@@ -345,6 +350,10 @@ CliffResult CliffDetect::Process(const Image& depth, const CameraInfo& info,
res.lvl_z0 = lvl_z0;
res.lvl_slope = lvl_slope;
res.lvl_mad = lvl_mad;
// Luu lai de Bail() con mang theo duoc -- xem ghi chu o khai bao.
last_lvl_z0_ = lvl_z0;
last_lvl_slope_ = lvl_slope;
last_lvl_mad_ = lvl_mad;
if (slope_clamped) return Bail(CliffBail::kSlopeClamped, false, now);
if (std::fabs(lvl_z0) > cfg_.max_level_offset) {