16 #include <mrpt/img/TColor.h> 44 using Ptr = std::shared_ptr<VehicleBase>;
64 const mrpt::math::TVector2D& force,
93 std::vector<mrpt::math::TPoint2D>& vels,
124 for (
auto& logger :
m_loggers) logger.second->setRecording(record);
128 for (
auto& logger :
m_loggers) logger.second->clear();
132 for (
auto& logger :
m_loggers) logger.second->newSession();
148 std::map<std::string, std::shared_ptr<CSVLogger>>
m_loggers;
169 std::vector<double>& out_force_per_wheel) = 0;
249 #define DECLARES_REGISTER_VEHICLE_DYNAMICS(CLASS_NAME) \ 250 DECLARES_REGISTER_CLASS1(CLASS_NAME, VehicleBase, World*) 252 #define REGISTER_VEHICLE_DYNAMICS(TEXTUAL_NAME, CLASS_NAME) \ 254 TClassFactory_vehicleDynamics, classFactory_vehicleDynamics, \ 255 TEXTUAL_NAME, CLASS_NAME)
void getWheelsVelocityLocal(std::vector< mrpt::math::TPoint2D > &vels, const mrpt::math::TTwist2D &veh_vel_local) const
mrpt::img::TColor m_chassis_color
void internal_internalGuiUpdate_forces(mrpt::opengl::COpenGLScene &scene)
b2Body * getBox2DChassisBody()
mrpt::opengl::CSetOfObjects::Ptr m_gl_chassis
void updateMaxRadiusFromPoly()
excludes the mass of wheels)
static constexpr char PL_DQ_Y[]
static Ptr factory(World *parent, const rapidxml::xml_node< char > *xml_node)
ClassFactory< VehicleBase, World * > TClassFactory_vehicleDynamics
b2Fixture * get_fixture_chassis()
static constexpr char PL_Q_ROLL[]
virtual void simul_post_timestep(const TSimulContext &context) override
virtual void dynamics_load_params_from_xml(const rapidxml::xml_node< char > *xml_node)=0
virtual void initLoggers()
void poses_mutex_lock() override
static constexpr char LOGGER_WHEEL[]
std::vector< double > m_torque_per_wheel
static constexpr char WL_VEL_X[]
std::shared_ptr< FrictionBase > FrictionBasePtr
std::shared_ptr< CSVLogger > getLoggerPtr(std::string logger_name)
static constexpr char PL_Q_X[]
static constexpr char WL_TORQUE[]
virtual void internalGuiUpdate(mrpt::opengl::COpenGLScene &scene, bool childrenOnly) override
const b2Fixture * get_fixture_chassis() const
static constexpr char PL_Q_Z[]
static constexpr char PL_Q_PITCH[]
const TListSensors & getSensors() const
std::vector< mrpt::math::TSegment3D > m_force_segments_for_rendering
const mrpt::math::TPolygon2D & getChassisShape() const
TClassFactory_vehicleDynamics classFactory_vehicleDynamics
static constexpr char PL_Q_YAW[]
static constexpr char PL_DQ_Z[]
size_t getNumWheels() const
A rigid body. These are created via b2World::CreateBody.
VehicleBase(World *parent, size_t nWheels)
Wheel & getWheelInfo(const size_t idx)
void internal_internalGuiUpdate_sensors(mrpt::opengl::COpenGLScene &scene)
virtual void create_multibody_system(b2World &world)
size_t getVehicleIndex() const
std::shared_ptr< VehicleBase > Ptr
mrpt::opengl::CSetOfLines::Ptr m_gl_forces
std::mutex m_force_segments_for_rendering_cs
void poses_mutex_unlock() override
static constexpr char PL_Q_Y[]
static constexpr char WL_FRIC_X[]
virtual ControllerBaseInterface * getControllerInterface()=0
static constexpr char PL_DQ_X[]
virtual float getMaxVehicleRadius() const
static void register_vehicle_class(const rapidxml::xml_node< char > *xml_node)
std::map< std::string, std::shared_ptr< CSVLogger > > m_loggers
void registerOnServer(mvsim::Client &c) override
TListSensors m_sensors
Sensors aboard.
const Wheel & getWheelInfo(const size_t idx) const
virtual void invoke_motor_controllers(const TSimulContext &context, std::vector< double > &out_force_per_wheel)=0
std::vector< Wheel > m_wheels_info
void setRecording(bool record)
std::vector< mrpt::opengl::CSetOfObjects::Ptr > m_gl_wheels
std::vector< SensorBase::Ptr > TListSensors
std::vector< b2Fixture * > & get_fixture_wheels()
virtual void writeLogStrings()
virtual mrpt::poses::CPose3D internalGuiGetVisualPose() override
TListSensors & getSensors()
const std::vector< b2Fixture * > & get_fixture_wheels() const
static constexpr char WL_VEL_Y[]
std::vector< b2Fixture * > m_fixture_wheels
static constexpr char LOGGER_POSE[]
double m_chassis_z_min
each change via updateMaxRadiusFromPoly()
void setVehicleIndex(size_t idx)
static constexpr char WL_WEIGHT[]
mrpt::math::TPoint2D m_chassis_com
mrpt::math::TPolygon2D m_chassis_poly
static constexpr char WL_FRIC_Y[]
b2Fixture * m_fixture_chassis
Created at.
virtual void apply_force(const mrpt::math::TVector2D &force, const mrpt::math::TPoint2D &applyPoint=mrpt::math::TPoint2D(0, 0)) override
virtual double getChassisMass() const
FrictionBasePtr m_friction
mrpt::math::TPoint2D getChassisCenterOfMass() const
In local coordinates (this excludes the mass of wheels)
virtual mrpt::math::TTwist2D getVelocityLocalOdoEstimate() const =0
static constexpr char DL_TIMESTAMP[]
virtual void simul_pre_timestep(const TSimulContext &context) override