47 #ifndef FLATLAND_SERVER_LAYER_H 48 #define FLATLAND_SERVER_LAYER_H 50 #include <Box2D/Box2D.h> 51 #include <flatland_server/body.h> 52 #include <flatland_server/collision_filter_registry.h> 53 #include <flatland_server/entity.h> 54 #include <flatland_server/types.h> 55 #include <yaml-cpp/yaml.h> 56 #include <opencv2/opencv.hpp> 69 Body *body_ =
nullptr;
89 const std::vector<std::string> &names,
const Color &color,
90 const Pose &origin,
const cv::Mat &bitmap,
double occupied_thresh,
91 double resolution,
const YAML::Node &properties);
109 const std::vector<std::string> &names,
const Color &color,
110 const Pose &origin,
const std::vector<LineSegment> &line_segments,
111 double scale,
const YAML::Node &properties);
123 const std::vector<std::string> &names,
const Color &color,
124 const YAML::Node &properties);
134 const std::vector<std::string> &
GetNames()
const;
155 void LoadFromBitmap(
const cv::Mat &bitmap,
double occupied_thresh,
175 std::vector<LineSegment> &line_segments);
192 const std::string &map_path,
193 const std::vector<std::string> &names,
194 const Color &color,
const YAML::Node &properties);
197 #endif // FLATLAND_SERVER_WORLD_H EntityType
Defines the type of entity.
Definition: entity.h:64
Definition: collision_filter_registry.h:63
const CollisionFilterRegistry * GetCfr() const
Definition: layer.cpp:119
std::string viz_name_
for visualization
Definition: layer.h:71
~Layer()
Destructor for the layer class.
Definition: layer.cpp:115
const std::vector< std::string > & GetNames() const
Definition: layer.cpp:117
std::vector< std::string > names_
list of layer names
Definition: layer.h:67
static Layer * MakeLayer(b2World *physics_world, CollisionFilterRegistry *cfr, const std::string &map_path, const std::vector< std::string > &names, const Color &color, const YAML::Node &properties)
Factory method to instantiate a layer, throws exceptions upon failure.
Definition: layer.cpp:122
static void ReadLineSegmentsFile(const std::string &file_path, std::vector< LineSegment > &line_segments)
Read line segments from a file, each line of a file represents a line segment in the form of x1 y1 x2...
Definition: layer.cpp:182
Layer(b2World *physics_world, CollisionFilterRegistry *cfr, const std::vector< std::string > &names, const Color &color, const Pose &origin, const cv::Mat &bitmap, double occupied_thresh, double resolution, const YAML::Node &properties)
Constructor for the Layer class for initialization using a image map file.
Definition: layer.cpp:65
CollisionFilterRegistry * cfr_
collision filter registry
Definition: layer.h:70
void DebugOutput() const override
log debug messages for the layer
Definition: layer.cpp:326
EntityType Type() const
Return the type of entity.
Definition: layer.h:147
void DebugVisualize() const override
Visualize layer for debugging purposes.
Definition: layer.cpp:309
void LoadFromBitmap(const cv::Mat &bitmap, double occupied_thresh, double resolution)
Load the map by extracting edges from images.
Definition: layer.cpp:214