1 // ============================================================================= 2 // PROJECT CHRONO - http://projectchrono.org 3 // 4 // Copyright (c) 2014 projectchrono.org 5 // All rights reserved. 6 // 7 // Use of this source code is governed by a BSD-style license that can be found 8 // in the LICENSE file at the top level of the distribution and at 9 // http://projectchrono.org/license-chrono.txt. 10 // 11 // ============================================================================= 12 // Authors: Radu Serban, Aki Mikkola 13 // ============================================================================= 14 // 15 // Template for LuGre tire model 16 // 17 // ============================================================================= 18 19 #ifndef CH_LUGRETIRE_H 20 #define CH_LUGRETIRE_H 21 22 #include <vector> 23 24 #include "chrono/assets/ChCylinderShape.h" 25 #include "chrono/assets/ChTexture.h" 26 #include "chrono/physics/ChBody.h" 27 28 #include "chrono_vehicle/ChTerrain.h" 29 #include "chrono_vehicle/wheeled_vehicle/ChTire.h" 30 31 namespace chrono { 32 namespace vehicle { 33 34 /// @addtogroup vehicle_wheeled_tire 35 /// @{ 36 37 /// Tire model based on LuGre friction model. 38 class CH_VEHICLE_API ChLugreTire : public ChTire { 39 public: 40 ChLugreTire(const std::string& name); 41 ~ChLugreTire()42 virtual ~ChLugreTire() {} 43 44 /// Get the name of the vehicle subsystem template. GetTemplateName()45 virtual std::string GetTemplateName() const override { return "LugreTire"; } 46 47 /// Add visualization assets for the rigid tire subsystem. 48 virtual void AddVisualizationAssets(VisualizationType vis) override; 49 50 /// Remove visualization assets for the rigid tire subsystem. 51 virtual void RemoveVisualizationAssets() override; 52 53 /// Get the tire width. 54 /// This is just an approximation of a tire width. 55 double GetWidth() const; 56 57 /// Report the tire force and moment. ReportTireForce(ChTerrain * terrain)58 virtual TerrainForce ReportTireForce(ChTerrain* terrain) const override { return m_tireForce; } 59 60 protected: 61 /// Return the number of discs used to model this tire. 62 virtual int GetNumDiscs() const = 0; 63 64 /// Return the lateral disc locations. 65 /// These locations are relative to the tire center. 66 virtual const double* GetDiscLocations() const = 0; 67 68 /// Return the vertical tire stiffness (for normal force calculation). 69 virtual double GetNormalStiffness() const = 0; 70 /// Return the vertical tire damping coefficient (for normal force calculation). 71 virtual double GetNormalDamping() const = 0; 72 73 /// Set the parameters in the LuGre friction model. 74 virtual void SetLugreParams() = 0; 75 76 /// Lugre friction model parameters (longitudinal/lateral) 77 double m_sigma0[2]; ///< 78 double m_sigma1[2]; ///< 79 double m_sigma2[2]; ///< 80 double m_Fc[2]; ///< 81 double m_Fs[2]; ///< 82 double m_vs[2]; ///< Stribeck velocity 83 84 //private: 85 /// Get the tire force and moment. 86 /// This represents the output from this tire system that is passed to the 87 /// vehicle system. Typically, the vehicle subsystem will pass the tire force 88 /// to the appropriate suspension subsystem which applies it as an external 89 /// force one the wheel body. GetTireForce()90 virtual TerrainForce GetTireForce() const override { return m_tireForce; } 91 92 /// Initialize this tire by associating it to the specified wheel. 93 virtual void Initialize(std::shared_ptr<ChWheel> wheel) override; 94 95 /// Update the state of this tire system at the current time. 96 virtual void Synchronize(double time, ///< [in] current time 97 const ChTerrain& terrain ///< [in] reference to the terrain system 98 ) override; 99 100 /// Advance the state of this tire by the specified time step. 101 virtual void Advance(double step) override; 102 103 struct DiscContactData { 104 bool in_contact; // true if disc in contact with terrain 105 ChCoordsys<> frame; // contact frame (x: long, y: lat, z: normal) 106 ChVector<> vel; // relative velocity expressed in contact frame 107 double normal_force; // magnitude of normal contact force 108 double ode_coef_a[2]; // ODE coefficients: z' = a + b * z 109 double ode_coef_b[2]; // (longitudinal/lateral) 110 }; 111 112 struct DiscState { 113 double z0; // longitudinal direction 114 double z1; // lateral direction 115 }; 116 117 TerrainForce m_tireForce; 118 std::vector<DiscContactData> m_data; 119 std::vector<DiscState> m_state; 120 121 std::vector<std::shared_ptr<ChCylinderShape>> m_cyl_shapes; ///< visualization cylinder assets 122 std::shared_ptr<ChTexture> m_texture; ///< visualization texture asset 123 }; 124 125 /// @} vehicle_wheeled_tire 126 127 } // end namespace vehicle 128 } // end namespace chrono 129 130 #endif 131