7 #ifndef __tire_TireContactSystem_h__ 8 #define __tire_TireContactSystem_h__ 26 void initialize(
void) {}
27 virtual void compile(
const t_note_id &a_note_id)
29 rg_all = m_rg_dataset;
30 m_asContact.bind(rg_all->scope());
31 m_asTireLive.bind(rg_all->scope());
33 enforce<AsContact,AsContactLive>(m_rg_dataset);
36 i_rg != rg_all->end(); i_rg++)
40 if(!m_asContact.check(spRA)) {
continue; }
41 if(!m_asTireLive.check(spRA)) {
continue; }
43 for(
unsigned int i_r = 0; i_r < spRA->length(); i_r++)
45 setIdentity(m_asTireLive.patch(spRA->getRecord(i_r)));
46 m_tires.push_back(spRA->getRecord(i_r));
52 if(!rg_all->scope().isValid()) {
return; }
54 for(
unsigned int i_tire = 0; i_tire < m_tires.size(); i_tire++)
56 Record &r_tire = m_tires[i_tire];
58 if(determinant(m_asTireLive.transform(r_tire)) == 0.0)
61 invert(inv_tire_transform, m_asTireLive.transform(r_tire));
63 t_moa_v3 contact_point_tire = transformVector<3,t_moa_real>
64 (inv_tire_transform, m_asContact.contact(r_tire));
67 t_moa_real sign_based_tire_frame = 0.0;
68 if(contact_point_tire[2] > 0.0)
70 sign_based_tire_frame = -magnitude(contact_point_tire);
74 sign_based_tire_frame = magnitude(contact_point_tire);
77 m_asTireLive.contact_radius(r_tire) = sign_based_tire_frame;
81 rotateVector<3, t_moa_real>
82 (inv_tire_transform, m_asContact.normal(r_tire));
84 t_moa_real over_under = dot(ground_N_tire, contact_point_tire);
87 m_asTireLive.contact_radius(r_tire) =
88 magnitude(contact_point_tire);
92 m_asTireLive.contact_radius(r_tire) =
93 -magnitude(contact_point_tire);
104 m_asTireLive.pitch(r_tire) = pi;
108 m_asTireLive.pitch(r_tire) = 0.0;
114 t_moa_real m = result[0];
117 if(m > 1.0) { m = 1.0; }
118 if(m < -1.0) { m = -1.0; }
120 m_asTireLive.inclination(r_tire) = asin(m);
126 if(m > 1.0) { m = 1.0; }
127 if(m < -1.0) { m = -1.0; }
131 m_asTireLive.pitch(r_tire) -= asin(m);
135 m_asTireLive.pitch(r_tire) += asin(m);
144 xform.up() = ground_N_tire;
150 cross3(xform.direction(), xform.left(), xform.up());
151 normalize(xform.direction());
154 cross3(xform.left(), xform.up(), xform.direction());
155 normalize(xform.left());
157 m_asTireLive.patch(r_tire) = xform;
163 AsContactLive m_asContact;
164 std::vector<Record> m_tires;
kernel
Definition: namespace.dox:3
Matrix< 4, 4, T > & invert(Matrix< 4, 4, T > &a_inverted, const Matrix< 4, 4, T > &a_matrix)
4x4 full matrix inversion
Definition: Matrix.h:1033
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
STL style iterator.
Definition: RecordGroup.h:124
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53