feat(costmap_2d): direction zones and map readiness
- DirectionalLayer rewritten as a DirectionFieldProvider. It no longer derives from StaticLayer and never writes the master grid. It takes an OccupancyGrid of direction codes (0 = no constraint, 1..8 = direction_index + 1) on direction_topic, validates it against the master geometry and global frame, and publishes an immutable DirectionField snapshot with a DISABLED / PENDING / READY state and a generation counter. Every static map on map_topic returns the layer to PENDING until a grid for that map arrives. - direction_field.h is the core API for planners: grid validation, bounds-checked codeAt(), a half-open-cell DDA (traverseGridSegment), allowedDirectionMask() and checkSegment(). LayeredCostmap::getDirectionFieldSnapshot() exposes the snapshot without adding data members. - max_deviation_deg (default 90, valid 0 < x < 180). The field carries the value so every planner uses the same rule; 90 keeps the previous masks bit for bit. - StaticLayer ignores an OccupancyGrid addressed to another layer's topic instead of logging two unthrottled errors per push. - StaticLayer and its subclasses report current only after updateCosts has written the newest map (markMapWritten, also used by CriticalLayer). Readiness flags are written under the master mutex; invalid partial updates are rejected with a throttled error. Full history: branch feature/direction-zone.
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <robot_nav_msgs/OccupancyGrid.h>
|
||||
#include <robot_map_msgs/OccupancyGridUpdate.h>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
namespace robot_costmap_2d
|
||||
@@ -76,14 +77,16 @@ protected:
|
||||
virtual unsigned char interpretValue(unsigned char value);
|
||||
virtual void incomingMap(const robot_nav_msgs::OccupancyGrid& new_map);
|
||||
virtual void incomingUpdate(const robot_map_msgs::OccupancyGridUpdate& update);
|
||||
/// Called under the master costmap mutex after a nonempty region has been written.
|
||||
void markMapWritten(int min_i, int min_j, int max_i, int max_j);
|
||||
unsigned char* threshold_;
|
||||
std::string base_frame_id_;
|
||||
std::string global_frame_; ///< @brief The global frame for the costmap
|
||||
std::string map_frame_; /// @brief frame that map is located in
|
||||
std::string map_topic_; // Hiep thêm vào mục đich phân biết zones
|
||||
bool subscribe_to_updates_;
|
||||
bool map_received_;
|
||||
bool has_updated_data_;
|
||||
bool map_received_ = false;
|
||||
bool has_updated_data_ = false;
|
||||
unsigned int x_, y_, width_, height_;
|
||||
bool track_unknown_space_;
|
||||
bool use_maximum_;
|
||||
@@ -91,6 +94,7 @@ protected:
|
||||
bool trinary_costmap_;
|
||||
bool map_shutdown_ = false;
|
||||
bool map_update_shutdown_ = false;
|
||||
std::chrono::steady_clock::time_point last_invalid_update_log_;
|
||||
unsigned char lethal_threshold_, unknown_cost_value_;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user