chrono::vehicle::RigidTerrain Class Reference

Description

Rigid terrain model.

This class implements a terrain modeled as a rigid shape which can interact through contact and friction with any other bodies whose contact flag is enabled. In particular, this type of terrain can be used in conjunction with a ChRigidTire.

#include <RigidTerrain.h>

Inheritance diagram for chrono::vehicle::RigidTerrain:
Collaboration diagram for chrono::vehicle::RigidTerrain:

Public Types

enum  Type { FLAT, MESH, HEIGHT_MAP }
 

Public Member Functions

 RigidTerrain (ChSystem *system)
 Construct a default RigidTerrain. More...
 
 RigidTerrain (ChSystem *system, const std::string &filename)
 Construct a RigidTerrain from a JSON specification file. More...
 
void SetContactFrictionCoefficient (float friction_coefficient)
 Set coefficient of friction. More...
 
void SetContactRestitutionCoefficient (float restitution_coefficient)
 Set coefficient of restitution. More...
 
void SetContactMaterialProperties (float young_modulus, float poisson_ratio)
 Set contact material properties. More...
 
void SetContactMaterialCoefficients (float kn, float gn, float kt, float gt)
 Set contact material coefficients. More...
 
float GetCoefficientFriction () const
 Get coefficient of friction for contact material.
 
float GetCoefficientRestitution () const
 Get coefficient of restitution for contact material.
 
float GetYoungModulus () const
 Get Young's modulus of elasticity for contact material.
 
float GetPoissonRatio () const
 Get Poisson ratio for contact material.
 
float GetKn () const
 Get normal stiffness coefficient for contact material.
 
float GetKt () const
 Get tangential stiffness coefficient for contact material.
 
float GetGn () const
 Get normal viscous damping coefficient for contact material.
 
float GetGt () const
 Get tangential viscous damping coefficient for contact material.
 
void EnableVisualization (bool val)
 Enable/disable terrain visualization (default: true). More...
 
bool IsVisualizationEnabled () const
 
void SetColor (ChColor color)
 Set visualization color. More...
 
void SetTexture (const std::string tex_file, float tex_scale_x=1, float tex_scale_y=1)
 Set texture properties. More...
 
std::shared_ptr< ChBodyGetGroundBody ()
 Return a handle to the ground body.
 
void Initialize (double height, double sizeX, double sizeY, bool tiled=false, double max_tile_size=1)
 Initialize the terrain system (flat). More...
 
void Initialize (const std::string &mesh_file, const std::string &mesh_name, double sweep_sphere_radius=0)
 Initialize the terrain system (mesh). More...
 
void Initialize (const std::string &heightmap_file, const std::string &mesh_name, double sizeX, double sizeY, double hMin, double hMax)
 Initialize the terrain system (height map). More...
 
void ExportMeshPovray (const std::string &out_dir)
 Export the terrain mesh (if any) as a macro in a PovRay include file. More...
 
virtual double GetHeight (double x, double y) const override
 Get the terrain height at the specified (x,y) location.
 
virtual chrono::ChVector GetNormal (double x, double y) const override
 Get the terrain normal at the specified (x,y) location.
 
- Public Member Functions inherited from chrono::vehicle::ChTerrain
virtual void Synchronize (double time)
 Update the state of the terrain system at the specified time.
 
virtual void Advance (double step)
 Advance the state of the terrain system by the specified duration.
 

Constructor & Destructor Documentation

chrono::vehicle::RigidTerrain::RigidTerrain ( ChSystem system)

Construct a default RigidTerrain.

The user is responsible for calling various Set methods before Initialize.

Parameters
[in]systempointer to the containing multibody system
chrono::vehicle::RigidTerrain::RigidTerrain ( ChSystem system,
const std::string &  filename 
)

Construct a RigidTerrain from a JSON specification file.

Parameters
[in]systempointer to the containing multibody system
[in]filenamename of the JSON specification file

Member Function Documentation

void chrono::vehicle::RigidTerrain::EnableVisualization ( bool  val)

Enable/disable terrain visualization (default: true).

Note that this is ignored when constructing a terrain object from a JSON specification file.

void chrono::vehicle::RigidTerrain::ExportMeshPovray ( const std::string &  out_dir)

Export the terrain mesh (if any) as a macro in a PovRay include file.

Parameters
[in]out_diroutput directory
void chrono::vehicle::RigidTerrain::Initialize ( double  height,
double  sizeX,
double  sizeY,
bool  tiled = false,
double  max_tile_size = 1 
)

Initialize the terrain system (flat).

This version uses a rigid box of specified dimensions and with specified material properties. If tiled = true, multiple side-by-side boxes are used.

Parameters
[in]heightterrain height
[in]sizeXterrain dimension in the X direction
[in]sizeYterrain dimension in the Y direction
[in]tiledterrain created from multiple tiled boxes
[in]max_tile_sizemaximum tile size
void chrono::vehicle::RigidTerrain::Initialize ( const std::string &  mesh_file,
const std::string &  mesh_name,
double  sweep_sphere_radius = 0 
)

Initialize the terrain system (mesh).

this version uses the specified mesh, for both visualization and contact.

Parameters
[in]mesh_filefilename of the input mesh (OBJ)
[in]mesh_namename of the mesh asset
[in]sweep_sphere_radiusradius of sweep sphere
void chrono::vehicle::RigidTerrain::Initialize ( const std::string &  heightmap_file,
const std::string &  mesh_name,
double  sizeX,
double  sizeY,
double  hMin,
double  hMax 
)

Initialize the terrain system (height map).

This version uses the specified BMP file as a height map to create a mesh for both contact and visualization.

Parameters
[in]heightmap_filefilename for the height map (BMP)
[in]mesh_namename of the mesh asset
[in]sizeXterrain dimension in the X direction
[in]sizeYterrain dimension in the Y direction
[in]hMinminimum height (black level)
[in]hMaxmaximum height (white level)
void chrono::vehicle::RigidTerrain::SetColor ( ChColor  color)

Set visualization color.

Parameters
[in]colorcolor of the visualization material
void chrono::vehicle::RigidTerrain::SetContactFrictionCoefficient ( float  friction_coefficient)

Set coefficient of friction.

The default value is 0.7

void chrono::vehicle::RigidTerrain::SetContactMaterialCoefficients ( float  kn,
float  gn,
float  kt,
float  gt 
)

Set contact material coefficients.

These values are used directly to compute contact forces (if the containing system is so configured and if the SMC contact method is being used). The default values are: kn=2e5, gn=40, kt=2e5, gt=20

Parameters
[in]knnormal contact stiffness
[in]gnnormal contact damping
[in]kttangential contact stiffness
[in]gttangential contact damping
void chrono::vehicle::RigidTerrain::SetContactMaterialProperties ( float  young_modulus,
float  poisson_ratio 
)

Set contact material properties.

These values are used to calculate contact material coefficients (if the containing system is so configured and if the SMC contact method is being used). The default values are: Y = 2e5 and nu = 0.3

Parameters
[in]young_modulusYoung's modulus of elasticity
[in]poisson_ratioPoisson ratio
void chrono::vehicle::RigidTerrain::SetContactRestitutionCoefficient ( float  restitution_coefficient)

Set coefficient of restitution.

The default value is 0.1

void chrono::vehicle::RigidTerrain::SetTexture ( const std::string  tex_file,
float  tex_scale_x = 1,
float  tex_scale_y = 1 
)

Set texture properties.

Parameters
[in]tex_filetexture filename
[in]tex_scale_xtexture scale in X
[in]tex_scale_ytexture scale in Y