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 // Marder road wheel subsystem.
16 //
17 // =============================================================================
18 
19 #include "chrono/assets/ChTriangleMeshShape.h"
20 #include "chrono/utils/ChUtilsInputOutput.h"
21 
22 #include "chrono_vehicle/ChVehicleModelData.h"
23 
24 #include "chrono_models/vehicle/marder/Marder_RoadWheel.h"
25 
26 #include "chrono_thirdparty/filesystem/path.h"
27 
28 namespace chrono {
29 namespace vehicle {
30 namespace marder {
31 
32 // -----------------------------------------------------------------------------
33 // Static variables
34 // -----------------------------------------------------------------------------
35 const double Marder_RoadWheel::m_wheel_mass = 35.56;
36 const ChVector<> Marder_RoadWheel::m_wheel_inertia(1.14, 2.16, 1.14);
37 const double Marder_RoadWheel::m_wheel_radius = 0.350;
38 const double Marder_RoadWheel::m_wheel_width = 0.220;
39 const double Marder_RoadWheel::m_wheel_gap = 0.051;
40 
41 const std::string Marder_RoadWheelLeft::m_meshFile = "Marder/Roller_L.obj";
42 const std::string Marder_RoadWheelRight::m_meshFile = "Marder/Roller_R.obj";
43 
44 // -----------------------------------------------------------------------------
45 // -----------------------------------------------------------------------------
Marder_RoadWheel(const std::string & name)46 Marder_RoadWheel::Marder_RoadWheel(const std::string& name) : ChDoubleRoadWheel(name) {}
47 
CreateContactMaterial(ChContactMethod contact_method)48 void Marder_RoadWheel::CreateContactMaterial(ChContactMethod contact_method) {
49     MaterialInfo minfo;
50     minfo.mu = 0.4f;
51     minfo.cr = 0.75f;
52     minfo.Y = 1e7f;
53     m_material = minfo.CreateMaterial(contact_method);
54 }
55 
56 // -----------------------------------------------------------------------------
57 // -----------------------------------------------------------------------------
AddVisualizationAssets(VisualizationType vis)58 void Marder_RoadWheel::AddVisualizationAssets(VisualizationType vis) {
59     if (vis == VisualizationType::MESH) {
60         auto trimesh = chrono_types::make_shared<geometry::ChTriangleMeshConnected>();
61         trimesh->LoadWavefrontMesh(GetMeshFile(), false, false);
62         auto trimesh_shape = chrono_types::make_shared<ChTriangleMeshShape>();
63         trimesh_shape->SetMesh(trimesh);
64         trimesh_shape->SetName(filesystem::path(GetMeshFile()).stem());
65         trimesh_shape->SetStatic(true);
66         m_wheel->AddAsset(trimesh_shape);
67     } else {
68         ChDoubleRoadWheel::AddVisualizationAssets(vis);
69     }
70 }
71 
72 }  // namespace marder
73 }  // end namespace vehicle
74 }  // end namespace chrono
75