![]() |
AGX Dynamics 2.40.0.0
|
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. | |
This class can be used to compute transforms for a collection of constrained bodies given a set of positions for the constraint angles.
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.
Definition at line 95 of file ReconfigureRequest.h.
agxUtil::ReconfigureRequest::ReconfigureRequest | ( | ) |
agxUtil::ReconfigureRequest::~ReconfigureRequest | ( | ) |
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.
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.
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.
collection | The bodies and constraint making up the structure that should have a new configuration |
referenceBody | This body will be kept fixed when performing the movements. |
positions | Vector with constraint positions. |
results | Vector with (body,transform) pairs. |
maxViolation | Optional output of largest constraint violation found at new pose. |
includeGeometry | If geometry should be included in the copies and used in the computations. |
additionalSteps | User configurable number of extra steps to take when moving non-stiff structures. Increases computation time, but improves results for e.g cables. |
agx::String agxUtil::ReconfigureRequest::getErrorMessage | ( | ) | const |
Return textual description of problem if computeTransforms returned false.