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 // Track assembly (band-ANCF) model constructed from a JSON specification file
16 //
17 // =============================================================================
18 
19 #ifndef TRACK_ASSEMBLY_BAND_ANCF_H
20 #define TRACK_ASSEMBLY_BAND_ANCF_H
21 
22 #include <vector>
23 
24 #include "chrono_vehicle/ChApiVehicle.h"
25 #include "chrono_vehicle/tracked_vehicle/track_assembly/ChTrackAssemblyBandANCF.h"
26 
27 #include "chrono_thirdparty/rapidjson/document.h"
28 
29 namespace chrono {
30 namespace vehicle {
31 
32 /// @addtogroup vehicle_tracked
33 /// @{
34 
35 /// Band-ANCF track assembly model constructed from a JSON specification file
36 class CH_VEHICLE_API TrackAssemblyBandANCF : public ChTrackAssemblyBandANCF {
37   public:
38     TrackAssemblyBandANCF(const std::string& filename);
39     TrackAssemblyBandANCF(const rapidjson::Document& d);
~TrackAssemblyBandANCF()40     ~TrackAssemblyBandANCF() {}
41 
GetSprocketLocation()42     virtual const ChVector<> GetSprocketLocation() const override { return m_sprocket_loc; }
GetIdlerLocation()43     virtual const ChVector<> GetIdlerLocation() const override { return m_idler_loc; }
GetRoadWhelAssemblyLocation(int which)44     virtual const ChVector<> GetRoadWhelAssemblyLocation(int which) const override { return m_susp_locs[which]; }
GetRollerLocation(int which)45     virtual const ChVector<> GetRollerLocation(int which) const override { return m_roller_locs[which]; }
46 
47   private:
48     virtual void Create(const rapidjson::Document& d) override;
49 
50     /// Create the contact material for the web mesh, consistent with the specified contact method.
51     virtual void CreateContactMaterial(ChContactMethod contact_method) override;
52 
53     void ReadSprocket(const std::string& filename, int output);
54     void ReadTrackShoes(const std::string& filename, int num_shoes, int output);
55 
56     int m_num_susp;
57     int m_num_rollers;
58     int m_num_track_shoes;
59 
60     ChVector<> m_sprocket_loc;
61     ChVector<> m_idler_loc;
62     std::vector<ChVector<>> m_susp_locs;
63     std::vector<ChVector<>> m_roller_locs;
64 
65     MaterialInfo m_mat_info;
66 };
67 
68 /// @} vehicle_tracked
69 
70 }  // end namespace vehicle
71 }  // end namespace chrono
72 
73 #endif
74