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 { BOX, 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...
 
std::shared_ptr< Patch > AddPatch (const ChCoordsys<> &position, const ChVector<> &size, bool tiled=false, double max_tile_size=1, bool visualization=true)
 Add a terrain patch represented by a rigid box. More...
 
std::shared_ptr< Patch > AddPatch (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< Patch > AddPatch (const ChCoordsys<> &position, const std::string &heightmap_file, const std::string &mesh_name, double sizeX, double sizeY, double hMin, double hMax, 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 (double x, double y) const override
 Get the terrain height at the specified (x,y) location.
 
virtual ChVector GetNormal (double x, double y) const override
 Get the terrain height at the specified (x,y) location.
 
void UseLocationDependentFriction (bool val)
 Enable use of location-dependent coefficient of friction in terrain-solid contacts. More...
 
virtual float GetCoefficientFriction (double x, double y) const override
 Get the terrain coefficient of friction at the specified (x,y) location. More...
 
void ExportMeshPovray (const std::string &out_dir)
 Export all patch meshes as macros in PovRay include files.
 
- 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
 

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

std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( const ChCoordsys<> &  position,
const ChVector<> &  size,
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.

Parameters
[in]positionbox location and orientation
[in]sizebox dimensions (x, y, z)
[in]tiledterrain created from multiple tiled boxes
[in]max_tile_sizemaximum tile size
[in]visualizationenable/disable construction of visualization assets
std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( 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]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
std::shared_ptr< RigidTerrain::Patch > chrono::vehicle::RigidTerrain::AddPatch ( const ChCoordsys<> &  position,
const std::string &  heightmap_file,
const std::string &  mesh_name,
double  sizeX,
double  sizeY,
double  hMin,
double  hMax,
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]positionpatch location and orientation
[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)
[in]visualizationenable/disable construction of visualization assets
float chrono::vehicle::RigidTerrain::GetCoefficientFriction ( double  x,
double  y 
) const
overridevirtual

Get the terrain coefficient of friction at the specified (x,y) 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.

Implements chrono::vehicle::ChTerrain.

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

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.