25. OpenPLX for AGX Dynamics

OpenPLX is a high-level modeling language designed to work seamlessly with AGX Dynamics. It provides a structured approach to defining physics simulations, allowing users to create and configure rigid bodies, constraints, motors, friction models, and more in a human-readable format.

By leveraging AGX Dynamics, OpenPLX enables the simulation of complex mechanical systems, vehicles, robotics, and deformable terrains with minimal effort.

This page explains how OpenPLX interacts with AGX Dynamics and provides a structured way to define physics simulations. For a complete overview of OpenPLX Syntax and Bundles, consult the OpenPLX Documentation.

25.1. How OpenPLX Works with AGX Dynamics

OpenPLX acts as an interface layer for AGX Dynamics, converting structured OpenPLX definitions into AGX simulation components. When you load an OpenPLX file, it is transformed into an AGX Dynamics simulation tree, allowing for efficient physics-based interactions.

This means:

  1. OpenPLX describes the physics setup and the scene.

  2. The AGX Dynamics engine executes the simulation.

  3. Users can interact with the scene through OpenPLX files.

  4. Python controllers interact by sending or receiving OpenPLX signals.

25.2. Simulating an OpenPLX File in AGX Viewer

To simulate an .openplx file with AGX Dynamics, pass it to agxViewer like you would with an .agx file:

agxViewer myModel.openplx

25.3. Importing an AGX File in OpenPLX

AGX .agx files contain pre-defined physics models. OpenPLX supports seamless integration of AGX models into simulation systems.

  1. The AGX Model describes the basic physics setup, including rigid bodies, constraints, collision geometries and visuals.

  2. OpenPLX imports the AGX model and augments it with additional components, such as tracks and a drivetrain.

  3. OpenPLX describes the complete simulation scene.

  4. Controller scripts (python/C++) connects the OpenPLX model to the desired control systems.

  5. The AGX Dynamics engine executes the simulation.

25.3.1. Syntax for Importing an AGX File

To import an .agx file into OpenPLX, use the following OpenPLX syntax:

import @"model.agx" as AGXModel

Scene is Physics3D.System:
  my_model is AGXModel

The imported AGX model (AGXModel) can now be referenced within OpenPLX.

To load the OpenPLX scene and view the AGX model, use:

agxViewer scene.openplx -p

25.3.2. Viewing an AGX File as an OpenPLX Model

You can open an AGX file to find the components you need to reference using the anytoopenplx command:

python -m agxPythonModules.openplx.anytoopenplx model.agx > model_reference.openplx

Use this file to identify signals and components to reference when augmenting your model with additional OpenPLX components.

Note

At the moment, the models generated OpenPLX file will duplicate the content of the agx file, creating a conflict when running the simulation. To accomodate this, change the file extension of the new .openplx file to .txt, or place it outside the root folder of your OpenPLX bundle.

25.4. OpenPLX Tutorials

Explore the OpenPLX Tutorials to get started with OpenPLX for AGX Dynamics.

25.5. AGX Annotations

Table 25.1 AGX Parameters

Annotation

Description

Type

agx_relaxation_time

Directly set the AGX Dampling.
Applies to: Physics3D.Interactions.Mate

Real

agx_solve_type

Set the AGX Solve type for a constraint.
Applies to Physics3D.Interactions.Mate
Accepted values "DIRECT" | "DIRECT_AND_ITERATIVE" | "ITERATIVE"

String

agx_friction_solve_type

Sets the AGX Solve type for the fricion model.
Applies to Physics.Interactions.Dissipation.DefaultDissipation
Accepted values "SPLIT" | "DIRECT" | "DIRECT_AND_ITERATIVE" | "ITERATIVE"

String

agx_approximate_cone_friction

Enables AGX approximate cone friction.

Bool

agx_terrain_material

Sets an AGX terrain material preset.
Applies to Terrain.TerrainMaterial

String

agx_actuator_internal_inertia

Sets the internal inertia of the input shaft of a agxPowerLine::RotationalActuator or the internal mass of the input rod of a agxPowerLine::TranslationalActuator.
Applies to DriveTrain.HingeActuator and DriveTrain.PrismaticActuator

Real

agx_observer_frame

Maps a Physics3D.Charges.MateConnector to a agx::ObserverFrame.
Applies to Physics3D.Charges.MateConnector

Bool

agx_debug_render_frame

Renders the axes of a Physics3D.Charges.MateConnector, also maps it to a agx::ObserverFrame.
Applies to Physics3D.Charges.MateConnector

Bool

25.6. AGX Track Annotations

The following annotations can be applied to a Vehicles.Tracks.System to set AGX internal track properties.

Table 25.2 AGX Track Annotations

Annotation

Description

Type

agx_track_node_wheel_overlap

setTransformNodesToWheelsOverlap

Real

agx_track_on_initialize_merge_nodes_to_wheels

setEnableOnInitializeMergeNodesToWheels

Bool

agx_track_on_initialize_transform_nodes_to_wheels

setEnableOnInitializeTransformNodesToWheels

Bool

agx_track_hinge_range_lower, agx_track_hinge_range_upper

setHingeRangeRange

Real

agx_track_hinge_compliance

setHingeCompliance

Real

agx_track_hinge_relaxation_time

setHingeDamping

Real

agx_track_stabilizing_friction_parameter

setStabilizingHingeFrictionParameter

Real

agx_track_min_stabilizing_normal_force

setMinStabilizingHingeNormalForce

Real

agx_track_node_wheel_merge_threshold

setNodesToWheelsMergeThreshold

Real

agx_track_node_wheel_split_threshold

setNodesToWheelsSplitThreshold

Real

agx_track_num_nodes_in_average_direction

setNumNodesIncludedInAverageDirection

Int

agx_set_enable_merge

setEnableMerge

Bool

agx_set_contact_reduction

setContactReduction
Accepts: "NONE" | "MINIMAL" | "MODERATE" | "AGGRESSIVE"

String

agx_set_enable_lock_to_reach_merge_condition

setEnableLockToReachMergeCondition

Bool

agx_set_lock_to_reach_merge_condition_compliance

setLockToReachMergeConditionCompliance

Real

agx_set_lock_to_reach_merge_condition_relaxation_time

setLockToReachMergeConditionDamping

Real

agx_set_num_nodes_per_merge_segment

setNumNodesPerMergeSegment

Int

25.7. AGX Plugin Annotations

When importing a .agx file there are a few annotations that change the import behavior.

Table 25.3 AGX Plugin Annotations

Annotation

Description

Type

discard_rigid_body_positions

Discards all position information for rigid bodies if set to true, allowing SNAP to reposition them.

Bool

regenerate_shape_uuids

Setting this to true will create new UUIDs for all AGX shapes. This is useful when importing the same .agx file twice.

Bool

material_naming_rule

Controls how imported materials will be named. This can be necessary to avoid collisions since materials are always put in a global scope.

Accepted values

"UUID" sets the material unique_name to the AGX UUID.

"OPENPLX_NAME" sets the material unique_name to the OpenPLX name.

"AGX_NAME" (default) sets the material unique_name to the AGX name.

If UUIDs are not unique, try "OPENPLX_NAME" together with a namespace to generate unique names.

String