Free Electron
StickTire.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __tire_StickTire_h__
8 #define __tire_StickTire_h__
9 
10 #define DUMP(D) dump(#D, D)
11 #define DUMPC(C,D) dump(C, #D, D)
12 
13 namespace fe
14 {
15 namespace ext
16 {
17 
18 /// @brief Simple Stick Tire Model
20  : public AsTireModel, public Initialize<AsStickTireModel>
21 {
22  public:
23  AsConstruct(AsStickTireModel);
24  void initialize(void)
25  {
26  add(stiffness, FE_USE("tire:z:stiffness"));
27  add(damping, FE_USE("tire:z:damping"));
28  add(friction, FE_USE("tire:friction"));
29  add(bias, FE_USE("tire:stick:bias"));
30  add(stick_stiffness, FE_USE("tire:stick:stiffness"));
31  add(slip_stiffness, FE_USE("tire:xy:stiffness"));
32  }
33  Accessor<Real> stiffness;
34  Accessor<Real> damping;
35  Accessor<Real> friction;
36  Accessor<Real> bias;
37  Accessor<Real> stick_stiffness;
38  Accessor<Real> slip_stiffness;
39 };
40 
41 
42 /// @brief Linear Tire Model
43 class StickTire
44  : virtual public TireI, virtual public StreamableI,
45  public CastableAs<StickTire>
46 {
47  public:
48  StickTire(void);
49 virtual ~StickTire(void);
50 
51  /** Integrate a time step. */
52  void step(t_moa_real a_dt);
53 
54  /** Compile internal structure. This should be done
55  before any time stepping. */
56  bool compile(Record r_tire, Record r_config,
57  sp<RecordGroup> a_rg_dataset);
58 
59  /// @name Dynamic State Accessors
60  /// @{
61  void setVelocity( const t_moa_v3 &a_velocity);
62  void setAngularVelocity( const t_moa_v3 &a_ang_velocity);
63  void setContact( const t_moa_real a_radius,
64  const t_moa_real a_inclination);
65  const t_moa_v3 &getForce(void);
66  const t_moa_v3 &getMoment(void);
67  const t_moa_v3 &getVelocity(void);
68  const t_moa_v3 &getAngularVelocity(void);
69  const t_moa_real &getRadius(void) { return m_radius; }
70 
71  t_moa_real &contactRadius(void) { return m_contact_radius; }
72  t_moa_real &inclination(void) { return m_inclination; }
73 
74 virtual void output(std::ostream &a_ostrm)
75  {
76  a_ostrm << m_force[0] << " " << m_force[1] << " " << m_force[2];
77  }
78 virtual void input(std::istream &a_istrm)
79  {
80  a_istrm >> m_force[0] >> m_force[1] >> m_force[2];
81  }
82 
83  private:
84  void initialize(void);
85  // dynamic state
86  t_moa_v3 m_force;
87  t_moa_v3 m_moment;
88  t_moa_v3 m_velocity;
89  t_moa_v3 m_angular_velocity;
90  t_moa_real m_contact_radius;
91  t_moa_real m_inclination;
92 
93  t_moa_real m_Cf;
94  bool m_contact_stick;
95  t_moa_xform m_ctc_stick;
96  WeakRecord m_r_tire;
97  AsTireLive m_asTireLive;
98  AsContactLive m_asContactLive;
99 
100  // geometry
101  t_moa_real m_radius;
102  t_moa_real m_width;
103 
104 
105  t_moa_real m_z_stiffness;
106  t_moa_real m_z_damping;
107  t_moa_real m_stick_bias;
108  t_moa_real m_stick_stiffness;
109  t_moa_real m_slip_stiffness;
110 };
111 
112 } /* namespace ext */
113 } /* namespace fe */
114 
115 #endif /* __tire_StickTire_h__ */
116 
Tire Model.
Definition: tireAS.h:22
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Run Time Single Contact Tire Model.
Definition: tireAS.h:49
The most simple least common denominator, single contact, patch oriented Many (most?) "tire models" are this, or use this.
Definition: TireI.h:17
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Simple Stick Tire Model.
Definition: StickTire.h:19
Linear Tire Model.
Definition: StickTire.h:43
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17