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 ChCoordsys<> &position, 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, bool connected_mesh=true, 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, double length, double width, double hMin, double hMax, bool connected_mesh=true, 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. More...
 
virtual ChVector GetNormal (const ChVector<> &loc) const override
 Get the terrain normal at the point below the specified location. More...
 
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...
 
virtual void GetProperties (const ChVector<> &loc, double &height, ChVector<> &normal, float &friction) const
 Get all terrain characteristics 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 RegisterHeightFunctor (std::shared_ptr< HeightFunctor > functor)
 Specify the functor object to provide the terrain height at given locations. More...
 
void RegisterNormalFunctor (std::shared_ptr< NormalFunctor > functor)
 Specify the functor object to provide the terrain normal at given locations. More...
 
void RegisterFrictionFunctor (std::shared_ptr< FrictionFunctor > functor)
 Specify the functor object to provide the coefficient of friction at given locations.
 

Additional Inherited Members

- Protected Attributes inherited from chrono::vehicle::ChTerrain
std::shared_ptr< HeightFunctorm_height_fun
 functor for location-dependent terrain height
 
std::shared_ptr< NormalFunctorm_normal_fun
 functor for location-dependent terrain normal
 
std::shared_ptr< 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,
double  length,
double  width,
double  hMin,
double  hMax,
bool  connected_mesh = true,
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]lengthpatch length
[in]widthpatch width
[in]hMinminimum height (black level)
[in]hMaxmaximum height (white level)
[in]connected_meshuse connected contact mesh?
[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,
bool  connected_mesh = true,
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]connected_meshuse connected contact mesh?
[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 ChCoordsys<> &  position,
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.

The patch is constructed such that the center of its top surface (the "driving" surface) is in the x-y plane of the specified coordinate system. If tiled = true, multiple side-by-side boxes are used.

Parameters
[in]materialcontact material
[in]positionpatch location and orientation
[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.

◆ GetHeight()

double chrono::vehicle::RigidTerrain::GetHeight ( const ChVector<> &  loc) const
overridevirtual

Get the terrain height below the specified location.

If a user-provided functor object of type ChTerrain::HeightFunctor is provided, that will take precedence over the internal mechanism for calculating terrain height based on the specified geometry. It is the user's responsibility to ensure consistency.

Reimplemented from chrono::vehicle::ChTerrain.

◆ GetNormal()

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

Get the terrain normal at the point below the specified location.

If a user-provided functor object of type ChTerrain::NormalFunctor is provided, that will take precedence over the internal mechanism for calculating terrain normal based on the specified geometry. It is the user's responsibility to ensure consistency.

Reimplemented from chrono::vehicle::ChTerrain.

◆ GetProperties()

void chrono::vehicle::RigidTerrain::GetProperties ( const ChVector<> &  loc,
double &  height,
ChVector<> &  normal,
float &  friction 
) const
virtual

Get all terrain characteristics at the point below the specified location.

This is more efficient than calling GetHeight, GetNormal, and GetCoefficientFriction separately as it performs a single ray-casting operation (if needed at all).

Reimplemented from chrono::vehicle::ChTerrain.

◆ SetCollisionFamily()

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

Set common collision family for patches.

Default: 14. Collision is disabled with all other objects in this family (to prevent generating contact forces between patches, if more than one is defined).

◆ 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