FrictionBase.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2020 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mvsim/ClassFactory.h>
13 #include <mvsim/CsvLogger.h>
14 #include <mvsim/Wheel.h>
15 #include <mvsim/basic_types.h> // fwrd decls.
16 
17 namespace mvsim
18 {
21 {
22  public:
23  using Ptr = std::shared_ptr<FrictionBase>;
24 
25  FrictionBase(VehicleBase& my_vehicle);
26  virtual ~FrictionBase();
27 
31  VehicleBase& parent, const rapidxml::xml_node<char>* xml_node);
32 
34  {
37  double weight;
38  double motor_torque;
43 
46  TFrictionInput(const TSimulContext& _context, Wheel& _wheel)
47  : context(_context),
48  wheel(_wheel),
49  weight(.0),
50  motor_torque(.0),
51  wheel_speed(0, 0)
52  {
53  }
54  };
55 
58  virtual void evaluate_friction(
60  mrpt::math::TPoint2D& out_result_force_local) const = 0;
61 
62  void setLogger(const std::weak_ptr<CSVLogger>& logger);
63 
64  protected:
67 
68  std::weak_ptr<CSVLogger> m_logger;
69 };
70 
71 typedef std::shared_ptr<FrictionBase> FrictionBasePtr;
72 
73 // Class factory:
74 typedef ClassFactory<
78 
79 #define DECLARES_REGISTER_FRICTION(CLASS_NAME) \
80  DECLARES_REGISTER_CLASS2( \
81  CLASS_NAME, FrictionBase, VehicleBase&, \
82  const rapidxml::xml_node<char>*)
83 
84 #define REGISTER_FRICTION(TEXTUAL_NAME, CLASS_NAME) \
85  REGISTER_CLASS2( \
86  TClassFactory_friction, classFactory_friction, TEXTUAL_NAME, \
87  CLASS_NAME)
88 } // namespace mvsim
std::shared_ptr< FrictionBase > Ptr
Definition: FrictionBase.h:23
GLenum GLenum GLenum input
TFrictionInput(const TSimulContext &_context, Wheel &_wheel)
Definition: FrictionBase.h:46
std::weak_ptr< CSVLogger > m_logger
Definition: FrictionBase.h:68
std::shared_ptr< FrictionBase > FrictionBasePtr
Definition: FrictionBase.h:71
const TSimulContext & context
Definition: FrictionBase.h:35
FrictionBase(VehicleBase &my_vehicle)
virtual void evaluate_friction(const FrictionBase::TFrictionInput &input, mrpt::math::TPoint2D &out_result_force_local) const =0
TClassFactory_friction classFactory_friction
ClassFactory< FrictionBase, VehicleBase &, const rapidxml::xml_node< char > * > TClassFactory_friction
Definition: FrictionBase.h:76
void setLogger(const std::weak_ptr< CSVLogger > &logger)
mrpt::math::TPoint2D wheel_speed
Definition: FrictionBase.h:42
double motor_torque
(Newtons), excluding the weight of the wheel itself.
Definition: FrictionBase.h:39
VehicleBase & m_my_vehicle
Definition: FrictionBase.h:66
static FrictionBase::Ptr factory(VehicleBase &parent, const rapidxml::xml_node< char > *xml_node)


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51