chrono::vehicle::SCMDeformableTerrain Class Reference

Description

Deformable terrain model.

This class implements a deformable terrain based on the Soil Contact Model. Unlike RigidTerrain, the vertical coordinates of this terrain mesh can be deformed due to interaction with ground vehicles or other collision shapes.

#include <SCMDeformableTerrain.h>

Inheritance diagram for chrono::vehicle::SCMDeformableTerrain:
Collaboration diagram for chrono::vehicle::SCMDeformableTerrain:

Classes

class  SoilParametersCallback
 Class to be used as a callback interface for location-dependent soil parameters. More...
 

Public Types

enum  DataPlotType {
  PLOT_NONE, PLOT_LEVEL, PLOT_LEVEL_INITIAL, PLOT_SINKAGE,
  PLOT_SINKAGE_ELASTIC, PLOT_SINKAGE_PLASTIC, PLOT_STEP_PLASTIC_FLOW, PLOT_PRESSURE,
  PLOT_PRESSURE_YELD, PLOT_SHEAR, PLOT_K_JANOSI, PLOT_IS_TOUCHED,
  PLOT_ISLAND_ID, PLOT_MASSREMAINDER
}
 
typedef std::pair< ChVector2< int >, double > NodeLevel
 Node height level at a given grid location.
 

Public Member Functions

 SCMDeformableTerrain (ChSystem *system, bool visualization_mesh=true)
 Construct a default SCM deformable terrain. More...
 
void SetPlane (const ChCoordsys<> &plane)
 Set the plane reference. More...
 
const ChCoordsysGetPlane () const
 Get the current reference plane. More...
 
void SetSoilParameters (double Bekker_Kphi, double Bekker_Kc, double Bekker_n, double Mohr_cohesion, double Mohr_friction, double Janosi_shear, double elastic_K, double damping_R)
 Set the properties of the SCM soil model. More...
 
void EnableBulldozing (bool mb)
 Enable/disable the creation of soil inflation at the side of the ruts (bulldozing effects).
 
void SetBulldozingParameters (double erosion_angle, double flow_factor=1.0, int erosion_iterations=3, int erosion_propagations=10)
 Set parameters controlling the creation of side ruts (bulldozing effects). More...
 
void SetTestHeight (double offset)
 Set the vertical level up to which collision is tested (relative to the reference level at the sample point). More...
 
double GetTestHeight () const
 Return the current test height level.
 
void SetPlotType (DataPlotType plot_type, double min_val, double max_val)
 Set the color plot type for the soil mesh. More...
 
void SetColor (const ChColor &color)
 Set visualization color.
 
void SetTexture (const std::string tex_file, float tex_scale_x=1, float tex_scale_y=1)
 Set texture properties. More...
 
void AddMovingPatch (std::shared_ptr< ChBody > body, const ChVector<> &OOBB_center, const ChVector<> &OOBB_dims)
 Add a new moving patch. More...
 
void RegisterSoilParametersCallback (std::shared_ptr< SoilParametersCallback > cb)
 Specify the callback object to set the soil parameters at given (x,y) locations. More...
 
double GetInitHeight (const ChVector<> &loc) const
 Get the initial (undeformed) terrain height below the specified location.
 
ChVector GetInitNormal (const ChVector<> &loc) const
 Get the initial (undeformed) terrain normal at the point below the specified location.
 
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.
 
virtual float GetCoefficientFriction (const ChVector<> &loc) const override
 Get the terrain coefficient of friction at the point below the specified location. More...
 
std::shared_ptr< ChTriangleMeshShapeGetMesh () const
 Get the visualization triangular mesh.
 
void SetMeshWireframe (bool val)
 Set the visualization mesh as wireframe or as solid (default: wireframe). More...
 
void WriteMesh (const std::string &filename) const
 Save the visualization mesh as a Wavefront OBJ file.
 
void Initialize (double sizeX, double sizeY, double delta)
 Initialize the terrain system (flat). More...
 
void Initialize (const std::string &heightmap_file, double sizeX, double sizeY, double hMin, double hMax, double delta)
 Initialize the terrain system (height map). More...
 
std::vector< NodeLevelGetModifiedNodes (bool all_nodes=false) const
 Get the heights of all modified grid nodes. More...
 
void SetModifiedNodes (const std::vector< NodeLevel > &nodes)
 Modify the level of grid nodes from the given list.
 
TerrainForce GetContactForce (std::shared_ptr< ChBody > body) const
 Return the current cumulative contact force on the specified body (due to interaction with the SCM terrain).
 
int GetNumRayCasts () const
 Return the number of rays cast at last step.
 
int GetNumRayHits () const
 Return the number of ray hits at last step.
 
int GetNumContactPatches () const
 Return the number of contact patches at last step.
 
int GetNumErosionNodes () const
 Return the number of nodes in the erosion domain at last step (bulldosing effects).
 
double GetTimerMovingPatches () const
 Return time for updating moving patches at last step (ms).
 
double GetTimerRayTesting () const
 Return time for geometric ray intersection tests at last step (ms).
 
double GetTimerRayCasting () const
 Return time for ray casting at last step (ms). Includes time for ray intersectin testing.
 
double GetTimerContactPatches () const
 Return time for computing contact patches at last step (ms).
 
double GetTimerContactForces () const
 Return time for computing contact forces at last step (ms).
 
double GetTimerBulldozing () const
 Return time for computing bulldozing effects at last step (ms).
 
double GetTimerVisUpdate () const
 Return time for visualization assets update at last step (ms).
 
void PrintStepStatistics (std::ostream &os) const
 Print timing and counter information for last step.
 
- 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

◆ SCMDeformableTerrain()

chrono::vehicle::SCMDeformableTerrain::SCMDeformableTerrain ( ChSystem system,
bool  visualization_mesh = true 
)

Construct a default SCM deformable terrain.

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

Parameters
[in]systempointer to the containing multibody system
[in]visualization_meshenable/disable visualization asset

Member Function Documentation

◆ AddMovingPatch()

void chrono::vehicle::SCMDeformableTerrain::AddMovingPatch ( std::shared_ptr< ChBody body,
const ChVector<> &  OOBB_center,
const ChVector<> &  OOBB_dims 
)

Add a new moving patch.

Multiple calls to this function can be made, each of them adding a new active patch area. If no patches are defined, ray-casting is performed for every single node of the underlying SCM grid. If at least one patch is defined, ray-casting is performed only for mesh nodes within the AABB of the body OOBB projection onto the SCM plane.

Parameters
[in]bodymonitored body
[in]OOBB_centerOOBB center, relative to body
[in]OOBB_dimsOOBB dimensions

◆ GetCoefficientFriction()

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

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

This coefficient of friction value may be used by certain tire models to 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). For SCMDeformableTerrain, this function defers to the user-provided functor object of type ChTerrain::FrictionFunctor, if one was specified. Otherwise, it returns the constant value of 0.8.

Reimplemented from chrono::vehicle::ChTerrain.

◆ GetModifiedNodes()

std::vector< SCMDeformableTerrain::NodeLevel > chrono::vehicle::SCMDeformableTerrain::GetModifiedNodes ( bool  all_nodes = false) const

Get the heights of all modified grid nodes.

If 'all_nodes = true', return modified nodes from the start of simulation. Otherwise, return only the nodes modified over the last step.

◆ GetPlane()

const ChCoordsys & chrono::vehicle::SCMDeformableTerrain::GetPlane ( ) const

Get the current reference plane.

The SCM terrain patch is in the (x,y) plane with normal along the Z axis.

◆ Initialize() [1/2]

void chrono::vehicle::SCMDeformableTerrain::Initialize ( const std::string &  heightmap_file,
double  sizeX,
double  sizeY,
double  hMin,
double  hMax,
double  delta 
)

Initialize the terrain system (height map).

The initial undeformed mesh is provided via the specified image file as a height map. By default, a mesh vertex is created for each pixel in the image. If divX and divY are non-zero, the image will be sampled at the specified resolution with linear interpolation as needed.

Parameters
[in]heightmap_filefilename for the height map (image file)
[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]deltagrid spacing (may be slightly decreased)

◆ Initialize() [2/2]

void chrono::vehicle::SCMDeformableTerrain::Initialize ( double  sizeX,
double  sizeY,
double  delta 
)

Initialize the terrain system (flat).

This version creates a flat array of points.

Parameters
[in]sizeXterrain dimension in the X direction
[in]sizeYterrain dimension in the Y direction
[in]deltagrid spacing (may be slightly decreased)

◆ RegisterSoilParametersCallback()

void chrono::vehicle::SCMDeformableTerrain::RegisterSoilParametersCallback ( std::shared_ptr< SoilParametersCallback cb)

Specify the callback object to set the soil parameters at given (x,y) locations.

To use constant soil parameters throughout the entire patch, use SetSoilParameters.

◆ SetBulldozingParameters()

void chrono::vehicle::SCMDeformableTerrain::SetBulldozingParameters ( double  erosion_angle,
double  flow_factor = 1.0,
int  erosion_iterations = 3,
int  erosion_propagations = 10 
)

Set parameters controlling the creation of side ruts (bulldozing effects).

Parameters
erosion_angleangle of erosion of the displaced material [degrees]
flow_factorgrowth of lateral volume relative to pressed volume
erosion_iterationsnumber of erosion refinements per timestep
erosion_propagationsnumber of concentric vertex selections subject to erosion

◆ SetMeshWireframe()

void chrono::vehicle::SCMDeformableTerrain::SetMeshWireframe ( bool  val)

Set the visualization mesh as wireframe or as solid (default: wireframe).

Note: in wireframe mode, normals for the visualization mesh are not calculated.

◆ SetPlane()

void chrono::vehicle::SCMDeformableTerrain::SetPlane ( const ChCoordsys<> &  plane)

Set the plane reference.

By default, the reference plane is horizontal with Z up (ISO vehicle reference frame). To set as Y up, call SetPlane(ChCoordys(VNULL, Q_from_AngX(-CH_C_PI_2)));

◆ SetPlotType()

void chrono::vehicle::SCMDeformableTerrain::SetPlotType ( DataPlotType  plot_type,
double  min_val,
double  max_val 
)

Set the color plot type for the soil mesh.

When a scalar plot is used, also define the range in the pseudo-color colormap.

◆ SetSoilParameters()

void chrono::vehicle::SCMDeformableTerrain::SetSoilParameters ( double  Bekker_Kphi,
double  Bekker_Kc,
double  Bekker_n,
double  Mohr_cohesion,
double  Mohr_friction,
double  Janosi_shear,
double  elastic_K,
double  damping_R 
)

Set the properties of the SCM soil model.

These parameters are described in: "Parameter Identification of a Planetary Rover Wheel-Soil Contact Model via a Bayesian Approach", A.Gallina, R. Krenn et al. Note that the original SCM model does not include the K and R coefficients. A very large value of K and R=0 reproduce the original SCM.

Parameters
Bekker_KphiKphi, frictional modulus in Bekker model
Bekker_KcKc, cohesive modulus in Bekker model
Bekker_nn, exponent of sinkage in Bekker model (usually 0.6...1.8)
Mohr_cohesionCohesion for shear failure [Pa]
Mohr_frictionFriction angle for shear failure [degree]
Janosi_shearShear parameter in Janosi-Hanamoto formula [m]
elastic_Kelastic stiffness K per unit area, [Pa/m] (must be larger than Kphi)
damping_Rvertical damping R per unit area [Pa.s/m] (proportional to vertical speed)

◆ SetTestHeight()

void chrono::vehicle::SCMDeformableTerrain::SetTestHeight ( double  offset)

Set the vertical level up to which collision is tested (relative to the reference level at the sample point).

Since the contact is unilateral, this could be zero. However, when computing bulldozing flow, one might also need to know if in the surrounding there is some potential future contact: so it might be better to use a positive value (but not higher than the max. expected height of the bulldozed rubble, to avoid slowdown of collision tests). Default: 0.1 m.

◆ SetTexture()

void chrono::vehicle::SCMDeformableTerrain::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

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