optimal & fix file cmake
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <move_base2/ports/action_port.h>
|
||||
#include <move_base2/ports/clock_port.h>
|
||||
#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/planner_port.h>
|
||||
#include <move_base2/ports/pose_port.h>
|
||||
@@ -173,6 +174,7 @@ public:
|
||||
|
||||
++make_plan_count_;
|
||||
saw_order_ = saw_order_ || order != nullptr;
|
||||
order_history_.push_back(order != nullptr);
|
||||
|
||||
in_flight_ = true;
|
||||
pending_tag_ = tag;
|
||||
@@ -276,6 +278,11 @@ public:
|
||||
return saw_order_;
|
||||
}
|
||||
|
||||
const std::vector<bool>& orderHistory() const
|
||||
{
|
||||
return order_history_;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Hết kịch bản thì giữ kết quả cuối; kịch bản rỗng thì luôn thành công.
|
||||
PlannerScript nextAction()
|
||||
@@ -307,6 +314,7 @@ private:
|
||||
std::size_t make_plan_count_ = 0;
|
||||
std::size_t swap_count_ = 0;
|
||||
bool saw_order_ = false;
|
||||
std::vector<bool> order_history_;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -324,10 +332,21 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void setTolerance(double xy_m, double yaw_rad) override
|
||||
bool setDockingMarker(const std::string& marker) override
|
||||
{
|
||||
xy_tolerance_ = xy_m;
|
||||
yaw_tolerance_ = yaw_rad;
|
||||
last_docking_marker_ = marker;
|
||||
return docking_marker_succeeds_;
|
||||
}
|
||||
|
||||
void setDockingMarkerSucceeds(bool succeeds)
|
||||
{
|
||||
docking_marker_succeeds_ = succeeds;
|
||||
}
|
||||
|
||||
/// @brief Marker của lời gọi setDockingMarker gần nhất; rỗng nếu chưa từng gọi.
|
||||
const std::string& lastDockingMarker() const
|
||||
{
|
||||
return last_docking_marker_;
|
||||
}
|
||||
|
||||
bool setPlan(const std::vector<robot_geometry_msgs::PoseStamped>& plan) override
|
||||
@@ -472,16 +491,6 @@ public:
|
||||
return last_plan_size_;
|
||||
}
|
||||
|
||||
double xyTolerance() const
|
||||
{
|
||||
return xy_tolerance_;
|
||||
}
|
||||
|
||||
double yawTolerance() const
|
||||
{
|
||||
return yaw_tolerance_;
|
||||
}
|
||||
|
||||
private:
|
||||
robot_nav_2d_msgs::Path2D local_plan_;
|
||||
robot_geometry_msgs::Twist measured_velocity_;
|
||||
@@ -509,9 +518,9 @@ private:
|
||||
std::string active_;
|
||||
bool swap_succeeds_ = true;
|
||||
bool set_plan_succeeds_ = true;
|
||||
bool docking_marker_succeeds_ = true;
|
||||
std::string last_docking_marker_;
|
||||
double nominal_speed_ = 0.3; ///< [m/s]
|
||||
double xy_tolerance_ = 0.0; ///< [m]
|
||||
double yaw_tolerance_ = 0.0; ///< [rad]
|
||||
|
||||
std::size_t set_plan_count_ = 0;
|
||||
std::size_t compute_count_ = 0;
|
||||
@@ -814,6 +823,37 @@ private:
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @class FakeCostmapStatusPort
|
||||
* @brief Costmap "còn hạn / hết hạn" bật tắt được, cho guard không-đi-mù.
|
||||
*
|
||||
* Mặc định **còn hạn**: một cổng giả im lặng chặn robot sẽ làm mọi test khác fail vì lý do không
|
||||
* liên quan tới thứ chúng đang kiểm.
|
||||
*/
|
||||
class FakeCostmapStatusPort final : public CostmapStatusPort
|
||||
{
|
||||
public:
|
||||
bool isCurrent() const override
|
||||
{
|
||||
++query_count_;
|
||||
return current_;
|
||||
}
|
||||
|
||||
void setCurrent(bool current)
|
||||
{
|
||||
current_ = current;
|
||||
}
|
||||
|
||||
std::size_t queryCount() const
|
||||
{
|
||||
return query_count_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool current_ = true;
|
||||
mutable std::size_t query_count_ = 0;
|
||||
};
|
||||
|
||||
class FakeMissionPort final : public MissionPort
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user