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 13 // ============================================================================= 14 // 15 // Base class for a track shoe. 16 // 17 // The reference frame for a vehicle follows the ISO standard: Z-axis up, X-axis 18 // pointing forward, and Y-axis towards the left of the vehicle. 19 // 20 // ============================================================================= 21 22 #ifndef CH_TRACK_SHOE_H 23 #define CH_TRACK_SHOE_H 24 25 #include "chrono/physics/ChSystem.h" 26 #include "chrono/physics/ChBody.h" 27 #include "chrono/physics/ChBodyAuxRef.h" 28 29 #include "chrono_vehicle/ChApiVehicle.h" 30 #include "chrono_vehicle/ChPart.h" 31 #include "chrono_vehicle/ChChassis.h" 32 33 namespace chrono { 34 namespace vehicle { 35 36 class ChTrackAssembly; 37 38 /// @addtogroup vehicle_tracked_shoe 39 /// @{ 40 41 /// Base class for a track shoe. 42 class CH_VEHICLE_API ChTrackShoe : public ChPart { 43 public: 44 ChTrackShoe(const std::string& name ///< [in] name of the subsystem 45 ); 46 47 virtual ~ChTrackShoe(); 48 49 /// Return the type of track shoe (guiding pin). 50 /// A derived class must specify the type of track shoe (which must be 51 /// consistent with the idler and road wheels in the containing track assembly. 52 virtual GuidePinType GetType() const = 0; 53 54 /// Get the index of this track shoe within its containing track assembly. GetIndex()55 size_t GetIndex() const { return m_index; } 56 57 /// Get a handle to the shoe body. GetShoeBody()58 std::shared_ptr<ChBody> GetShoeBody() const { return m_shoe; } 59 60 /// Return the height of the track shoe. 61 virtual double GetHeight() const = 0; 62 63 /// Return the pitch length of the track shoe. 64 /// This quantity must agree with the pitch of the sprocket gear. 65 virtual double GetPitch() const = 0; 66 67 /// Get the mass of the track shoe assembly. 68 virtual double GetMass() const = 0; 69 70 /// Return the location for lateral contact with the sprocket, expressed in the shoe reference frame. 71 /// This point, which must be in the median plane of the track shoe, is used to enforce lateral contact with the 72 /// sprocket as a detracking prevention mechanism. For track shoes with a central guiding pin, this can be the 73 /// center of the guiding pin collision shape. 74 virtual ChVector<> GetLateralContactPoint() const = 0; 75 76 /// Turn on/off collision flag for the shoe body. SetCollide(bool val)77 void SetCollide(bool val) { m_shoe->SetCollide(val); } 78 79 /// Initialize this track shoe subsystem. 80 /// The track shoe is created within the specified system and initialized 81 /// at the specified location and orientation (expressed in the global frame). 82 /// All actual work is deferred to derived classes (subsystem templates) which 83 /// must create the bodies, joints, etc. In addition, a derived class must set 84 /// the track shoe body's identifier to BodyID::SHOES. 85 virtual void Initialize(std::shared_ptr<ChBodyAuxRef> chassis, ///< [in] handle to the chassis body 86 const ChVector<>& location, ///< [in] location relative to the chassis frame 87 const ChQuaternion<>& rotation ///< [in] orientation relative to the chassis frame 88 ) = 0; 89 90 protected: 91 /// Set the index of this track shoe within its containing track assembly. SetIndex(size_t index)92 void SetIndex(size_t index) { m_index = index; } 93 94 /// Connect this track shoe to the specified neighbor. 95 /// This function must be called only after all track shoes have been initialized. 96 virtual void Connect(std::shared_ptr<ChTrackShoe> next, ///< [in] handle to the neighbor track shoe 97 ChTrackAssembly* assembly, ///< [in] containing track assembly 98 ChChassis* chassis, ///< [in] associated chassis 99 bool ccw ///< [in] track assembled in counter clockwise direction 100 ) = 0; 101 102 size_t m_index; ///< index of this track shoe within its containing track assembly 103 std::shared_ptr<ChBody> m_shoe; ///< handle to the shoe body 104 105 friend class ChTrackAssembly; 106 }; 107 108 /// Vector of handles to track shoe subsystems. 109 typedef std::vector<std::shared_ptr<ChTrackShoe> > ChTrackShoeList; 110 111 /// @} vehicle_tracked_shoe 112 113 } // end namespace vehicle 114 } // end namespace chrono 115 116 #endif 117