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 (single-pin) model constructed from a JSON specification file 16 // 17 // ============================================================================= 18 19 #ifndef TRACK_ASSEMBLY_SINGLE_PIN_H 20 #define TRACK_ASSEMBLY_SINGLE_PIN_H 21 22 #include <vector> 23 24 #include "chrono_vehicle/ChApiVehicle.h" 25 #include "chrono_vehicle/tracked_vehicle/track_assembly/ChTrackAssemblySinglePin.h" 26 27 #include "chrono_thirdparty/rapidjson/document.h" 28 29 namespace chrono { 30 namespace vehicle { 31 32 /// @addtogroup vehicle_tracked 33 /// @{ 34 35 /// Single-pin track assembly model constructed from a JSON specification file 36 class CH_VEHICLE_API TrackAssemblySinglePin : public ChTrackAssemblySinglePin { 37 public: 38 TrackAssemblySinglePin(const std::string& filename); 39 TrackAssemblySinglePin(const rapidjson::Document& d); 40 ~TrackAssemblySinglePin(); 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 void ReadSprocket(const std::string& filename, int output); 51 void ReadTrackShoes(const std::string& filename, int num_shoes, int output); 52 53 int m_num_susp; 54 int m_num_rollers; 55 int m_num_track_shoes; 56 57 ChVector<> m_sprocket_loc; 58 ChVector<> m_idler_loc; 59 std::vector<ChVector<>> m_susp_locs; 60 std::vector<ChVector<>> m_roller_locs; 61 }; 62 63 /// @} vehicle_tracked 64 65 } // end namespace vehicle 66 } // end namespace chrono 67 68 #endif 69