MVSim
Lightweight simulator for 2.5D vehicles and robots
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mvsim::VerticalPlane Class Reference

#include <VerticalPlane.h>

Inheritance diagram for mvsim::VerticalPlane:
Inheritance graph
[legend]
Collaboration diagram for mvsim::VerticalPlane:
Collaboration graph
[legend]

Classes

struct  Opening
 

Public Member Functions

 VerticalPlane (World *parent, const rapidxml::xml_node< char > *root)
 
virtual void loadConfigFrom (const rapidxml::xml_node< char > *root) override
 
void simul_pre_timestep (const TSimulContext &context) override
 
void simul_post_timestep (const TSimulContext &context) override
 
- Public Member Functions inherited from mvsim::WorldElementBase
 WorldElementBase (World *parent)
 
 WorldElementBase (const WorldElementBase &)=delete
 
 WorldElementBase (WorldElementBase &&)=delete
 
WorldElementBaseoperator= (const WorldElementBase &)=delete
 
WorldElementBaseoperator= (WorldElementBase &&)=delete
 
virtual std::optional< std::any > queryProperty ([[maybe_unused]] const std::string &propertyName, [[maybe_unused]] const mrpt::math::TPoint3D &worldXYZ) const
 
- Public Member Functions inherited from mvsim::VisualObject
 VisualObject (World *parent, bool insertCustomVizIntoViz=true, bool insertCustomVizIntoPhysical=true)
 
 VisualObject (const VisualObject &)=delete
 
VisualObjectoperator= (const VisualObject &)=delete
 
 VisualObject (VisualObject &&)=delete
 
VisualObjectoperator= (VisualObject &&)=delete
 
virtual void guiUpdate (const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical)
 
Worldparent ()
 
const Worldparent () const
 
void customVisualVisible (const bool visible)
 
bool customVisualVisible () const
 
const std::optional< Shape2p5 > & collisionShape () const
 
void showCollisionShape (bool show)
 
- Public Member Functions inherited from mvsim::Simulable
 Simulable (World *parent)
 
virtual void apply_force (const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0))
 
virtual VisualObjectmeAsVisualObject ()
 
mrpt::math::TTwist2D getRefVelocityLocal () const
 
mrpt::math::TTwist2D getVelocityLocal () const
 
mrpt::math::TTwist2D getRefVelocityGlobal () const
 
mrpt::math::TTwist2D getComVelocityGlobal () const
 
mrpt::math::TPose3D getPose () const
 
virtual mrpt::math::TPose3D getRelativePose () const
 
mrpt::math::TPose3D getPoseNoLock () const
 No thread-safe version. Used internally only.
 
mrpt::math::TVector3D getLinearAcceleration () const
 
void setPose (const mrpt::math::TPose3D &p, bool notifyChange=true) const
 
virtual void setRelativePose (const mrpt::math::TPose3D &p)
 
void setRefVelocityLocal (const mrpt::math::TTwist2D &dq)
 
mrpt::poses::CPose2D getCPose2D () const
 Alternative to getPose()
 
mrpt::poses::CPose3D getCPose3D () const
 Alternative to getPose()
 
const std::string & getName () const
 
void setName (const std::string &s)
 
bool isInCollision () const
 
bool hadCollision () const
 
void resetCollisionFlag ()
 
virtual void registerOnServer (mvsim::Client &c)
 
const b2Body * b2d_body () const
 
b2Body * b2d_body ()
 
WorldgetSimulableWorldObject ()
 
const WorldgetSimulableWorldObject () const
 
virtual void freeOpenGLResources ()
 
virtual std::optional< float > getElevationAt ([[maybe_unused]] const mrpt::math::TPoint2D &worldXY) const
 

Protected Member Functions

virtual void internalGuiUpdate (const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly) override
 
void createPhysicsBodies ()
 
void createVisualRepresentation (const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical)
 
void renderWallFace (const mrpt::math::TPoint2Df &p0, const mrpt::math::TPoint2Df &p1, const mrpt::math::TPoint2Df &normal_offset, bool is_front_face, const mrpt::img::CImage *texture=nullptr)
 
void renderWallEdges (const mrpt::math::TPoint2Df &p0, const mrpt::math::TPoint2Df &p1, const mrpt::math::TPoint2Df &w_inner, const mrpt::math::TPoint2Df &w_outer, const mrpt::img::CImage *texture=nullptr)
 
void renderOpeningReveals (const mrpt::math::TPoint2Df &p0, const mrpt::math::TPoint2Df &p1, const mrpt::math::TPoint2Df &dir, const mrpt::math::TPoint2Df &w_inner, const mrpt::math::TPoint2Df &w_outer, float wall_length, const mrpt::img::CImage *texture=nullptr)
 
- Protected Member Functions inherited from mvsim::VisualObject
bool parseVisual (const rapidxml::xml_node< char > &rootNode)
 Returns true if there is at least one <visual>...</visual> entry.
 
bool parseVisual (const JointXMLnode<> &rootNode)
 
void addCustomVisualization (const mrpt::opengl::CRenderizable::Ptr &glModel, const mrpt::poses::CPose3D &modelPose={}, const float modelScale=1.0f, const std::string &modelName="group", const std::optional< std::string > &modelURI=std::nullopt, const bool initialShowBoundingBox=false, const std::optional< double > &scaleOverride=std::nullopt)
 
void setCollisionShape (const Shape2p5 &cs)
 

Protected Attributes

float x0_ = -10
 
float x1_ = -10
 
float y0_ = -10
 
float y1_ = 10
 
mrpt::img::TColor color_ = {0xa0, 0xa0, 0xa0, 0xff}
 
bool enableShadows_ = true
 
float thickness_ = 0.02f
 
std::string textureFileName_
 
double textureSizeX_ = 1.0
 
double textureSizeY_ = 1.0
 
float z_ = .0f
 
float height_ = 3.0f
 
std::string cull_faces_ = "NONE"
 
mrpt::opengl::CTexturedPlane::Ptr gl_plane_
 
mrpt::opengl::CSetOfTexturedTriangles::Ptr gl_plane_text_
 
mrpt::opengl::CSetOfObjects::Ptr glGroup_
 
b2Body * b2dBody_ = nullptr
 
double restitution_ = 0.01
 Default: 0.01.
 
std::vector< b2Fixture * > fixtures_
 
std::vector< Openingopenings_
 
- Protected Attributes inherited from mvsim::VisualObject
Worldworld_
 
std::shared_ptr< mrpt::opengl::CSetOfObjects > glCustomVisual_
 
std::shared_ptr< mrpt::opengl::CSetOfObjects > glCollision_
 
int32_t glCustomVisualId_ = -1
 
const bool insertCustomVizIntoViz_ = true
 
const bool insertCustomVizIntoPhysical_ = true
 
- Protected Attributes inherited from mvsim::Simulable
std::string name_
 

Additional Inherited Members

- Public Types inherited from mvsim::WorldElementBase
using Ptr = std::shared_ptr< WorldElementBase >
 
- Public Types inherited from mvsim::Simulable
using Ptr = std::shared_ptr< Simulable >
 
- Static Public Member Functions inherited from mvsim::WorldElementBase
static Ptr factory (World *parent, const rapidxml::xml_node< char > *xml_node, const char *class_name=nullptr)
 
- Static Public Member Functions inherited from mvsim::VisualObject
static void FreeOpenGLResources ()
 
- Static Public Attributes inherited from mvsim::VisualObject
static double GeometryEpsilon
 

Detailed Description

A vertical plane (or wall with thickness) visible from one or both sides (see "cull_faces"), conveniently defined by starting and end points (x0,y0)-(x1,y1). Supports doors and windows with proper collision handling and rendering.

Member Function Documentation

◆ createPhysicsBodies()

void mvsim::VerticalPlane::createPhysicsBodies ( )
protected

Create Box2D physics bodies for the wall segments

◆ createVisualRepresentation()

void mvsim::VerticalPlane::createVisualRepresentation ( const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &  viz,
const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &  physical 
)
protected

Create visual representation with proper segmentation for openings

◆ renderOpeningReveals()

void mvsim::VerticalPlane::renderOpeningReveals ( const mrpt::math::TPoint2Df &  p0,
const mrpt::math::TPoint2Df &  p1,
const mrpt::math::TPoint2Df &  dir,
const mrpt::math::TPoint2Df &  w_inner,
const mrpt::math::TPoint2Df &  w_outer,
float  wall_length,
const mrpt::img::CImage *  texture = nullptr 
)
protected

Render the reveals (inner edges) around door and window openings

◆ renderWallEdges()

void mvsim::VerticalPlane::renderWallEdges ( const mrpt::math::TPoint2Df &  p0,
const mrpt::math::TPoint2Df &  p1,
const mrpt::math::TPoint2Df &  w_inner,
const mrpt::math::TPoint2Df &  w_outer,
const mrpt::img::CImage *  texture = nullptr 
)
protected

Render top/bottom/side edges of thick wall

◆ renderWallFace()

void mvsim::VerticalPlane::renderWallFace ( const mrpt::math::TPoint2Df &  p0,
const mrpt::math::TPoint2Df &  p1,
const mrpt::math::TPoint2Df &  normal_offset,
bool  is_front_face,
const mrpt::img::CImage *  texture = nullptr 
)
protected

Render a front/back face of the wall

◆ simul_post_timestep()

void mvsim::VerticalPlane::simul_post_timestep ( const TSimulContext context)
overridevirtual

Override to do any required process right after the integration of dynamic equations for each timestep. IMPORTANT: Reimplementations MUST also call this base method, since it is in charge of important tasks (e.g. update q_, dq_)

Reimplemented from mvsim::Simulable.

◆ simul_pre_timestep()

void mvsim::VerticalPlane::simul_pre_timestep ( const TSimulContext context)
overridevirtual

Process right before the integration of dynamic equations for each timestep: set action forces from motors, update friction models, etc.

Reimplemented from mvsim::Simulable.

Member Data Documentation

◆ b2dBody_

b2Body* mvsim::VerticalPlane::b2dBody_ = nullptr
protected

Box2D body for the wall (may be split into multiple fixtures)

◆ fixtures_

std::vector<b2Fixture*> mvsim::VerticalPlane::fixtures_
protected

Multiple fixtures for wall segments (to exclude door openings)

◆ openings_

std::vector<Opening> mvsim::VerticalPlane::openings_
protected

List of openings (doors and windows) in this wall

◆ textureFileName_

std::string mvsim::VerticalPlane::textureFileName_
protected

If defined, it overrides the plain color in color_

◆ thickness_

float mvsim::VerticalPlane::thickness_ = 0.02f
protected

Wall thickness (default: 0.02m - thin wall, can be increased for thick walls)


The documentation for this class was generated from the following file: