Flatland
|
#include <layer.h>
Public Member Functions | |
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. More... | |
Layer (b2World *physics_world, CollisionFilterRegistry *cfr, const std::vector< std::string > &names, const Color &color, const Pose &origin, const std::vector< LineSegment > &line_segments, double scale, const YAML::Node &properties) | |
Constructor for the Layer class for initialization using line segments. More... | |
Layer (b2World *physics_world, CollisionFilterRegistry *cfr, const std::vector< std::string > &names, const Color &color, const YAML::Node &properties) | |
Constructor for the Layer class for initialization with no static map in it. More... | |
~Layer () | |
Destructor for the layer class. | |
const std::vector< std::string > & | GetNames () const |
const CollisionFilterRegistry * | GetCfr () const |
Body * | GetBody () |
EntityType | Type () const |
Return the type of entity. More... | |
void | LoadFromBitmap (const cv::Mat &bitmap, double occupied_thresh, double resolution) |
Load the map by extracting edges from images. More... | |
void | DebugVisualize () const override |
Visualize layer for debugging purposes. | |
void | DebugOutput () const override |
log debug messages for the layer | |
Public Member Functions inherited from flatland_server::Entity | |
Entity (b2World *physics_world, const std::string &name) | |
Constructor for the entity. More... | |
const std::string & | GetName () const |
b2World * | GetPhysicsWorld () |
Get Box2D physics world. More... | |
Entity (const Entity &)=delete | |
Entity & | operator= (const Entity &)=delete |
Static Public Member Functions | |
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 y2. More... | |
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. More... | |
Public Attributes | |
std::vector< std::string > | names_ |
list of layer names | |
Body * | body_ = nullptr |
CollisionFilterRegistry * | cfr_ |
collision filter registry | |
std::string | viz_name_ |
for visualization | |
Public Attributes inherited from flatland_server::Entity | |
b2World * | physics_world_ |
Box2D physics world. | |
std::string | name_ |
name of the entity | |
Additional Inherited Members | |
Public Types inherited from flatland_server::Entity | |
enum | EntityType { LAYER, MODEL } |
Defines the type of entity. | |
This class defines a layer in the simulation world which simulates the environment in the world
flatland_server::Layer::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.
[in] | physics_world | Pointer to the box2d physics world |
[in] | cfr | Collision filter registry |
[in] | names | A list of names for the layer, the first name is used for the name of the body |
[in] | color | Color in the form of r, g, b, a, used for visualization |
[in] | origin | Coordinate of the lower left corner of the image, in the form of x, y, theta |
[in] | occupied_thresh | Threshold indicating obstacle if above |
[in] | bitmap | Matrix containing the map image |
[in] | resolution | Resolution of the map image in meters per pixel |
[in] | properties | A YAML node containing properties for plugins to use |
flatland_server::Layer::Layer | ( | b2World * | physics_world, |
CollisionFilterRegistry * | cfr, | ||
const std::vector< std::string > & | names, | ||
const Color & | color, | ||
const Pose & | origin, | ||
const std::vector< LineSegment > & | line_segments, | ||
double | scale, | ||
const YAML::Node & | properties | ||
) |
Constructor for the Layer class for initialization using line segments.
[in] | physics_world | Pointer to the box2d physics world |
[in] | cfr | Collision filter registry |
[in] | names | A list of names for the layer, the first name is used for the name of the body |
[in] | color | Color in the form of r, g, b, a, used for visualization |
[in] | origin | Coordinate of the lower left corner of the image, in the form of x, y, theta |
[in] | line_segments | List of line segments |
[in] | scale | Scale to apply to the line segment end points, works in the same way as resolution |
[in] | properties | A YAML node containing properties for plugins to use |
flatland_server::Layer::Layer | ( | b2World * | physics_world, |
CollisionFilterRegistry * | cfr, | ||
const std::vector< std::string > & | names, | ||
const Color & | color, | ||
const YAML::Node & | properties | ||
) |
Constructor for the Layer class for initialization with no static map in it.
[in] | physics_world | Pointer to the box2d physics world |
[in] | cfr | Collision filter registry |
[in] | names | A list of names for the layer, the first name is used for the name of the body |
[in] | properties | A YAML node containing properties for plugins to use |
const CollisionFilterRegistry * flatland_server::Layer::GetCfr | ( | ) | const |
const std::vector< std::string > & flatland_server::Layer::GetNames | ( | ) | const |
void flatland_server::Layer::LoadFromBitmap | ( | const cv::Mat & | bitmap, |
double | occupied_thresh, | ||
double | resolution | ||
) |
Load the map by extracting edges from images.
[in] | bitmap | OpenCV Image |
[in] | occupied_thresh | Threshold indicating obstacle if above |
[in] | resolution | Resolution of the map image in meters per pixel |
|
static |
Factory method to instantiate a layer, throws exceptions upon failure.
[in] | physics_world | Pointer to the box2d physics world |
[in] | cfr | Collision filter registry |
[in] | map_path | Path to the file containing layer data |
[in] | names | A list of names for the layer, the first name is used for the name of the body. All names are registered in the CFR. Multiple names allow the physics body to be used as if there are multiple layers |
[in] | color | Color of the layer file, this is used to calculate the path to the layermap yaml file |
[in] | properties | A YAML node containing properties for plugins to use |
|
static |
Read line segments from a file, each line of a file represents a line segment in the form of x1 y1 x2 y2.
[in] | file_path | Path to the file |
[out] | line_segments | Line segments obtained from the file |
|
inlinevirtual |