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 double-pin sprocket model constructed with data from file
16 // (JSON format).
17 //
18 // =============================================================================
19 
20 #ifndef SPROCKET_DOUBLE_PIN_H
21 #define SPROCKET_DOUBLE_PIN_H
22 
23 #include "chrono_vehicle/ChApiVehicle.h"
24 #include "chrono_vehicle/tracked_vehicle/sprocket/ChSprocketDoublePin.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 double-pin sprocket model constructed with data from file (JSON format).
35 class CH_VEHICLE_API SprocketDoublePin : public ChSprocketDoublePin {
36   public:
37     SprocketDoublePin(const std::string& filename);
38     SprocketDoublePin(const rapidjson::Document& d);
~SprocketDoublePin()39     ~SprocketDoublePin() {}
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_RT; }
59     /// Return the radius of the (concave) tooth circular arc.
GetArcRadius()60     virtual double GetArcRadius() const override { return m_gear_R; }
61     /// Return height of arc center.
GetArcCenterHeight()62     virtual double GetArcCenterHeight() const override { return m_gear_C; }
63     /// Return offset of arc center.
GetArcCenterOffset()64     virtual double GetArcCenterOffset() const override { return m_gear_W; }
65 
66     /// Return the allowed backlash (play) before lateral contact with track shoes is enabled (to prevent detracking).
GetLateralBacklash()67     virtual double GetLateralBacklash() const override { return m_lateral_backlash; }
68 
69   private:
70     virtual void Create(const rapidjson::Document& d) override;
71 
72     /// Create the contact material consistent with the specified contact method.
73     virtual void CreateContactMaterial(ChContactMethod contact_method) override;
74 
75     /// Add visualization of the sprocket.
76     virtual void AddVisualizationAssets(VisualizationType vis) override;
77 
78     int m_num_teeth;
79 
80     double m_gear_mass;
81     ChVector<> m_gear_inertia;
82     double m_axle_inertia;
83     double m_separation;
84 
85     double m_gear_RT;
86     double m_gear_R;
87     double m_gear_RA;
88     double m_gear_C;
89     double m_gear_W;
90 
91     double m_lateral_backlash;
92 
93     bool m_has_mesh;
94     std::string m_meshFile;
95 
96     MaterialInfo m_mat_info;
97 };
98 
99 /// @} vehicle_tracked_sprocket
100 
101 }  // end namespace vehicle
102 }  // end namespace chrono
103 
104 #endif
105