Virtual base class for all sensors. More...
#include <SensorBase.h>
Public Types | |
using | Ptr = std::shared_ptr< SensorBase > |
![]() | |
using | Ptr = std::shared_ptr< Simulable > |
Public Member Functions | |
virtual void | loadConfigFrom (const rapidxml::xml_node< char > *root) |
void | registerOnServer (mvsim::Client &c) override |
double | sensor_period () const |
SensorBase (Simulable &vehicle) | |
virtual void | simulateOn3DScene ([[maybe_unused]] mrpt::opengl::COpenGLScene &gl_scene) |
Simulable & | vehicle () |
const Simulable & | vehicle () const |
virtual | ~SensorBase () |
![]() | |
const std::optional< Shape2p5 > & | collisionShape () const |
bool | customVisualVisible () const |
void | customVisualVisible (const bool visible) |
virtual void | guiUpdate (const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical) |
World * | parent () |
const World * | parent () const |
void | showCollisionShape (bool show) |
VisualObject (World *parent, bool insertCustomVizIntoViz=true, bool insertCustomVizIntoPhysical=true) | |
virtual | ~VisualObject () |
![]() | |
virtual void | apply_force (const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0)) |
b2Body * | b2d_body () |
const b2Body * | b2d_body () const |
virtual void | freeOpenGLResources () |
mrpt::poses::CPose2D | getCPose2D () const |
Alternative to getPose() More... | |
mrpt::poses::CPose3D | getCPose3D () const |
Alternative to getPose() More... | |
virtual std::optional< float > | getElevationAt ([[maybe_unused]] const mrpt::math::TPoint2D &worldXY) const |
mrpt::math::TVector3D | getLinearAcceleration () const |
const std::string & | getName () const |
mrpt::math::TPose3D | getPose () const |
mrpt::math::TPose3D | getPoseNoLock () const |
No thread-safe version. Used internally only. More... | |
virtual mrpt::math::TPose3D | getRelativePose () const |
World * | getSimulableWorldObject () |
const World * | getSimulableWorldObject () const |
mrpt::math::TTwist2D | getTwist () const |
mrpt::math::TTwist2D | getVelocityLocal () const |
bool | hadCollision () const |
bool | isInCollision () const |
virtual VisualObject * | meAsVisualObject () |
void | resetCollisionFlag () |
void | setName (const std::string &s) |
void | setPose (const mrpt::math::TPose3D &p, bool notifyChange=true) const |
virtual void | setRelativePose (const mrpt::math::TPose3D &p) |
void | setTwist (const mrpt::math::TTwist2D &dq) const |
virtual void | simul_post_timestep (const TSimulContext &context) |
virtual void | simul_pre_timestep (const TSimulContext &context) |
Simulable (World *parent) | |
Static Public Member Functions | |
static SensorBase::Ptr | factory (Simulable &parent, const rapidxml::xml_node< char > *xml_node) |
static std::shared_ptr< mrpt::opengl::CSetOfObjects > | GetAllSensorsFOVViz () |
static std::shared_ptr< mrpt::opengl::CSetOfObjects > | GetAllSensorsOriginViz () |
static void | RegisterSensorFOVViz (const std::shared_ptr< mrpt::opengl::CSetOfObjects > &o) |
static void | RegisterSensorOriginViz (const std::shared_ptr< mrpt::opengl::CSetOfObjects > &o) |
![]() | |
static void | FreeOpenGLResources () |
Protected Member Functions | |
void | make_sure_we_have_a_name (const std::string &prefix) |
Assign a sensible default name/sensor label if none is provided: More... | |
bool | parseSensorPublish (const rapidxml::xml_node< char > *node, const std::map< std::string, std::string > &varValues) |
void | reportNewObservation (const std::shared_ptr< mrpt::obs::CObservation > &obs, const TSimulContext &context) |
void | reportNewObservation_lidar_2d (const std::shared_ptr< mrpt::obs::CObservation2DRangeScan > &obs, const TSimulContext &context) |
bool | should_simulate_sensor (const TSimulContext &context) |
World * | world () |
const World * | world () const |
![]() | |
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) |
virtual void | internalGuiUpdate (const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly=false)=0 |
bool | parseVisual (const JointXMLnode<> &rootNode) |
bool | parseVisual (const rapidxml::xml_node< char > &rootNode) |
Returns true if there is at least one <visual>...</visual> entry. More... | |
void | setCollisionShape (const Shape2p5 &cs) |
Protected Attributes | |
std::string | publishTopic_ |
double | sensor_last_timestamp_ = 0 |
double | sensor_period_ = 0.1 |
std::map< std::string, std::string > | varValues_ |
Filled in by SensorBase::loadConfigFrom() More... | |
Simulable & | vehicle_ |
The vehicle this sensor is attached to. More... | |
![]() | |
std::shared_ptr< mrpt::opengl::CSetOfObjects > | glCollision_ |
std::shared_ptr< mrpt::opengl::CSetOfObjects > | glCustomVisual_ |
int32_t | glCustomVisualId_ = -1 |
const bool | insertCustomVizIntoPhysical_ = true |
const bool | insertCustomVizIntoViz_ = true |
World * | world_ |
![]() | |
std::string | name_ |
Additional Inherited Members | |
![]() | |
static double | GeometryEpsilon = 1e-3 |
Virtual base class for all sensors.
Definition at line 34 of file SensorBase.h.
using mvsim::SensorBase::Ptr = std::shared_ptr<SensorBase> |
Definition at line 37 of file SensorBase.h.
SensorBase::SensorBase | ( | Simulable & | vehicle | ) |
Ctor takes a ref to the vehicle to which the sensor is attached.
Definition at line 84 of file SensorBase.cpp.
|
virtualdefault |
|
static |
Class factory: Creates a sensor from XML description of type "<sensor
class='CLASS_NAME'>...</sensor>".
Definition at line 93 of file SensorBase.cpp.
|
static |
Definition at line 67 of file SensorBase.cpp.
|
static |
Definition at line 61 of file SensorBase.cpp.
|
virtual |
Loads the parameters common to all sensors. Should be overriden, and they call to this base method.
Reimplemented in mvsim::DepthCameraSensor, mvsim::LaserScanner, mvsim::Lidar3D, mvsim::GNSS, mvsim::CameraSensor, and mvsim::IMU.
Definition at line 231 of file SensorBase.cpp.
|
protected |
Assign a sensible default name/sensor label if none is provided:
Definition at line 252 of file SensorBase.cpp.
|
protected |
Definition at line 129 of file SensorBase.cpp.
|
overridevirtual |
Reimplemented from mvsim::Simulable.
Definition at line 220 of file SensorBase.cpp.
|
static |
Definition at line 73 of file SensorBase.cpp.
|
static |
Definition at line 78 of file SensorBase.cpp.
|
protected |
Definition at line 159 of file SensorBase.cpp.
|
protected |
Definition at line 185 of file SensorBase.cpp.
|
inline |
Definition at line 65 of file SensorBase.h.
|
protected |
Should be called within each derived class simul_post_timestep() method to update sensor_last_timestamp_ and check if the sensor should be simulated now, given the current simulation time, and the sensor rate in sensor_period_.
Definition at line 262 of file SensorBase.cpp.
|
inlinevirtual |
Definition at line 53 of file SensorBase.h.
|
inline |
The vehicle this sensor is attached to
Definition at line 68 of file SensorBase.h.
|
inline |
Definition at line 69 of file SensorBase.h.
|
inlineprotected |
Definition at line 84 of file SensorBase.h.
|
inlineprotected |
Definition at line 85 of file SensorBase.h.
|
protected |
Publish to MVSIM ZMQ topic stream, if not empty (default)
Definition at line 94 of file SensorBase.h.
|
protected |
The last sensor reading timestamp. See sensor_period_
Definition at line 91 of file SensorBase.h.
|
protected |
Generate one sensor reading every this period s
Definition at line 88 of file SensorBase.h.
|
protected |
Filled in by SensorBase::loadConfigFrom()
Definition at line 97 of file SensorBase.h.
|
protected |
The vehicle this sensor is attached to.
Definition at line 82 of file SensorBase.h.