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: Rainer Gericke
13 // =============================================================================
14 //
15 // M113 road wheel subsystem.
16 //
17 // =============================================================================
18 
19 #ifndef MARDER_ROAD_WHEEL_H
20 #define MARDER_ROAD_WHEEL_H
21 
22 #include <string>
23 
24 #include "chrono_vehicle/ChSubsysDefs.h"
25 #include "chrono_vehicle/ChVehicleModelData.h"
26 #include "chrono_vehicle/tracked_vehicle/road_wheel/ChDoubleRoadWheel.h"
27 
28 #include "chrono_models/ChApiModels.h"
29 
30 namespace chrono {
31 namespace vehicle {
32 namespace marder {
33 
34 /// @addtogroup vehicle_models_marder
35 /// @{
36 
37 /// Road-wheel model for the Marder vehicle (base class).
38 class CH_MODELS_API Marder_RoadWheel : public ChDoubleRoadWheel {
39   public:
~Marder_RoadWheel()40     virtual ~Marder_RoadWheel() {}
41 
42     /// Return the mass of the idler wheel body.
GetWheelMass()43     virtual double GetWheelMass() const override { return m_wheel_mass; }
44     /// Return the moments of inertia of the idler wheel body.
GetWheelInertia()45     virtual const ChVector<>& GetWheelInertia() override { return m_wheel_inertia; }
46     /// Return the radius of the idler wheel.
GetWheelRadius()47     virtual double GetWheelRadius() const override { return m_wheel_radius; }
48     /// Return the total width of the idler wheel.
GetWheelWidth()49     virtual double GetWheelWidth() const override { return m_wheel_width; }
50     /// Return the gap width.
GetWheelGap()51     virtual double GetWheelGap() const override { return m_wheel_gap; }
52 
53   protected:
54     Marder_RoadWheel(const std::string& name);
55 
56     virtual VehicleSide GetVehicleSide() const = 0;
57 
58     virtual std::string GetMeshFile() const = 0;
59 
60     /// Create the contact material consistent with the specified contact method.
61     virtual void CreateContactMaterial(ChContactMethod contact_method) override;
62 
63     /// Add visualization of the road wheel.
64     virtual void AddVisualizationAssets(VisualizationType vis) override;
65 
66     static const double m_wheel_mass;
67     static const ChVector<> m_wheel_inertia;
68     static const double m_wheel_radius;
69     static const double m_wheel_width;
70     static const double m_wheel_gap;
71 };
72 
73 /// Road-wheel model for the M113 vehicle (left side).
74 class CH_MODELS_API Marder_RoadWheelLeft : public Marder_RoadWheel {
75   public:
Marder_RoadWheelLeft(int index)76     Marder_RoadWheelLeft(int index) : Marder_RoadWheel("Marder_RoadWheelLeft_" + std::to_string(index)) {}
~Marder_RoadWheelLeft()77     ~Marder_RoadWheelLeft() {}
78 
GetVehicleSide()79     virtual VehicleSide GetVehicleSide() const override { return LEFT; }
80 
GetMeshFile()81     virtual std::string GetMeshFile() const override { return GetDataFile(m_meshFile); }
82 
83   private:
84     static const std::string m_meshFile;
85 };
86 
87 /// Road-wheel model for the M113 vehicle (right side).
88 class CH_MODELS_API Marder_RoadWheelRight : public Marder_RoadWheel {
89   public:
Marder_RoadWheelRight(int index)90     Marder_RoadWheelRight(int index) : Marder_RoadWheel("Marder_RoadWheelRight_" + std::to_string(index)) {}
~Marder_RoadWheelRight()91     ~Marder_RoadWheelRight() {}
92 
GetVehicleSide()93     virtual VehicleSide GetVehicleSide() const override { return RIGHT; }
94 
GetMeshFile()95     virtual std::string GetMeshFile() const override { return GetDataFile(m_meshFile); }
96 
97   private:
98     static const std::string m_meshFile;
99 };
100 
101 /// @} vehicle_models_marder
102 
103 }  // namespace marder
104 }  // end namespace vehicle
105 }  // end namespace chrono
106 
107 #endif
108