1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All right 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, Michael Taylor
13 // =============================================================================
14 //
15 // Base class for continuous band track assembly using rigid tread.
16 // Derived classes specify the actual template defintions, using different track
17 // shoes.
18 //
19 // The reference frame for a vehicle follows the ISO standard: Z-axis up, X-axis
20 // pointing forward, and Y-axis towards the left of the vehicle.
21 //
22 // =============================================================================
23 
24 #ifndef CH_TRACK_ASSEMBLY_BAND_H
25 #define CH_TRACK_ASSEMBLY_BAND_H
26 
27 #include <vector>
28 
29 #include "chrono/core/ChVector2.h"
30 #include "chrono_vehicle/ChApiVehicle.h"
31 #include "chrono_vehicle/tracked_vehicle/ChTrackAssembly.h"
32 #include "chrono_vehicle/tracked_vehicle/sprocket/ChSprocketBand.h"
33 
34 namespace chrono {
35 namespace vehicle {
36 
37 /// @addtogroup vehicle_tracked
38 /// @{
39 
40 /// Definition of a continuous band track assembly.
41 /// A track assembly consists of a sprocket, an idler (with tensioner mechanism),
42 /// a set of suspensions (road-wheel assemblies), and a collection of track shoes.
43 /// This is the base class for continuous band track assembly using rigid tread.
44 /// Derived classes specify the actual template defintions, using different track shoes.
45 class CH_VEHICLE_API ChTrackAssemblyBand : public ChTrackAssembly {
46   public:
ChTrackAssemblyBand(const std::string & name,VehicleSide side)47     ChTrackAssemblyBand(const std::string& name,  ///< [in] name of the subsystem
48                         VehicleSide side          ///< [in] assembly on left/right vehicle side
49                         )
50         : ChTrackAssembly(name, side) {}
51 
~ChTrackAssemblyBand()52     virtual ~ChTrackAssemblyBand() {}
53 
54     /// Get a handle to the sprocket.
GetSprocket()55     virtual std::shared_ptr<ChSprocket> GetSprocket() const override { return m_sprocket; }
56 
57   protected:
58     std::shared_ptr<ChSprocketBand> m_sprocket;  ///< sprocket subsystem
59 
60     /// Assembly Algorithm Utility Functions
61     bool FindAssemblyPoints(std::shared_ptr<ChBodyAuxRef> chassis,
62                             int num_shoes,
63                             const std::vector<double>& connection_lengths,
64                             std::vector<ChVector2<>>& shoe_points);
65 
66     void FindCircleTangentPoints(
67         ChVector2<> Circle1Pos,  ///< Center Position of Circle 1
68         double Circle1Rad,       ///< Radius of Circle 1
69         ChVector2<> Circle2Pos,  ///< Center Position of Circle 2
70         double Circle2Rad,       ///< Radius of Circle 2
71         ChVector2<>& Tan1Pnt1,   ///< Point on Circle 1 for the first calculated outside tangent
72         ChVector2<>& Tan1Pnt2,   ///< Point on Circle 2 for the first calculated outside tangent
73         ChVector2<>& Tan2Pnt1,   ///< Point on Circle 1 for the second calculated outside tangent
74         ChVector2<>& Tan2Pnt2    ///< Point on Circle 2 for the second calculated outside tangent
75     );
76     void CheckCircleCircle(
77         bool& found,  ///< Does an intersection point exist between the circle formed by StartingPoint and Radius with
78                       ///< the current circle belt feature
79         ChVector2<>& Point,  ///< Intersection Point, if it exists between the circle formed by StartingPoint and Radius
80                              ///< with the current circle belt feature
81         ChMatrixDynamic<>& Features,  ///< Table with the tagent or arc information for the entire belt wrap
82         int FeatureIdx,               ///< Current belt feature to check the intersection of
83         ChVector2<>& StartingPoint,   ///< Current Point on the belt wrap
84         double Radius                 ///< Length of the current belt segment that needs to be placed on the belt wrap
85     );
86     void CheckCircleLine(
87         bool& found,  ///< Does an intersection point exist between the circle formed by StartingPoint and Radius with
88                       ///< the current circle belt feature
89         ChVector2<>& Point,  ///< Intersection Point, if it exists between the circle formed by StartingPoint and Radius
90                              ///< with the current circle belt feature
91         ChMatrixDynamic<>& Features,  ///< Table with the tagent or arc information for the entire belt wrap
92         int FeatureIdx,               ///< Current belt feature to check the intersection of
93         ChVector2<>& StartingPoint,   ///< Current Point on the belt wrap
94         double Radius                 ///< Length of the current belt segment that needs to be placed on the belt wrap
95     );
96 
97     double m_sprocket_offset;
98 };
99 
100 /// @} vehicle_tracked
101 
102 }  // end namespace vehicle
103 }  // end namespace chrono
104 
105 #endif
106