|
MVSim
Lightweight simulator for 2.5D vehicles and robots
|
#include <Simulable.h>

Public Types | |
| using | Ptr = std::shared_ptr< Simulable > |
Public Member Functions | |
| Simulable (World *parent) | |
| virtual void | simul_pre_timestep (const TSimulContext &context) |
| virtual void | simul_post_timestep (const TSimulContext &context) |
| virtual void | apply_force (const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0)) |
| virtual VisualObject * | meAsVisualObject () |
| 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 () |
| World * | getSimulableWorldObject () |
| const World * | getSimulableWorldObject () const |
| virtual void | freeOpenGLResources () |
| virtual std::optional< float > | getElevationAt ([[maybe_unused]] const mrpt::math::TPoint2D &worldXY) const |
Protected Attributes | |
| std::string | name_ |
The basic virtual base class for all objects that can run in the simulated mvsim::World
|
virtual |
Override to register external forces exerted by other WorldElements. Force is (fx,fy) in global coordinates. Application point is (local_ptx,local_pty) in the body local frame
Reimplemented in mvsim::VehicleBase, mvsim::HumanActor, and mvsim::Block.
| mrpt::math::TTwist2D mvsim::Simulable::getComVelocityGlobal | ( | ) | const |
Last time-step velocity of the Box2D center of mass point, in global coords
|
inlinevirtual |
If the given world-frame 2D coordinates are within the limits of this entity, this method returns the ground height or elevation or "z" coordinate of the object for the queried (x,y). If the coordinates do not affect this object, it will return nullopt.
| mrpt::math::TVector3D mvsim::Simulable::getLinearAcceleration | ( | ) | const |
Last time-step acceleration of the ref. point (global coords). Note this is the "coordinate acceleration" vector, not the proper acceleration. It is simply estimated as a finite difference of dq_.
|
inline |
User-supplied name of the vehicle (e.g. "r1", "veh1")
| mrpt::math::TPose3D mvsim::Simulable::getPose | ( | ) | const |
Last time-step pose (of the ref. point, in global coords) (ground-truth)
| mrpt::math::TTwist2D mvsim::Simulable::getRefVelocityGlobal | ( | ) | const |
Last time-step velocity (of the reference point, in global coords) Note this is converted from Box2D center of mass velocity into our own reference point.
| mrpt::math::TTwist2D mvsim::Simulable::getRefVelocityLocal | ( | ) | const |
Last time-step velocity (of the reference point, in local coords) Note this is converted from Box2D center of mass velocity into our own reference point.
|
inlinevirtual |
Like getPose(), but gets the relative pose with respect to the parent object, or just exactly like getPose() (global pose) if this is a top-level entity.
Reimplemented in mvsim::Lidar3D, mvsim::LaserScanner, mvsim::IMU, mvsim::GNSS, mvsim::DepthCameraSensor, and mvsim::CameraSensor.
|
inline |
Deprecated: replace with getRefVelocityLocal()
| bool mvsim::Simulable::hadCollision | ( | ) | const |
Whether a collision occurred since the last time this flag was manually reset.
| bool mvsim::Simulable::isInCollision | ( | ) | const |
Whether is is in collision right now.
| void mvsim::Simulable::resetCollisionFlag | ( | ) |
Resets the condition reported by hadCollision() to false
|
inline |
Changes object name (e.g. "r1", "veh1")
| void mvsim::Simulable::setPose | ( | const mrpt::math::TPose3D & | p, |
| bool | notifyChange = true |
||
| ) | const |
Manually override vehicle pose (Use with caution!) (purposely set a "const")
| void mvsim::Simulable::setRefVelocityLocal | ( | const mrpt::math::TTwist2D & | dq | ) |
Set the body twist in the local, body frame. The linear velocity corresponds to the object local origin. It is then internally converted into the velocity of the Box2D center of mass, in global coordinates as expected by Box2D.
|
inlinevirtual |
Changes the relative pose of this object with respect to its parent, or the global frame if its a top-level entity.
Reimplemented in mvsim::Lidar3D, mvsim::LaserScanner, mvsim::IMU, mvsim::GNSS, mvsim::DepthCameraSensor, and mvsim::CameraSensor.
|
virtual |
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 in mvsim::VerticalPlane, mvsim::HorizontalPlane, mvsim::ElevationMap, mvsim::VehicleBase, mvsim::Lidar3D, mvsim::LaserScanner, mvsim::IMU, mvsim::GNSS, mvsim::DepthCameraSensor, mvsim::CameraSensor, mvsim::HumanActor, mvsim::DummyInvisibleBlock, mvsim::Block, and mvsim::PropertyRegion.
|
virtual |
Process right before the integration of dynamic equations for each timestep: set action forces from motors, update friction models, etc.
Reimplemented in mvsim::VerticalPlane, mvsim::PointCloud, mvsim::OccupancyGridMap, mvsim::HorizontalPlane, mvsim::ElevationMap, mvsim::VehicleBase, mvsim::Lidar3D, mvsim::LaserScanner, mvsim::IMU, mvsim::GNSS, mvsim::DepthCameraSensor, mvsim::CameraSensor, mvsim::HumanActor, mvsim::DummyInvisibleBlock, mvsim::Block, and mvsim::PropertyRegion.
|
protected |
User-supplied name of the vehicle (e.g. "r1", "veh1")