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:

Classes

class  Patch
 Definition of a patch in a rigid terrain model. More...
 

Public Types

enum  PatchType { PatchType::BOX, PatchType::MESH, PatchType::HEIGHT_MAP }
 Patch type. More...
 

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...
 
std::shared_ptr< PatchAddPatch (std::shared_ptr< ChMaterialSurface > material, const ChVector<> &location, const ChVector<> &normal, double length, double width, double thickness=1, bool tiled=false, double max_tile_size=1, bool visualization=true)
 Add a terrain patch represented by a rigid box. More...
 
std::shared_ptr< PatchAddPatch (std::shared_ptr< ChMaterialSurface > material, const ChCoordsys<> &position, const std::string &mesh_file, const std::string &mesh_name, double sweep_sphere_radius=0, bool visualization=true)
 Add a terrain patch represented by a triangular mesh. More...
 
std::shared_ptr< PatchAddPatch (std::shared_ptr< ChMaterialSurface > material, const ChCoordsys<> &position, const std::string &heightmap_file, const std::string &mesh_name, double length, double width, double hMin, double hMax, double sweep_sphere_radius=0, bool visualization=true)
 Add a terrain patch represented by a height-field map. More...
 
void Initialize ()
 Initialize all defined terrain patches.
 
const std::vector< std::shared_ptr< Patch > > & GetPatches () const
 Get the terrain patches currently added to the rigid terrain system.
 
virtual double GetHeight (const ChVector<> &loc) const override
 Get the terrain height below the specified location.
 
virtual ChVector GetNormal (const ChVector<> &loc) const override
 Get the terrain normal at the point below the specified location.
 
void UseLocationDependentFriction (bool val)
 Enable use of location-dependent coefficient of friction in terrain-solid contacts. More...
 
virtual float GetCoefficientFriction (const ChVector<> &loc) const override
 Get the terrain coefficient of friction at the point below the specified location. More...
 
void ExportMeshPovray (const std::string &out_dir, bool smoothed=false)
 Export all patch meshes as macros in PovRay include files.
 
void ExportMeshWavefront (const std::string &out_dir)
 Export all patch meshes as Wavefront files.
 
bool FindPoint (const ChVector<> loc, double &height, ChVector<> &normal, float &friction) const
 Find the terrain height, normal, and coefficient of friction at the point below the specified location. More...
 
void SetCollisionFamily (int family)
 Set common collision family for patches. More...
 
- 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.
 
void RegisterFrictionFunctor (FrictionFunctor *functor)
 Specify the functor object to provide the coefficient of friction at given (x,y) locations.
 

Additional Inherited Members

- Protected Attributes inherited from chrono::vehicle::ChTerrain
FrictionFunctorm_friction_fun
 functor for location-dependent coefficient of friction
 

Member Enumeration Documentation

◆ PatchType

Patch type.

Enumerator
BOX 

rectangular box

MESH 

triangular mesh (from a Wavefront OBJ file)

HEIGHT_MAP 

triangular mesh (generated from a gray-scale BMP height-map)

Constructor & Destructor Documentation

◆ RigidTerrain() [1/2]

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

◆ RigidTerrain() [2/2]

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

◆ AddPatch() [1/3]

std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( std::shared_ptr< ChMaterialSurface material,
const ChCoordsys<> &  position,
const std::string &  heightmap_file,
const std::string &  mesh_name,
double  length,
double  width,
double  hMin,
double  hMax,
double  sweep_sphere_radius = 0,
bool  visualization = true 
)

Add a terrain patch represented by a height-field map.

The height map is specified through a BMP gray-scale image.

Parameters
[in]materialcontact material
[in]positionpatch location and orientation
[in]heightmap_filefilename for the height map (BMP)
[in]mesh_namename of the mesh asset
[in]lengthpatch length
[in]widthpatch width
[in]hMinminimum height (black level)
[in]hMaxmaximum height (white level)
[in]sweep_sphere_radiusradius of sweep sphere
[in]visualizationenable/disable construction of visualization assets

◆ AddPatch() [2/3]

std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( std::shared_ptr< ChMaterialSurface material,
const ChCoordsys<> &  position,
const std::string &  mesh_file,
const std::string &  mesh_name,
double  sweep_sphere_radius = 0,
bool  visualization = true 
)

Add a terrain patch represented by a triangular mesh.

The mesh is specified through a Wavefront file and is used for both contact and visualization.

Parameters
[in]materialcontact material
[in]positionpatch location and orientation
[in]mesh_filefilename of the input mesh (OBJ)
[in]mesh_namename of the mesh asset
[in]sweep_sphere_radiusradius of sweep sphere
[in]visualizationenable/disable construction of visualization assets

◆ AddPatch() [3/3]

std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( std::shared_ptr< ChMaterialSurface material,
const ChVector<> &  location,
const ChVector<> &  normal,
double  length,
double  width,
double  thickness = 1,
bool  tiled = false,
double  max_tile_size = 1,
bool  visualization = true 
)

Add a terrain patch represented by a rigid box.

If tiled = true, multiple side-by-side boxes are used. The "driving" surface is assumed to be the +z face of the specified box domain.

Parameters
[in]materialcontact material
[in]locationcenter of top surface
[in]normalnormal to top surface
[in]lengthpatch length
[in]widthpatch width
[in]thicknessbox thickness
[in]tiledterrain created from multiple tiled boxes
[in]max_tile_sizemaximum tile size
[in]visualizationenable/disable construction of visualization assets

◆ FindPoint()

bool chrono::vehicle::RigidTerrain::FindPoint ( const ChVector<>  loc,
double &  height,
ChVector<> &  normal,
float &  friction 
) const

Find the terrain height, normal, and coefficient of friction at the point below the specified location.

The point on the terrain surface is obtained through ray casting into the terrain contact model. The return value is 'true' if the ray intersection succeeded and 'false' otherwise (in which case the output is set to heigh=0, normal=[0,0,1], and friction=0.8).

◆ GetCoefficientFriction()

float chrono::vehicle::RigidTerrain::GetCoefficientFriction ( const ChVector<> &  loc) const
overridevirtual

Get the terrain coefficient of friction at the point below the specified location.

For RigidTerrain, this function defers to the user-provided functor object of type ChTerrain::FrictionFunctor, if one was specified. Otherwise, it returns the constant value from the appropriate patch, as specified through SetContactFrictionCoefficient. Note that this function may be used by tire models to appropriately modify the tire characteristics, but it will have no effect on the interaction of the terrain with other objects (including tire models that do not explicitly use it). See UseLocationDependentFriction.

Reimplemented from chrono::vehicle::ChTerrain.

◆ SetCollisionFamily()

void chrono::vehicle::RigidTerrain::SetCollisionFamily ( int  family)
inline

Set common collision family for patches.

Used only if defining two or more patches. Default: 14.

◆ UseLocationDependentFriction()

void chrono::vehicle::RigidTerrain::UseLocationDependentFriction ( bool  val)
inline

Enable use of location-dependent coefficient of friction in terrain-solid contacts.

This assumes that a non-trivial functor (of type ChTerrain::FrictionFunctor) was defined and registered with the terrain subsystem. Enable this only if simulating a system that has contacts with the terrain that must be resolved using the underlying Chrono contact mechanism (e.g., for rigid tires, FEA tires, tracked vehicles). Note that this feature requires a relatively expensive traversal of all contacts at each simulation step. By default, this option is disabled. This function must be called before Initialize.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_vehicle/terrain/RigidTerrain.h
  • /builds/uwsbel/chrono/src/chrono_vehicle/terrain/RigidTerrain.cpp