AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxUtil::ReconfigureRequest Class Reference

This class can be used to compute transforms for a collection of constrained bodies given a set of positions for the constraint angles. More...

#include <ReconfigureRequest.h>

Public Member Functions

 ReconfigureRequest ()
 
 ~ReconfigureRequest ()
 
void applyTransforms (agxSDK::Collection *collection, const agxUtil::ConstraintPositionVector &positions, agxUtil::BodyTransformVector &transforms, bool zeroVelocities=true)
 This method applies the results from computeTransforms by updating body transforms.
 
bool computeTransforms (const agxSDK::Collection *collection, const agx::RigidBody *referenceBody, const agxUtil::ConstraintPositionVector &positions, agxUtil::BodyTransformVector &results, agx::Real *maxViolation=nullptr, bool includeGeometry=false, size_t additionalSteps=0)
 Compute new transforms for items in the input collection.
 
agx::String getErrorMessage () const
 Return textual description of problem if computeTransforms returned false.
 

Detailed Description

This class can be used to compute transforms for a collection of constrained bodies given a set of positions for the constraint angles.

Warning
All simulation features in AGX are not supported and there are some limitations.
     Wires are not supported. A change of pose for a mechanical structure
     could lead to the wire coming in contact with geometry, new contact nodes added,
     leading to resolution changes and this does not fit well with the output format for
     the computed results. It is recommended to remove the wire(s), reconfigure the machine and
     then add wires again so they can be re-routed.

     PowerLine related components can be affected by sudden transform changes and constraint positional-
     and rotational values being changed. The main thing to pay attention to are position of hydraulic pistons
     and the possible change to the constraint the piston drives.
The computed results should not be applied blindly. Depending on the mechanical structure and changes to the constraint positions, there can be needed post operations that are needed to keep the simulation in a good state:
  • Handling of motors with 0 speed and setLockedAtZero.
  • Winding number for hinges when changing angle multiple times when ranges are also in use.

Definition at line 95 of file ReconfigureRequest.h.

Constructor & Destructor Documentation

◆ ReconfigureRequest()

agxUtil::ReconfigureRequest::ReconfigureRequest ( )

◆ ~ReconfigureRequest()

agxUtil::ReconfigureRequest::~ReconfigureRequest ( )

Member Function Documentation

◆ applyTransforms()

void agxUtil::ReconfigureRequest::applyTransforms ( agxSDK::Collection collection,
const agxUtil::ConstraintPositionVector positions,
agxUtil::BodyTransformVector transforms,
bool  zeroVelocities = true 
)

This method applies the results from computeTransforms by updating body transforms.

To maintain a stable simulation and reduce risk of artifacts after the instant modification of transforms, additional steps are also performed.

  • Hinges which had new joint positions requested in the input positions vector will have their winding number checked and corrected if needed.
  • Constraints in the input positions vector that had Lock controllers enabled will have them disabled and instead motor with 0 speed enabled.
  • All constraints part of the input collection will be checked to avoid an old position being used by a motor controllers if setLockedAtZero is enabled.
Warning
This method can perform additional steps to help with maintaining a good state after updating the body transforms, but only for features supported by ReconfigureRequest that also are in the agxPhysics shared library.

Therefore extra handling can be needed by the user even if this method is used. One such example is when hydraulics is used with PistonActuators. If the constraint connected to the piston have its position changed when body transforms are updated, then there will be a mismatch between the hydraulic cylinder and the body state. An example of how this can be adjusted by updating fluid in the piston chambers is available in the python tutorial tutorial_machine_reconfiguration.agxPy.

◆ computeTransforms()

bool agxUtil::ReconfigureRequest::computeTransforms ( const agxSDK::Collection collection,
const agx::RigidBody referenceBody,
const agxUtil::ConstraintPositionVector positions,
agxUtil::BodyTransformVector results,
agx::Real maxViolation = nullptr,
bool  includeGeometry = false,
size_t  additionalSteps = 0 
)

Compute new transforms for items in the input collection.

The computations are performed so that the specified referenceBody, which must be part of the collection, is treated as static and will not move.

Which body that is used for reference affects the result. For example, in a machine with waist steering, the result will be different for the same waist angle if the reference body is in the front- or back section of the machine.

How the mechanical structure should change is specified in the positions vector. The elements in the vector consists of (constraint, angle_index, angle_value) having the desired position for the joints. The angle index is 0 in most cases, for example for hinge and prismatic where there is only one degree of freedom to control. For other constraints, such as cylindrical, the index can take a non-zero value.

The new state is then computed by using copies of the input items. Constraint controllers are used to reach the new state.

Note
Similar result as this method computes can be achieved by setting suitable values on constraint motors and simulating forward and then reading the actual body transforms. This method also uses constraint controllers, but on copies of the input bodies and constraints. The advantage here is that just parts of the scene is included giving the benefits that:
  • Faster to simulate just part of the scene
  • No need to "freeze" parts of the simulation that should be unaffected.
  • Current timestamp in the simulation does not change
Parameters
collectionThe bodies and constraint making up the structure that should have a new configuration
referenceBodyThis body will be kept fixed when performing the movements.
positionsVector with constraint positions.
resultsVector with (body,transform) pairs.
maxViolationOptional output of largest constraint violation found at new pose.
includeGeometryIf geometry should be included in the copies and used in the computations.
additionalStepsUser configurable number of extra steps to take when moving non-stiff structures. Increases computation time, but improves results for e.g cables.

◆ getErrorMessage()

agx::String agxUtil::ReconfigureRequest::getErrorMessage ( ) const

Return textual description of problem if computeTransforms returned false.


The documentation for this class was generated from the following file: