Пример #1
0
 /// Update the state of this tire system at the current time.
 /// The tire system is provided the current state of its associated wheel and
 /// a handle to the terrain system.
 public virtual void Synchronize(double time,                         ///< [in] current time
                                 ChSubsysDefs.WheelState wheel_state, ///< [in] current state of associated wheel body
                                 RigidTerrain terrain                 ///< [in] reference to the terrain system
                                 )
 {
     CalculateKinematics(time, wheel_state, terrain);
 }
Пример #2
0
            public virtual void FixedUpdate()
            {
                m_wheelState = GetWheelState();

                m_wheel.Empty_forces_accumulators();
                m_wheel.Accumulate_force(m_tireforce.force, m_tireforce.point, false);
                m_wheel.Accumulate_torque(m_tireforce.moment, false);
            }
Пример #3
0
            /// Calculate kinematics quantities based on the current state of the associated
            /// wheel body.
            public void CalculateKinematics(double time,                   ///< [in] current time
                                            ChSubsysDefs.WheelState state, ///< [in] current state of associated wheel body
                                            RigidTerrain terrain           ///< [in] reference to the terrain system
                                            )
            {
                // Wheel normal (expressed in global frame)
                ChVector wheel_normal = state.rot.GetYaxis();

                // Terrain normal at wheel location (expressed in global frame)
                ChVector Z_dir = terrain.GetNormal(state.pos.x, state.pos.y);

                // Longitudinal (heading) and lateral directions, in the terrain plane
                ChVector X_dir = ChVector.Vcross(wheel_normal, Z_dir);

                X_dir.Normalize();
                ChVector Y_dir = ChVector.Vcross(Z_dir, X_dir);

                // Tire reference coordinate system
                // ChMatrix33<double> rot = new ChMatrix33<double>(0); // Needs nesting
                rot.Set_A_axis(X_dir, Y_dir, Z_dir);
                ChCoordsys tire_csys = new ChCoordsys(state.pos, rot.Get_A_quaternion());

                // Express wheel linear velocity in tire frame
                ChVector V = tire_csys.TransformDirectionParentToLocal(state.lin_vel);
                // Express wheel normal in tire frame
                ChVector n = tire_csys.TransformDirectionParentToLocal(wheel_normal);

                // Slip angle
                double abs_Vx  = Mathfx.Abs(V.x);
                double zero_Vx = 1e-4;

                m_slip_angle = (abs_Vx > zero_Vx) ? Math.Atan(V.y / abs_Vx) : 0;

                // Longitudinal slip
                m_longitudinal_slip = (abs_Vx > zero_Vx) ? -(V.x - state.omega * GetRadius()) / abs_Vx : 0;

                // Camber angle
                m_camber_angle = Math.Atan2(n.z, n.y);
            }