Tutorials for the agxTerrain API written in the python scripting language

agxTerrain is a library consisting of classes that implement a deformable terrain model based a symmetric 3D grid data structure with an overlapping surface heightfield that can be deformed by interacting Shovel objects performing digging motions, converting solid mass to dynamic mass which can be moved.

For more details, we refer to the technical report.

All Python based tutorials can be found in <agxDir>/data/python/tutorials. Most of the scripts can be started both with the python executable and agxViewer.
To run these tutorials, AGX needs to be installed on the computer. The .agxScene, .agxPy file suffix is associated to the application agxViewer which will be executed for the links below.

If you want to start one of the scripts manually in a command window, just write:

agxviewer tutorials\agxTerrain\tutorial_terrain_materials.agxPy

When starting agxViewer via this page, it starts by default in paused mode. Remember to press 'e' to start simulation.

Required licenses: AGXTerrain, AGXGranular

Keybindings and arguments for agxViewer

Tutorial: Controlling terrain materials

If you have the PyQtGraph module installed, a plot will be shown with penetration force, separation force and deformation force.

  • Construct a terrain from a height field
  • Set the materials of the terrain explicitly
  • Set the terrain materials by loading a material from the terrain material library
  • Set up a shovel that can transform solid terrain into dynamic particles
Start tutorial_terrain_materials.agxPy in agxViewer
View source code
tutorial_terrain_materials

Tutorial: Compressed soil

This script has 3 scenes (select by pressing '1', '2', '3')

This script demonstrates:

  1. Demonstrate compaction functionality by creating objects of differing weights and shapes that are dropped on a terrain and compact the solid from stress generated by the terrain contacts. The more an object weighs the more it will compact the soil, given that the contact area is the same.
  2. Demonstrate compaction of sol by compressing a soil column under heavy load
  3. Demonstrate Swell Factor by creating a shovel that digs into the ground and hits a wall of compacted material. The swell factor should visibly increase the soil volume when the wall is excavated
Start tutorial_compressed_soil in agxViewer
View source code
tutorial_compressed_soil

Tutorial: Particle emitter

This script demonstrates how to:

  • Construct a terrain and set vertex heights through the terrain API
  • Force avalanching of all vertices in the terrain
  • Create an emitter by extracting the Terrain's internal particle system
  • Disabling collisions between external rigid bodies and the particles via collision groups
Start tutorial_particle_emitter in agxViewer
View source code
tutorial_particle_emitter

Tutorial: Grading the terrain

This script demonstrates how to:

  • Construct a default terrain
  • Use the TerrainGridDataInterace to add/remove solid occupancy and modify compaction
  • Set up a shovel that can transform solid terrain into dynamic particles
Start tutorial_grading in agxViewer
View source code
tutorial_grading

Tutorial: Shovel in sloped terrain

If you have the PyQtGraph module installed, a plot will be shown with penetration force, separation force and deformation force.

This script demonstrates how to:

  • Construct a default terrain
  • Construct a terrain from a height field
  • Set the terrain materials by loading a material from the terrain material library
Start tutorial_shovel_sloped_terrain in agxViewer
View source code
tutorial_shovel_sloped_terrain

Tutorial: Bulldozing

This script demonstrates how to:

  • Construct a default terrain
  • Set the materials of the terrain explicitly
  • Set up a shovel that can transform solid terrain into dynamic particles
Start tutorial_bulldozing in agxViewer
View source code
tutorial_bulldozing

Tutorial: Moving soil using the API

Demonstrate usage of the TerrainDataInterface by creating a sensor geometry that moves, via using the interface, solid occupancy in intersecting grid elements and modifies the compaction according to the swell factor of the bulk material.

This script demonstrates how to:

  • Construct a terrain and set vertex heights through the terrain API
  • Use the TerrainGridDataInterace to add/remove solid occupancy and modify compaction
  • Extract information about intersecting voxels with sensors
Start tutorial_move_solid_occupancy in agxViewer
View source code
tutorial_move_solid_occupancy

Tutorial: Bulldozing large terrains using the TerrainPager

The agxTerrain.TerrainPager can be used to create large terrain areas which can be operated on. Geometries (typical heightfields) are added to the pager as the initial terrain definition. When needed, new terrain tiles are paged in/out from/to disk to support large operation areas.

  • Construct a TerrainPager
  • Listen to events when terrain are being paged in/out from disk
Start tutorial_bulldozing_terrain_paging in agxViewer
View source code
tutorial_bulldozing

Tutorial: How to reduce the number of particles in agxTerrain simulations

This tutorial demonstrates the use of the scaling feature that can dramatically improve performance of terrain simulation by increasing and hence reducing the number of particles in a simulation:

agxTerrain.TerrainProperties.setSoilParticleSizeScaling

Start tutorial_particle_size_scaling in agxViewer
View source code
tutorial_particle_size_scaling

Tutorial: Create custom terrain soil failure volumes

In addition to using shovels or the soil API, terrain soil failure can be triggered inside a specified convex volume.

This tutorial demonstrates how to

  • Set up a terrain as part of a Rigid Body to move the terrain
  • Trigger soil failure in specified convex volumes
Start tutorials/agxTerrain/tutorial_soil_failure_volume in agxViewer
View source code
tutorial_soil_failure_volume

Tutorial: Inhomogeneous terrain

This script demonstrates how to set different terrain materials on the terrain instance. It also shows how to configure the associated agx.Material to each added TerrainMaterial, and how to configure the ContactMaterial between the shovel and different parts of the terrain.

Start tutorial_inhomogeneous_terrain.agxPy in agxViewer
View source code