update
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <move_base2/ports/controller_port.h>
|
||||
#include <move_base2/ports/costmap_status_port.h>
|
||||
#include <move_base2/ports/mission_port.h>
|
||||
#include <move_base2/ports/path_check_port.h>
|
||||
#include <move_base2/ports/planner_port.h>
|
||||
#include <move_base2/ports/pose_port.h>
|
||||
#include <move_base2/ports/recovery_port.h>
|
||||
@@ -854,6 +855,59 @@ private:
|
||||
mutable std::size_t query_count_ = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class FakePathCheckPort
|
||||
* @brief Cổng kiểm tuyến giả: kịch bản quyết định tuyến sạch hay bẩn, không cần costmap thật.
|
||||
*
|
||||
* `available_ = false` mô phỏng "không kết luận được" (thiếu TF/costmap) — bên gọi phải coi đó là
|
||||
* không biết, KHÔNG được suy thành sạch hay bẩn.
|
||||
*/
|
||||
class FakePathCheckPort final : public PathCheckPort
|
||||
{
|
||||
public:
|
||||
bool checkPlan(const std::vector<robot_geometry_msgs::PoseStamped>& plan,
|
||||
std::size_t from_index, double horizon, PlanBlockResult& out) const override
|
||||
{
|
||||
(void)from_index;
|
||||
(void)horizon;
|
||||
++query_count_;
|
||||
|
||||
if (!available_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
out = PlanBlockResult();
|
||||
out.blocked = blocked_;
|
||||
out.distance = distance_;
|
||||
out.scanned = plan.size();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @param distance [m] khoảng cách tới vật cản — bên gọi so với `min_detour_distance`.
|
||||
void setBlocked(bool blocked, double distance = 1.5)
|
||||
{
|
||||
blocked_ = blocked;
|
||||
distance_ = distance;
|
||||
}
|
||||
|
||||
void setAvailable(bool available)
|
||||
{
|
||||
available_ = available;
|
||||
}
|
||||
|
||||
std::size_t queryCount() const
|
||||
{
|
||||
return query_count_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool blocked_ = false;
|
||||
bool available_ = true;
|
||||
double distance_ = 1.5; // [m]
|
||||
mutable std::size_t query_count_ = 0;
|
||||
};
|
||||
|
||||
class FakeMissionPort final : public MissionPort
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user