FrictionBase.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under GNU General Public License version 3 |
7  | See <http://www.gnu.org/licenses/> |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mvsim/basic_types.h> // fwrd decls.
13 #include <mvsim/ClassFactory.h>
14 #include <mvsim/Wheel.h>
15 #include <mvsim/CsvLogger.h>
16 
17 namespace mvsim
18 {
21 {
22  public:
23  FrictionBase(VehicleBase& my_vehicle);
24  virtual ~FrictionBase();
25 
28  static FrictionBase* factory(
29  VehicleBase& parent, const rapidxml::xml_node<char>* xml_node);
30 
32  {
35  double weight;
36  double motor_torque;
38  mrpt::math::TPoint2D wheel_speed;
41 
44  TFrictionInput(const TSimulContext& _context, Wheel& _wheel)
45  : context(_context),
46  wheel(_wheel),
47  weight(.0),
48  motor_torque(.0),
49  wheel_speed(0, 0)
50  {
51  }
52  };
53 
56  virtual void evaluate_friction(
57  const FrictionBase::TFrictionInput& input,
58  mrpt::math::TPoint2D& out_result_force_local) const = 0;
59 
60  void setLogger(const std::weak_ptr<CSVLogger>& logger);
61 
62  protected:
65 
66  MRPT_TODO("When each wheel will have its own friction - remove this.")
67  std::weak_ptr<CSVLogger> m_logger;
68 };
69 
70 typedef std::shared_ptr<FrictionBase> FrictionBasePtr;
71 
72 // Class factory:
74  const rapidxml::xml_node<char>*>
77 
78 #define DECLARES_REGISTER_FRICTION(CLASS_NAME) \
79  DECLARES_REGISTER_CLASS2( \
80  CLASS_NAME, FrictionBase, VehicleBase&, \
81  const rapidxml::xml_node<char>*)
82 
83 #define REGISTER_FRICTION(TEXTUAL_NAME, CLASS_NAME) \
84  REGISTER_CLASS2( \
85  TClassFactory_friction, classFactory_friction, TEXTUAL_NAME, \
86  CLASS_NAME)
87 }
TFrictionInput(const TSimulContext &_context, Wheel &_wheel)
Definition: FrictionBase.h:44
std::weak_ptr< CSVLogger > m_logger
Definition: FrictionBase.h:67
std::shared_ptr< FrictionBase > FrictionBasePtr
Definition: FrictionBase.h:70
const TSimulContext & context
Definition: FrictionBase.h:33
FrictionBase(VehicleBase &my_vehicle)
static FrictionBase * factory(VehicleBase &parent, const rapidxml::xml_node< char > *xml_node)
virtual void evaluate_friction(const FrictionBase::TFrictionInput &input, mrpt::math::TPoint2D &out_result_force_local) const =0
TClassFactory_friction classFactory_friction
void setLogger(const std::weak_ptr< CSVLogger > &logger)
mrpt::math::TPoint2D wheel_speed
Definition: FrictionBase.h:40
double motor_torque
(Newtons), excluding the weight of the wheel itself.
Definition: FrictionBase.h:37
VehicleBase & m_my_vehicle
Definition: FrictionBase.h:64


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40