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 // Tracked vehicle continuous-band sprocket model constructed with data from file
16 // (JSON format).
17 //
18 // =============================================================================
19 
20 #ifndef SPROCKET_BAND_H
21 #define SPROCKET_BAND_H
22 
23 #include "chrono_vehicle/ChApiVehicle.h"
24 #include "chrono_vehicle/tracked_vehicle/sprocket/ChSprocketBand.h"
25 
26 #include "chrono_thirdparty/rapidjson/document.h"
27 
28 namespace chrono {
29 namespace vehicle {
30 
31 /// @addtogroup vehicle_tracked_sprocket
32 /// @{
33 
34 /// Tracked vehicle continuous-band sprocket model constructed with data from file (JSON format).
35 class CH_VEHICLE_API SprocketBand : public ChSprocketBand {
36   public:
37     SprocketBand(const std::string& filename);
38     SprocketBand(const rapidjson::Document& d);
~SprocketBand()39     ~SprocketBand() {}
40 
41     /// Get the number of teeth of the gear.
GetNumTeeth()42     virtual int GetNumTeeth() const override { return m_num_teeth; }
43 
44     /// Get the radius of the gear.
45     /// This quantity is used during the automatic track assembly.
GetAssemblyRadius()46     virtual double GetAssemblyRadius() const override { return m_gear_RA; }
47 
48     /// Return the mass of the gear body.
GetGearMass()49     virtual double GetGearMass() const override { return m_gear_mass; }
50     /// Return the moments of inertia of the gear body.
GetGearInertia()51     virtual const ChVector<>& GetGearInertia() override { return m_gear_inertia; }
52     /// Return the inertia of the axle shaft.
GetAxleInertia()53     virtual double GetAxleInertia() const override { return m_axle_inertia; }
54     /// Return the distance between the two gear profiles.
GetSeparation()55     virtual double GetSeparation() const override { return m_separation; }
56 
57     /// Return the radius of the addendum circle.
GetOuterRadius()58     virtual double GetOuterRadius() const override { return m_gear_outer_radius; }
59     /// Return the base width of the sprocket profile length of the chord
60     /// where the tooth profile meets the sprocket's outer radius.
GetBaseWidth()61     virtual double GetBaseWidth() const override { return m_gear_base_width; }
62     /// Return the width of the inner tip of the sprocket profile.
GetTipWidth()63     virtual double GetTipWidth() const override { return m_gear_tip_width; }
64     /// Return the depth of the sprocket profile.
65     /// This is measured as the distance from the center of the profile tip line to the
66     /// center of the base width line.
GetToothDepth()67     virtual double GetToothDepth() const override { return m_gear_tooth_depth; }
68     /// Return the radius of the (concave) tooth circular arc.
GetArcRadius()69     virtual double GetArcRadius() const override { return m_gear_arc_radius; }
70 
71     /// Return the allowed backlash (play) before lateral contact with track shoes is enabled (to prevent detracking).
GetLateralBacklash()72     virtual double GetLateralBacklash() const override { return m_lateral_backlash; }
73 
74   private:
75     virtual void Create(const rapidjson::Document& d) override;
76 
77     /// Create the contact material consistent with the specified contact method.
78     virtual void CreateContactMaterial(ChContactMethod contact_method) override;
79 
80     /// Add visualization of the sprocket.
81     virtual void AddVisualizationAssets(VisualizationType vis) override;
82 
83     int m_num_teeth;
84 
85     double m_gear_mass;
86     ChVector<> m_gear_inertia;
87     double m_axle_inertia;
88     double m_separation;
89 
90     double m_gear_outer_radius;
91     double m_gear_base_width;
92     double m_gear_tip_width;
93     double m_gear_tooth_depth;
94     double m_gear_arc_radius;
95     double m_gear_RA;
96 
97     double m_lateral_backlash;
98 
99     bool m_has_mesh;
100     std::string m_meshFile;
101 
102     MaterialInfo m_mat_info;
103 };
104 
105 /// @} vehicle_tracked_sprocket
106 
107 }  // end namespace vehicle
108 }  // end namespace chrono
109 
110 #endif
111