Free Electron
BrushTire.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_BrushTire_h__
8 #define __tire_BrushTire_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /// @brief Real Time Brush Tire
17  : public AsTire, public Initialize<AsBrushTire>
18 {
19  public:
20  AsConstruct(AsBrushTire);
21  void initialize(void)
22  {
23  }
24 };
25 
26 
27 /// @brief Brush Tire Model
29  : public AccessorSet, public Initialize<AsBrushTireModel>
30 {
31  public:
32  AsConstruct(AsBrushTireModel);
33  void initialize(void)
34  {
35  add(stiffness, FE_USE("tire:z:stiffness"));
36  add(damping, FE_USE("tire:z:damping"));
37  add(camberStiffness, FE_USE("brush:camber_stiffness"));
38  add(brakingStiffness, FE_USE("brush:braking_stiffness"));
39  add(corneringStiffness, FE_USE("brush:cornering_stiffness"));
40  add(selfAligningStiffness,
41  FE_USE("brush:self_aligning_stiffness"));
42  add(latInitialLoadStiffnessScale,
43  FE_USE("brush:lat_init_load_stiff_scale"));
44  add(longInitialLoadStiffnessScale,
45  FE_USE("brush:long_init_load_stiff_scale"));
46  add(designLoad, FE_USE("brush:design_load"));
47  add(slipSpeedFade, FE_USE("brush:slip_speed_fade"));
48  add(sensSlope, FE_USE("brush:load_sensitivy_slope"));
49  add(finalSens, FE_USE("brush:load_sensitivy_final"));
50  add(finalLoad, FE_USE("brush:load_sensitivy_final_load"));
51  add(tireHalfGripSpeed, FE_USE("brush:half_grip_speed"));
52  add(latGrip, FE_USE("brush:lat_grip"));
53  add(longGrip, FE_USE("brush:long_grip"));
54  add(slideGrip, FE_USE("brush:slide_grip"));
55 
56  }
57  Accessor<Real> stiffness;
58  Accessor<Real> damping;
59  Accessor<Real> camberStiffness;
60  Accessor<Real> brakingStiffness;
61  Accessor<Real> corneringStiffness;
62  Accessor<Real> selfAligningStiffness;
63  Accessor<Real> latInitialLoadStiffnessScale;
64  Accessor<Real> longInitialLoadStiffnessScale;
65  Accessor<Real> designLoad;
66  Accessor< t_moa_v2 > slipSpeedFade;
67  Accessor<Real> sensSlope;
68  Accessor<Real> finalSens;
69  Accessor<Real> finalLoad;
70  Accessor<Real> tireHalfGripSpeed;
71  Accessor<Real> latGrip;
72  Accessor<Real> longGrip;
73  Accessor<Real> slideGrip;
74 };
75 
76 
77 class TireLoadSens
78 {
79  t_moa_real mA, mB, mC, mD;
80  t_moa_real mMaxLoad; // Maximum load for which this is curve is valid
81 
82  public:
83  void Init( t_moa_real zeroSlope, t_moa_real finalSens,
84  t_moa_real finalLoad );
85 
86  t_moa_real Sensitivity( const t_moa_real tireLoad ) const
87  {
88  const t_moa_real x = (tireLoad > mMaxLoad) ? mMaxLoad : tireLoad;
89  return (mD + (x * (mC + (x * (mB + (x * mA))))));
90  }
91 };
92 
93 /// @brief Brush Tire Model
94 class BrushTire
95  : virtual public TireI,
96  public CastableAs<BrushTire>
97 {
98  public:
99  BrushTire(void);
100 virtual ~BrushTire(void);
101 
102  /** Integrate a time step. */
103  void step(t_moa_real a_dt);
104 
105  /** Compile internal structure. This should be done
106  before any time stepping. */
107  bool compile(Record r_tire, Record r_config,
108  sp<RecordGroup> a_rg_dataset);
109 
110  /// @name Dynamic State Accessors
111  /// @{
112  void setVelocity( const t_moa_v3 &a_velocity);
113  void setAngularVelocity( const t_moa_v3 &a_ang_velocity);
114  void setContact( const t_moa_real a_radius,
115  const t_moa_real a_inclination);
116 
117  void setExternalFactor( const t_moa_real a_factor);
118  void setFrame( const t_moa_v3 &a_pos,
119  const t_moa_v3 &a_x,
120  const t_moa_v3 &a_y,
121  const t_moa_v3 &a_z);
122  const t_moa_v3 &getForce(void);
123  const t_moa_v3 &getMoment(void);
124  const t_moa_v3 &getVelocity(void);
125  const t_moa_v3 &getAngularVelocity(void);
126  const t_moa_real &getRadius(void) { return m_radius; }
127 
128  t_moa_real &contactRadius(void) { return m_contact_radius; }
129  t_moa_real &inclination(void) { return m_inclination; }
130  /// @}
131 
132 
133  /// @name Set Initial Parameters and Properties
134  /// @{
135  void setGeometry( t_moa_real a_radius,
136  t_moa_real a_width);
137  void setFrictionCoefficient(
138  const t_moa_v2 &a_friction_coefficient);
139  void setMode(unsigned int a_mode) { m_mode = a_mode; }
140  /// @}
141 
142 
143  private:
144  void printf(FILE *fp);
145  Record m_r_parent;
146  void initialize(void);
147  unsigned int m_mode;
148  struct t_contact
149  {
150  struct t_velocities
151  {
152  t_moa_real fHubVelocity;
153  t_moa_real fSinSlipAngle;
154  t_moa_real fCosSlipAngle;
155 
156  t_moa_v2 vHubVelocity_cf;
157  t_moa_v2 vTreadSlippage_cf;
158  };
159 
160  t_velocities Velocities;
161  t_moa_real fSinCamber;
162  };
163 
164  struct t_internal
165  {
166  t_moa_real fMyx;
167  t_moa_real fMyy;
168  t_moa_real fMySlide;
169 
170  //Carcass stiffness
171  t_moa_real fCx; //Braking stiffness
172  t_moa_real fCy; //Cornering stiffness;
173  t_moa_real fCz; //Self Alignment stiffness
174 
175  t_moa_real fCCamberRelative; //Relative camber stiffness
176 
177  t_moa_real fMaxSlideSpeedFade;
178  t_moa_real fMaxSlideSpeed;
179 
180  t_moa_real fLateralViscoGrip;
181  t_moa_real fLateralViscoSlope;
182  };
183 
184  t_internal m_internal;
185  t_contact m_Contact;
186 
187  // dynamic state
188  t_moa_v3 m_force;
189  t_moa_v3 m_moment;
190  t_moa_v3 m_velocity;
191  t_moa_v3 m_angular_velocity;
192  t_moa_real m_contact_radius;
193  t_moa_real m_inclination;
194 
195  // force space spring
196  t_moa_v3 m_force_filtered;
197  t_moa_v3 m_force_v;
198  t_moa_real m_stiffness_filter;
199  t_moa_real m_damping_filter;
200 
201  // geometry
202  t_moa_real m_radius;
203  t_moa_real m_width;
204 
205  // parameters
206  t_moa_real m_deflectionStiffness;
207  t_moa_real m_deflectionDamping;
208  t_moa_real m_brakingStiffness;
209  t_moa_real m_corneringStiffness;
210  t_moa_real m_selfAligningStiffness;
211  t_moa_real m_latInitialLoadStiffnessScale;
212  t_moa_real m_longInitialLoadStiffnessScale;
213  t_moa_real m_designLoad;
214  t_moa_v2 m_slipSpeedFade;
215  t_moa_real m_sensSlope;
216  t_moa_real m_finalSens;
217  t_moa_real m_finalLoad;
218  t_moa_real m_tireHalfGripSpeed;
219  t_moa_real m_latGrip;
220  t_moa_real m_longGrip;
221  t_moa_real m_slideGrip;
222 
223  t_moa_real m_externalFactor;
224 
225  TireLoadSens m_loadSensitivity;
226 
227  t_moa_xform m_frame;
228 
229 #ifdef FE_ENABLE_CHANNEL_LOGGING
230  t_moa_real m_et;
232 #endif
233 
234  private:
235  void GetForce( const t_contact& rContact,
236  const t_moa_real fNormalForce,
237  const t_moa_real fGroundSpeed,
238  t_moa_v3* pvForce_cf,
239  t_moa_real* pfPneumaticTrail,
240  t_moa_real* pfAdhesiveWeight);
241  void GetHighSpeedForce( const t_contact& rContact,
242  const t_moa_real fNormalForce,
243  t_moa_v3* pvForce_cf,
244  t_moa_real* pfPneumaticTrail,
245  t_moa_real* pfAdhesiveWeight);
246  void GetLowSpeedForce( const t_contact& rContact,
247  const t_moa_real fNormalForce,
248  t_moa_v3* pvForce_cf,
249  t_moa_real* pfAdhesiveWeight) const;
250 
251  t_moa_real GetTreadSlideGripFactor( const t_contact& rContact,
252  t_moa_real fLambda) const;
253 };
254 
255 /// @brief Brush Tire Model System
256 class FE_DL_EXPORT BrushTireSystem :
257  virtual public Stepper,
258  public Initialize<BrushTireSystem>
259 {
260  public:
261  BrushTireSystem(void);
262 virtual ~BrushTireSystem(void);
263  void initialize(void);
264 
265 virtual void compile(const t_note_id &a_note_id);
266 virtual void step(t_moa_real a_dt);
267  void step(t_moa_real a_dt, unsigned int i_tire);
268  //void step(t_moa_real a_dt, sp<BrushTire> spTire);
269  private:
270  sp<RecordGroup> rg_dataset;
271  sp<Scope> m_spScope;
272  //std::vector< sp<BrushTire> > m_tires;
273  std::vector< Record > m_r_tires;
274  AsTireLive m_asTireLive;
275 };
276 
277 } /* namespace ext */
278 } /* namespace fe */
279 
280 #endif /* __tire_BrushTire_h__ */
281 
Set of accessors.
Definition: AccessorSet.h:18
Tire.
Definition: tireAS.h:36
kernel
Definition: namespace.dox:3
Real Time Brush Tire.
Definition: BrushTire.h:16
Time Stepping System.
Definition: Stepper.h:15
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
Brush Tire Model System.
Definition: BrushTire.h:256
Brush Tire Model.
Definition: BrushTire.h:94
Brush Tire Model.
Definition: BrushTire.h:28
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192