|
AGX Dynamics 2.42.3.1
|
The TerrainWheelPlane consists of the parts and logic that is necessary to create. More...
#include <TerrainWheelPlane.h>
Inheritance diagram for agxTerrain::TerrainWheelPlane:Classes | |
| struct | GridAxes |
| struct | RegressionPlanesData |
| Container for all regression plane related data used by TerrainWheel. More... | |
Public Types | |
| enum class | PlaneName { FORCE_FEEDBACK , FRONT_ANGLE , REAR_ANGLE , REAR_AND_FRONT_ANGLE_REFERENCE } |
Public Member Functions | |
| TerrainWheelPlane (TerrainWheel *wheel, RegressionPlanesParameters *params) | |
| std::vector< std::vector< agx::Int > > | collectRegressionPlaneIndexGroups () const |
| Collect all regression-plane groups that are required by the new regression-plane pipeline. | |
| agxCollide::RegressionPlane | computeRegressionPlane (agx::Vec3Vector &surfacePoints) |
| Fit a regression plane from previously collected terrain surface points. | |
| agx::Vec3Vector | computeRegressionPlaneSurfacePoints (agx::Vec3Vector &positions, std::size_t index) |
| Compute terrain surface sample points for a unique grid-point combination. | |
| agx::Real | computeScaledLength (agx::Real baseValue, const RegressionPlanesParameters::GridScale &scale) const |
| Compute a scaled length value based on a base value and a specified scale (see RegressionPlanesParameters::GridScale). | |
| agx::AffineMatrix4x4 | computeTransformForPlaneAtPlane (const agx::Vec3 &normal, const agx::Vec3 &point) |
| Compute a transformation aligning a plane in world space. | |
| agx::AffineMatrix4x4 | computeTransformForPlaneAtWheel (const agx::Vec3 &normal, const agx::Vec3 &point) |
| Compute a transformation aligning a plane relative to the wheel center. | |
| agxCollide::HeightField * | createForceFeedbackHeightField () |
| Create the force feedback heightfield. | |
| agxCollide::Geometry * | createForceFeedbackPlane () |
| Create the geometry which is used for force feedback. | |
| bool | findGridCombinationAndGroupForPlaneIndex (std::size_t planeIndex, agx::Int &combinationIndex, agx::Int &groupIndex) const |
| Given the index of a unique regression plane, attempt to find which (combinationIndex, groupIndex) it corresponds to in the gridCombinations structure. | |
| agx::Int | findRegressionPlaneIndexForBaseGridIndices (const std::vector< agx::Int > &baseGridIndices) const |
| Find the unique regression-plane index corresponding to a given list of base grid indices. | |
| bool | getEnableForceFeedback () const |
| agxCollide::Geometry * | getForceFeedbackGeometry () |
| agx::Vec2 | getForceFeedbackHeightFieldDimensions () const |
| Get the dimensions of the force feedback heightfield associated with the wheel. | |
| std::vector< agx::Int > | getGridCombinationGridIndicesForGroups (agx::Int combinationIndex, const std::vector< agx::Int > &groupIndices) const |
| Given a grid-combination index and a list of group indices, return the union of all base-grid indices** referenced by those groups. | |
| std::vector< agx::Int > | getGridCombinationGroupIndicesForOrigin (agx::Int combinationIndex) const |
| Return the group-index list used to determine the origin for a given grid combination. | |
| std::vector< agx::Int > | getGridCombinationGroupIndicesForReferenceNormal (agx::Int combinationIndex) const |
| Return the group-index list used to determine the reference normal for a given grid combination. | |
| std::vector< std::vector< agx::Int > > | getGridIndexListsForceFeedbackPlane () const |
| Retrieve the grid-index lists used for constructing the force-feedback plane. | |
| std::vector< std::vector< agx::Int > > | getGridIndexListsForGridCombinationIndex (agx::Int combinationIndex) const |
| Retrieve the grid-index lists associated with a given grid-combination index. | |
| std::vector< std::vector< agx::Int > > | getGridIndexListsFrontAnglePlane () const |
| Retrieve the grid-index lists used for constructing the front-angle plane. | |
| std::vector< std::vector< agx::Int > > | getGridIndexListsRearAndFrontAngleReferencePlane () const |
| Retrieve the grid-index lists for the rear-and-front angle reference plane. | |
| std::vector< std::vector< agx::Int > > | getGridIndexListsRearAnglePlane () const |
| Retrieve the grid-index lists used for constructing the rear-angle plane. | |
| agx::Vec3 | getGridOrigin (agx::Int planeIndex) const |
| Compute the origin point for a regression-plane group using the new regression-plane configuration system. | |
| agx::Vec3 | getGridOriginByName (agx::String name) const |
| Query the origin associated with a named regression-plane group using the new regression-plane configuration system. | |
| agx::Vec3 | getGridReferenceNormal (agx::Int planeIndex) const |
| Compute the reference normal for a regression-plane group using the new regression-plane configuration system. | |
| agx::Vec3 | getGridReferenceNormalByName (agx::String name) const |
| Query the reference normal associated with a named regression-plane group using the new regression-plane configuration system. | |
| bool | getPlanesInitialized () const |
| agx::Vec3 | getRegressionPlaneAveragedNormalByName (agx::String name) const |
| Get the averaged regression-plane normal for a named group. | |
| agx::Vec3 | getRegressionPlaneAveragePointByName (agx::String name) const |
| Get the averaged regression-plane average point for a named group. | |
| std::vector< agx::Vec3 > | getRegressionPlaneAveragePointsByName (agx::String name) const |
| Get all regression-plane average points for a named group. | |
| std::vector< agx::Int > | getRegressionPlaneIndicesByName (agx::String name) const |
| Resolve the list of unique regression-plane indices associated with a logical regression-plane name, using the grid-combination system. | |
| std::vector< agx::Vec3 > | getRegressionPlaneNormalsByName (agx::String name) const |
| Get all regression-plane normals for a named group. | |
| RegressionPlanesParameters * | getRegressionPlanesParameters () const |
| Get the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel. | |
| void | initializeRegressionPlanes () |
| Initialize all regression-plane structures using the grid-combination-based configuration. | |
| void | initializeRegressionPlanesGridPointsSet () |
| Initialize the per-grid template point sets used when constructing regression planes. | |
| void | initializeRegressionPlanesNameToRegressionPlaneIndices () |
| Build the name -> regression-plane indices map using the grid-combination-based configuration. | |
| void | initializeRegressionPlanesUniqueGridPointsCombinationsSet () |
| Build the unique grid-point combinations used by the regression-plane configuration. | |
| void | initializeRegressionPlanesValidGridPointsSetIndices () |
| Initialize the set of valid base-grid indices used by the new regression-plane pipeline. | |
| bool | isValid () const |
| void | onAdd (agxSDK::Simulation *simulation) |
| void | onRemove (agxSDK::Simulation *simulation) |
| bool | resolveGridCombinationConfigForPlaneName (const agx::String &name, agx::Int &combinationIndex, std::vector< agx::Int > &normalGroupIndices, std::vector< agx::Int > &originGroupIndices) const |
| Resolve the grid-combination configuration for a logical regression-plane name using the grid-combination system. | |
| void | setEnableForceFeedback (bool enable) const |
| void | setIsForceFeedbackHeightField (agxCollide::Geometry *geometry, bool enable) |
| Mark or unmark a geometry as a force feedback heightfield. | |
| void | setRegressionPlanesParameters (RegressionPlanesParameters *params) |
| Set the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel. | |
| void | showRegressionPlaneDebugText () |
| Display on-screen labels for the currently active regression-plane categories. | |
| void | updateForceFeedbackHeightField (const agx::Vec3 &normal, const agx::Vec3 &point, const agx::AffineMatrix4x4 &transform) |
| Update the transformation of the force feedback heightfield. | |
| bool | updateRearAndFrontAngles () |
| void | updateRegressionPlaneNormalsAndAveragePoints () |
| Compute and update cached regression-plane normals and average points, both per-plane and per named group. | |
| void | updateRegressionPlanesForwardSign () |
| Update the sign of the forward direction of the grid coordinate systems specifying the directions in which to place grid points. | |
| void | updateTerrainWheelPlane (bool &shouldUpdateMajorObjects, const agx::RealVector &weights) |
| void | updateUniqueRegressionPlanes () |
| Update all unique regression planes using the new regression-plane pipeline. | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Static Public Member Functions | |
| static bool | isForceFeedbackHeightField (const agxCollide::Geometry *geometry) |
| Check whether the given geometry is marked as a force feedback heightfield. | |
| static agx::String | planeNameToString (PlaneName plane) |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| TerrainWheelPlane () | |
| agxTerrain::TerrainWheelQuantities * | getQuantities () |
| agx::Real | getRadius () const |
| agxTerrain::TerrainWheelSettings * | getSettings () const |
| agx::Real | getTerrainElementSize () const |
| agx::Vec3 | getWheelPosition () const |
| agx::AffineMatrix4x4 | getWheelTransform () const |
| agx::Real | getWidth () const |
| void | setPlanesInitialized (bool enable) |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
The TerrainWheelPlane consists of the parts and logic that is necessary to create.
Definition at line 51 of file TerrainWheelPlane.h.
|
strong |
| Enumerator | |
|---|---|
| FORCE_FEEDBACK | |
| FRONT_ANGLE | |
| REAR_ANGLE | |
| REAR_AND_FRONT_ANGLE_REFERENCE | |
Definition at line 62 of file TerrainWheelPlane.h.
| agxTerrain::TerrainWheelPlane::TerrainWheelPlane | ( | TerrainWheel * | wheel, |
| RegressionPlanesParameters * | params | ||
| ) |
|
protected |
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::collectRegressionPlaneIndexGroups | ( | ) | const |
Collect all regression-plane groups that are required by the new regression-plane pipeline.
A "group" is a vector of base-grid indices belonging to a single entry inside a grid combination (i.e. one subgroup of 'gridCombinations[k]').
This method produces a flat list of such groups in an order consistent with how unique regression planes and name-to-plane mappings are built.
Processing steps:
Result:
The returned vector is a flattened list of all grid groups needed to construct:
This list ensures that all regression-plane groups required anywhere in the new system are fully accounted for.
| agxCollide::RegressionPlane agxTerrain::TerrainWheelPlane::computeRegressionPlane | ( | agx::Vec3Vector & | surfacePoints | ) |
Fit a regression plane from previously collected terrain surface points.
This method constructs an agxCollide::RegressionPlane from surfacePoints and verifies that the fitted result has planar dimension type.
If the fit does not produce a valid planar result, the returned regression plane will have a non-PLANE dimension type and a warning may be logged if PRINT_GENERAL_INFO is enabled.
| surfacePoints | World-space terrain surface points to use for the plane fit. |
| agx::Vec3Vector agxTerrain::TerrainWheelPlane::computeRegressionPlaneSurfacePoints | ( | agx::Vec3Vector & | positions, |
| std::size_t | index | ||
| ) |
Compute terrain surface sample points for a unique grid-point combination.
For the given unique plane index, this method:
positions: Optionally applies front/rear angle adaptation along the local x-axis, depending on the source grid's gridsIsAdaptToRearAndFrontAngles flag. Projects the point into world space from the grid origin using the forward and lateral axes. Samples the terrain height at that location. Adds the resulting world-space terrain surface point to the returned set.Points for which terrain height interpolation fails are skipped. Therefore, the returned vector may contain fewer points than positions. When debug rendering is enabled, the sampled surface points are rendered using the per-plane debug coloring rules.
| positions | Wheel-local template sampling points (x = longitudinal, y = lateral, z = 0) for the unique plane identified by index. The contents are used as input and are not modified. |
| index | Unique regression-plane index, used to look up reference normal, origin, source grid indices, and debug colors. |
| agx::Real agxTerrain::TerrainWheelPlane::computeScaledLength | ( | agx::Real | baseValue, |
| const RegressionPlanesParameters::GridScale & | scale | ||
| ) | const |
Compute a scaled length value based on a base value and a specified scale (see RegressionPlanesParameters::GridScale).
The scale determines which reference quantity the base value is multiplied by:
| baseValue | - The unscaled base value. |
| scale | - The scale specifier (see RegressionPlanesParameters::GridScale enum). |
| agx::AffineMatrix4x4 agxTerrain::TerrainWheelPlane::computeTransformForPlaneAtPlane | ( | const agx::Vec3 & | normal, |
| const agx::Vec3 & | point | ||
| ) |
Compute a transformation aligning a plane in world space.
This method constructs an affine transform that orients and positions a plane according to the provided normal and point. The resulting transform ensures that:
| normal | Reference normal defining the plane's orientation. |
| point | Center point of the plane in world coordinates. |
| agx::AffineMatrix4x4 agxTerrain::TerrainWheelPlane::computeTransformForPlaneAtWheel | ( | const agx::Vec3 & | normal, |
| const agx::Vec3 & | point | ||
| ) |
Compute a transformation aligning a plane relative to the wheel center.
This method constructs an affine transform based on the given plane normal and point, aligning the plane so that its normal passes through the wheel center. The resulting transform can be applied to orient and position the plane such that:
| normal | Reference normal defining the plane's orientation. |
| point | Point on the plane used as a reference for positioning. |
| agxCollide::HeightField * agxTerrain::TerrainWheelPlane::createForceFeedbackHeightField | ( | ) |
Create the force feedback heightfield.
This method instantiates a force feedback heightfield that serves as the analytical contact surface for computing wheel-terrain interaction forces. The heightfield is created once and subsequently updated in position and orientation by other methods to follow the wheel's motion over the terrain.
| forceFeedbackPlaneDimensions | The planar dimensions (X and Y extents) of the force feedback heightfield, specified in the wheel's local frame. |
| agxCollide::Geometry * agxTerrain::TerrainWheelPlane::createForceFeedbackPlane | ( | ) |
Create the geometry which is used for force feedback.
The geometry contains the height field shape.
| bool agxTerrain::TerrainWheelPlane::findGridCombinationAndGroupForPlaneIndex | ( | std::size_t | planeIndex, |
| agx::Int & | combinationIndex, | ||
| agx::Int & | groupIndex | ||
| ) | const |
Given the index of a unique regression plane, attempt to find which (combinationIndex, groupIndex) it corresponds to in the gridCombinations structure.
Each unique plane is defined by a group of base grid indices stored in: m_regressionPlanesData.uniqueGridPointsCombinationsSourceGridIndex[planeIndex].
Each grid combination is defined by groups of base grid indices stored in: gridCombinations[i][j].
Processing:
On success:
combinationIndex is set to igroupIndex is set to jOn failure:
combinationIndex = -1groupIndex = -1| planeIndex | Index into the unique regression-plane list. |
| combinationIndex | Output: matching index i in gridCombinations. |
| groupIndex | Output: matching group j in gridCombinations[i]. |
| agx::Int agxTerrain::TerrainWheelPlane::findRegressionPlaneIndexForBaseGridIndices | ( | const std::vector< agx::Int > & | baseGridIndices | ) | const |
Find the unique regression-plane index corresponding to a given list of base grid indices.
The input baseGridIndices is interpreted as a group of base grids (typically one of the inner vectors from gridCombinations[k]).
The function:
If no matching unique plane exists, or the normalized input is empty, the function returns -1.
| baseGridIndices | Raw list of base grid indices describing a plane group. |
| bool agxTerrain::TerrainWheelPlane::getEnableForceFeedback | ( | ) | const |
| agxCollide::Geometry * agxTerrain::TerrainWheelPlane::getForceFeedbackGeometry | ( | ) |
| agx::Vec2 agxTerrain::TerrainWheelPlane::getForceFeedbackHeightFieldDimensions | ( | ) | const |
Get the dimensions of the force feedback heightfield associated with the wheel.
The data used to compute these dimensions is stored in the member variable m_regressionPlanesParameters. The dimensions are returned along:
| std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGridIndicesForGroups | ( | agx::Int | combinationIndex, |
| const std::vector< agx::Int > & | groupIndices | ||
| ) | const |
Given a grid-combination index and a list of group indices, return the union of all base-grid indices** referenced by those groups.
A grid combination consists of several grid groups, where each group is a list of base grid indices (as configured in setRegressionPlanesGridCombinations). This method selects specific groups inside that combination and aggregates all their base-grid indices into a single deduplicated list.
Behavior:
Example: If: gridCombinations[k] = { {1}, {2,3,5}, {3,8} } and groupIndices = { 1, 2 } then the result is: { 2, 3, 5, 8 } (where the duplicate "3" from group 2 appears only once, and the order is kept).
| combinationIndex | Index of the grid combination whose groups will be inspected. |
| groupIndices | List of group indices (within the specified combination) indicating which groups' base-grid indices should be aggregated. |
| std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGroupIndicesForOrigin | ( | agx::Int | combinationIndex | ) | const |
Return the group-index list used to determine the origin for a given grid combination.
Each combined regression-plane configuration may define which plane's computed origin (aggregated regression center point) should be used for each of its grid groups. These values are configured via setRegressionPlanesGridCombinationsIndicesOrigin().
Meaning of returned values:
Behavior:
| combinationIndex | The index of the grid combination whose origin-selection indices should be retrieved. |
| std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getGridCombinationGroupIndicesForReferenceNormal | ( | agx::Int | combinationIndex | ) | const |
Return the group-index list used to determine the reference normal for a given grid combination.
Each combined regression-plane configuration may contain multiple grid groups. For each group, a reference-normal source index is configured via setRegressionPlanesGridCombinationsIndicesReferenceNormal(). This method retrieves that list of indices for the specified combination.
Meaning of returned values:
Behavior:
| combinationIndex | The index of the grid combination whose reference-normal group indices should be retrieved. |
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsForceFeedbackPlane | ( | ) | const |
Retrieve the grid-index lists used for constructing the force-feedback plane.
This is a convenience wrapper around getGridIndexListsForGridCombinationIndex(), automatically using the configured grid-combination index for the force-feedback plane.
The force-feedback plane is the plane that interacts physically with the wheel (contact, forces, torques), and its grid-combination definition determines which underlying regression-plane grids contribute to its construction.
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsForGridCombinationIndex | ( | agx::Int | combinationIndex | ) | const |
Retrieve the grid-index lists associated with a given grid-combination index.
Each grid combination (configured via setRegressionPlanesGridCombinations) consists of one or more grid groups, where each group is a list of grid indices that should be aggregated together when constructing a combined regression plane.
This method returns those grid groups for the specified combination index.
Behavior:
Example: If 'gridCombinations[3] == { {1}, {2,3,5} }', then calling this method with '3' returns: { {1}, {2,3,5} }
| combinationIndex | The index into the regression-plane grid combination list. |
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsFrontAnglePlane | ( | ) | const |
Retrieve the grid-index lists used for constructing the front-angle plane.
This is a convenience wrapper around getGridIndexListsForGridCombinationIndex(), using the configured grid-combination index for the front-angle plane.
The front-angle plane is used to determine the wheel's front pitch angle by examining its regression-plane normal.
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsRearAndFrontAngleReferencePlane | ( | ) | const |
Retrieve the grid-index lists for the rear-and-front angle reference plane.
This wrapper uses getGridIndexListsForGridCombinationIndex() with the configured index for the plane that provides the reference normal used when computing both the rear and front wheel angles.
This plane does not necessarily participate directly in force feedback, but provides the reference orientation against which the angle planes are measured.
| std::vector< std::vector< agx::Int > > agxTerrain::TerrainWheelPlane::getGridIndexListsRearAnglePlane | ( | ) | const |
Retrieve the grid-index lists used for constructing the rear-angle plane.
This wraps getGridIndexListsForGridCombinationIndex(), selecting the grid-combination index assigned to the rear-angle plane.
The rear-angle plane defines the wheel's rear pitch angle, using its regression-plane normal for angle computation.
Compute the origin point for a regression-plane group using the new regression-plane configuration system.
This method determines the correct origin for the plane identified by 'planeIndex' using:
Behavior overview:
The method then consults 'gridCombinationsIndicesOrigin[combinationIndex][groupIndex]' to determine which referenced combination should supply the origin.
Interpretation of the referenced value:
Configuration errors:
| planeIndex | The global unique index of the regression plane whose origin should be computed. |
| agx::Vec3 agxTerrain::TerrainWheelPlane::getGridOriginByName | ( | agx::String | name | ) | const |
Query the origin associated with a named regression-plane group using the new regression-plane configuration system.
A regression-plane "name" (e.g. '"force_feedback_plane"', '"front_angle_plane"', etc.) may correspond to multiple plane indices. This method:
Fallback behavior:
| name | The name identifying one or more regression-plane groups. |
Compute the reference normal for a regression-plane group using the new regression-plane configuration system.
This method determines the correct reference normal for the plane identified by 'planeIndex' using:
The reference normal is used as the "up direction" when constructing a grid orientation basis for the plane.
Behavior overview:
The method consults 'gridCombinationsIndicesReferenceNormal[combinationIndex][groupIndex]' to determine which referenced combination should supply the normal.
Interpretation:
Configuration errors:
| planeIndex | The global unique index of the regression plane whose reference normal should be computed. |
| agx::Vec3 agxTerrain::TerrainWheelPlane::getGridReferenceNormalByName | ( | agx::String | name | ) | const |
Query the reference normal associated with a named regression-plane group using the new regression-plane configuration system.
A regression-plane "name" may correspond to multiple plane indices. This method:
Fallback behavior:
| name | The name identifying one or more regression-plane groups. |
| bool agxTerrain::TerrainWheelPlane::getPlanesInitialized | ( | ) | const |
|
protected |
|
protected |
| agx::Vec3 agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragedNormalByName | ( | agx::String | name | ) | const |
Get the averaged regression-plane normal for a named group.
The name is resolved to a list of unique regression-plane indices, and a group key is constructed from those indices. This method then:
1) Looks up a cached averaged normal in m_regressionPlanesData.groupKeyToAveragedNormal. 2) If present, returns the cached value. 3) Otherwise, accumulates per-plane normals from m_regressionPlanesData.uniquePlaneNormals, computes their arithmetic mean, and normalizes the result.
If no valid normals are available, the returned vector is (0,0,0).
| name | Logical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"). |
| agx::Vec3 agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragePointByName | ( | agx::String | name | ) | const |
Get the averaged regression-plane average point for a named group.
For the set of plane indices associated with name, this method:
1) Builds a group key and checks the cache m_regressionPlanesData.groupKeyToAveragedAveragePoint. 2) If a cached averaged point exists, returns it. 3) Otherwise, sums the per-plane average points taken from m_regressionPlanesData.uniquePlaneAveragePoints and divides by the number of contributing planes.
If no valid average points are available, the method returns (0,0,0).
| name | Logical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"). |
| std::vector< agx::Vec3 > agxTerrain::TerrainWheelPlane::getRegressionPlaneAveragePointsByName | ( | agx::String | name | ) | const |
Get all regression-plane average points for a named group.
The name is resolved to a list of unique regression-plane indices via getRegressionPlaneIndicesByName(). For that index set, this method:
1) Builds a stable group key (comma-separated indices). 2) Checks the cache m_regressionPlanesData.groupKeyToAveragePoints. 3) If a cached entry is found, returns it. 4) Otherwise, collects the per-plane average points from m_regressionPlanesData.uniquePlaneAveragePoints and returns them as a new vector.
Each average point is the centroid of the corresponding regression plane's sampled contact points.
| name | Logical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"). |
| std::vector< agx::Int > agxTerrain::TerrainWheelPlane::getRegressionPlaneIndicesByName | ( | agx::String | name | ) | const |
Resolve the list of unique regression-plane indices associated with a logical regression-plane name, using the grid-combination system.
Steps:
If no valid planes can be resolved for the given name, the function reports a LOGGER_WARNING and returns an empty vector.
| name | Logical plane name: "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane". |
| std::vector< agx::Vec3 > agxTerrain::TerrainWheelPlane::getRegressionPlaneNormalsByName | ( | agx::String | name | ) | const |
Get all regression-plane normals for a named group.
The name is resolved to a list of unique regression-plane indices via getRegressionPlaneIndicesByName(). For that index set, this method:
1) Builds a stable group key (comma-separated list of indices). 2) Looks up a cached vector of normals in m_regressionPlanesData.groupKeyToNormals. 3) If a cached entry exists, returns it directly. 4) Otherwise, gathers per-plane normals from m_regressionPlanesData.uniquePlaneNormals and returns them as a new vector.
The normals are unit-length vectors in world coordinates.
| name | Logical group name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"). |
| RegressionPlanesParameters * agxTerrain::TerrainWheelPlane::getRegressionPlanesParameters | ( | ) | const |
Get the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| void agxTerrain::TerrainWheelPlane::initializeRegressionPlanes | ( | ) |
Initialize all regression-plane structures using the grid-combination-based configuration.
This is the master entry point for the regression-plane initialization pipeline. It performs:
1) initializeRegressionPlanesValidGridPointsSetIndices()
2) initializeRegressionPlanesGridPointsSet()
3) initializeRegressionPlanesUniqueGridPointsCombinationsSet()
4) initializeRegressionPlanesNameToRegressionPlaneIndices()
This function defines the complete initialization sequence for the regression-plane system.
| void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesGridPointsSet | ( | ) |
Initialize the per-grid template point sets used when constructing regression planes.
For each grid index listed in m_regressionPlanesData.validGridPointsSetIndices, this method constructs a wheel-local XY template of sampling points (z = 0), stored in: m_regressionPlanesData.gridPointsSet[gi]
All other grid indices remain empty.
Details:
Shape Each grid must specify "rectangle" or "ellipse" in gridsShape[gi]. Any other value causes a runtime error. Resolution (Nx, Ny) Taken from gridsNumGridPoints[gi], clamped to >= 1. Center (cx, cy) Read from gridsCenterPoint[gi] and scaled using gridsCenterPointScale[gi] via computeScaledLength(). Step Size (dx, dy) Read from gridsStepSize[gi] and scaled using gridsStepSizeScale[gi]. Non-positive values default to m_terrainElementSize. Point Generation Points lie on an (Nx * Ny) lattice centered at (cx, cy). For "ellipse", points outside the inscribed ellipse are discarded. A small epsilon is added to ellipse radii to ensure axis-aligned lattice points are included and degenerate cases work cleanly.
Preconditions: initializeRegressionPlanesValidGridPointsSetIndices() has been run, so validGridPointsSetIndices contains a validated set of grid indices.
Postconditions: For each valid grid index gi, gridPointsSet[gi] contains the complete set of wheel-frame XY sampling points (z = 0).
| void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesNameToRegressionPlaneIndices | ( | ) |
Build the name -> regression-plane indices map using the grid-combination-based configuration.
This function constructs the internal mapping from plane names (e.g. "force_feedback_plane", "front_angle_plane", etc.) to lists of regression-plane indices, using:
Processing steps:
1) Collect all raw base-grid index groups via collectRegressionPlaneIndexGroups().
2) Normalize each group by:
3) Deduplicate the normalized groups while preserving first-seen order. Each deduplicated group becomes one "unique regression plane."
4) For each named plane type, obtain its grid-index groups using the getters:
Normalize each target group and map it to its corresponding unique-plane index.
The results are written to:
m_regressionPlanesData.nameToPlaneIndices
and the mapping is marked as valid.
| void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesUniqueGridPointsCombinationsSet | ( | ) |
Build the unique grid-point combinations used by the regression-plane configuration.
Each "group" is a list of base-grid indices belonging to one regression plane (from gridCombinations). This function builds the combined set of sampling points for each unique group.
Processing steps:
1) Collect raw index groups using collectRegressionPlaneIndexGroups().
2) For each group:
3) For each unique group, construct its combined point set:
4) Store results in:
These represent the complete combined sampling sets for all regression planes defined by the configuration.
| void agxTerrain::TerrainWheelPlane::initializeRegressionPlanesValidGridPointsSetIndices | ( | ) |
Initialize the set of valid base-grid indices used by the new regression-plane pipeline.
This function interprets 'gridCombinations' as the complete and authoritative description of which base regression-plane grids are used anywhere in the new system.
Processing steps:
The final set is stored in 'm_regressionPlanesData.validGridPointsSetIndices'.
Note: This function is not yet used in the legacy initialization pipeline. It is a helper for future systems based exclusively on the new regression-plane configuration.
|
static |
Check whether the given geometry is marked as a force feedback heightfield.
This method queries the tagging state of a geometry to determine if it is registered as part of the force feedback system. Such geometries are used in specialized contact processing between the terrain and wheel to compute reaction and deformation forces. Regular geometries return false.
| geometry | Pointer to the AGX collision geometry to check. |
| bool agxTerrain::TerrainWheelPlane::isValid | ( | ) | const |
| void agxTerrain::TerrainWheelPlane::onAdd | ( | agxSDK::Simulation * | simulation | ) |
| void agxTerrain::TerrainWheelPlane::onRemove | ( | agxSDK::Simulation * | simulation | ) |
|
static |
| bool agxTerrain::TerrainWheelPlane::resolveGridCombinationConfigForPlaneName | ( | const agx::String & | name, |
| agx::Int & | combinationIndex, | ||
| std::vector< agx::Int > & | normalGroupIndices, | ||
| std::vector< agx::Int > & | originGroupIndices | ||
| ) | const |
Resolve the grid-combination configuration for a logical regression-plane name using the grid-combination system.
This method identifies which entry in:
On success:
combinationIndex is set to the selected grid-combination index.normalGroupIndices is filled with the group indices inside that combination that supply the reference-normal information.originGroupIndices is filled with the group indices inside that combination that supply the origin-point information.If the name does not correspond to a configured regression-plane category, or if the associated combination index is negative, the function returns false and all outputs are cleared.
| name | Logical plane name: "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane". |
| combinationIndex | Output: grid-combination index (>= 0 on success, -1 on failure). |
| normalGroupIndices | Output: group indices for normal computation. |
| originGroupIndices | Output: group indices for origin computation. |
| void agxTerrain::TerrainWheelPlane::setEnableForceFeedback | ( | bool | enable | ) | const |
| void agxTerrain::TerrainWheelPlane::setIsForceFeedbackHeightField | ( | agxCollide::Geometry * | geometry, |
| bool | enable | ||
| ) |
Mark or unmark a geometry as a force feedback heightfield.
This method tags the given geometry as participating in the force feedback system. When enabled, the geometry is recognized during contact processing and treated as a special heightfield for generating terrain-wheel interaction forces. When disabled, the geometry is excluded from such processing and behaves as a regular collision object.
| geometry | Pointer to the AGX collision geometry to tag or untag as a force feedback heightfield. |
| enable | True to mark the geometry as a force feedback heightfield, false to remove the tag. |
|
protected |
| void agxTerrain::TerrainWheelPlane::setRegressionPlanesParameters | ( | RegressionPlanesParameters * | params | ) |
Set the paramaters that control how regression planes are generated, combined, and updated each timestep to represent the terrain under the wheel.
| void agxTerrain::TerrainWheelPlane::showRegressionPlaneDebugText | ( | ) |
Display on-screen labels for the currently active regression-plane categories.
When the RENDER_REGRESSION_PLANES option is enabled, this function renders a small legend overlay that associates each plane category with the color used for its debug geometry. The following categories are drawn:
For each regression-plane category, all plane indices associated with its name are obtained via getRegressionPlaneIndicesByName(...), and one label per plane is drawn using that plane's debug color triplet.
Text is laid out from the lower-left corner of the screen and stacked downward with a fixed vertical spacing. This function does not modify the simulation state; it only affects debug UI output.
| void agxTerrain::TerrainWheelPlane::updateForceFeedbackHeightField | ( | const agx::Vec3 & | normal, |
| const agx::Vec3 & | point, | ||
| const agx::AffineMatrix4x4 & | transform | ||
| ) |
Update the transformation of the force feedback heightfield.
This method reorients and repositions the force feedback heightfield so that it follows the wheel's motion and maintains correct alignment with the local terrain surface. The heightfield rotates together with the wheel.
The heightfield's center point is computed as: c_ff = c_w - ((c_w - point) * normal) * normal which represents the projection of the wheel center onto the heightfield along the heightfield normal.
| normal | Reference normal used to align the heightfield's orientation. |
| point | Point on the force feedback heightfield used to position it in space. |
| transform | Transform to update the force feedback heightfield with. |
| bool agxTerrain::TerrainWheelPlane::updateRearAndFrontAngles | ( | ) |
| void agxTerrain::TerrainWheelPlane::updateRegressionPlaneNormalsAndAveragePoints | ( | ) |
Compute and update cached regression-plane normals and average points, both per-plane and per named group.
This method operates on the current set of unique regression planes in m_regressionPlanesData.uniquePlanes and the name-to-plane index mapping in m_regressionPlanesData.nameToPlaneIndices (built by initializeRegressionPlanesNameToRegressionPlaneIndices()).
It performs two levels of caching:
1) Per-plane caches:
2) Per-group caches (group of plane indices): For each distinct index set associated with any plane name (e.g. "force_feedback_plane", "front_angle_plane", "rear_angle_plane", "rear_and_front_angle_reference_plane"):
These caches support efficient access patterns for querying per-plane and per-group regression-plane properties in subsequent steps and debug rendering.
| void agxTerrain::TerrainWheelPlane::updateRegressionPlanesForwardSign | ( | ) |
Update the sign of the forward direction of the grid coordinate systems specifying the directions in which to place grid points.
These grid points are used to compute regression planes.
Assume (world coordinates) that the wheel axis is Y and that the wheel moves linearly in the positive x-direction and that, at that point, a particular regression plane is to the right of the wheel. If the wheel then starts to move in the negative x-direction, then that plane will be to the left of the wheel due to the flipped forward sign.
Also, the forward sign updated by this method is used to determine which angle should be the front angle and which should be the rear angle.
| void agxTerrain::TerrainWheelPlane::updateTerrainWheelPlane | ( | bool & | shouldUpdateMajorObjects, |
| const agx::RealVector & | weights | ||
| ) |
| void agxTerrain::TerrainWheelPlane::updateUniqueRegressionPlanes | ( | ) |
Update all unique regression planes using the new regression-plane pipeline.
This method recomputes the regression plane for each unique grid-point combination in m_regressionPlanesData.uniqueGridPointsCombinationsSet and stores the results in m_regressionPlanesData.uniquePlanes.
For each combination:
If no terrains are currently in contact, the function skips all computation for this step (optionally printing a debug message when PRINT_GENERAL_INFO is enabled).
| agxTerrain::TerrainWheelPlane::AGXTERRAIN_TERRAINWHEEL_STORE_RESTORE_INTERFACE |
Definition at line 110 of file TerrainWheelPlane.h.
| agxCollide::GeometryRef agxTerrain::TerrainWheelPlane::m_forceFeedbackGeometry {nullptr} |
Definition at line 1356 of file TerrainWheelPlane.h.
| agxCollide::HeightFieldRef agxTerrain::TerrainWheelPlane::m_forceFeedbackHeightField {nullptr} |
Definition at line 1353 of file TerrainWheelPlane.h.
| agx::Vec2 agxTerrain::TerrainWheelPlane::m_forceFeedbackHeightFieldDimensions |
Definition at line 1350 of file TerrainWheelPlane.h.
| bool agxTerrain::TerrainWheelPlane::m_initialized |
Definition at line 1346 of file TerrainWheelPlane.h.
| RegressionPlanesData agxTerrain::TerrainWheelPlane::m_regressionPlanesData |
Definition at line 1396 of file TerrainWheelPlane.h.
| agx::Int agxTerrain::TerrainWheelPlane::m_regressionPlanesForwardSign = 1 |
Definition at line 1366 of file TerrainWheelPlane.h.
| bool agxTerrain::TerrainWheelPlane::m_regressionPlanesHaveValidContactFrame {false} |
Definition at line 1363 of file TerrainWheelPlane.h.
| RegressionPlanesParametersRef agxTerrain::TerrainWheelPlane::m_regressionPlanesParameters |
Definition at line 1347 of file TerrainWheelPlane.h.
| TerrainWheel* agxTerrain::TerrainWheelPlane::m_wheel |
Definition at line 1345 of file TerrainWheelPlane.h.