agx-openplx 0.15.0__cp39-cp39-macosx_12_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agx_openplx-0.15.0.dist-info/METADATA +231 -0
- agx_openplx-0.15.0.dist-info/RECORD +41 -0
- agx_openplx-0.15.0.dist-info/WHEEL +4 -0
- agx_openplx-0.15.0.dist-info/entry_points.txt +8 -0
- openplx/Core.py +7781 -0
- openplx/DriveTrain.py +8574 -0
- openplx/Math.py +5372 -0
- openplx/Physics.py +36195 -0
- openplx/Physics1D.py +6732 -0
- openplx/Physics3D.py +42524 -0
- openplx/Robotics.py +15762 -0
- openplx/Simulation.py +1056 -0
- openplx/Terrain.py +3891 -0
- openplx/Urdf.py +654 -0
- openplx/Vehicles.py +8793 -0
- openplx/Visuals.py +3901 -0
- openplx/_AgxOpenPlxPyApi.cpython-39-darwin.so +0 -0
- openplx/_CorePythonSwig.cpython-39-darwin.so +0 -0
- openplx/_DriveTrainSwig.cpython-39-darwin.so +0 -0
- openplx/_MathSwig.cpython-39-darwin.so +0 -0
- openplx/_Physics1DSwig.cpython-39-darwin.so +0 -0
- openplx/_Physics3DSwig.cpython-39-darwin.so +0 -0
- openplx/_PhysicsSwig.cpython-39-darwin.so +0 -0
- openplx/_RoboticsSwig.cpython-39-darwin.so +0 -0
- openplx/_SimulationSwig.cpython-39-darwin.so +0 -0
- openplx/_TerrainSwig.cpython-39-darwin.so +0 -0
- openplx/_UrdfSwig.cpython-39-darwin.so +0 -0
- openplx/_VehiclesSwig.cpython-39-darwin.so +0 -0
- openplx/_VisualsSwig.cpython-39-darwin.so +0 -0
- openplx/__init__.py +51 -0
- openplx/agxtoopenplx.py +55 -0
- openplx/anytoopenplx.py +44 -0
- openplx/api.py +1337 -0
- openplx/migrate.py +136 -0
- openplx/migration_hint.py +14 -0
- openplx/migrations.py +521 -0
- openplx/openplx_application.py +133 -0
- openplx/openplx_serialize.py +35 -0
- openplx/openplx_validate.py +57 -0
- openplx/openplx_view.py +14 -0
- openplx/versionaction.py +11 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
openplx/__init__.py
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# pylint: disable=C0103 # name doesn't conform to snake_case naming style
|
2
|
+
"""
|
3
|
+
__init__ module for OpenPLX package
|
4
|
+
"""
|
5
|
+
import os
|
6
|
+
import sys
|
7
|
+
__AGXVERSION__ = "2.38.0.2"
|
8
|
+
__version__ = "0.15.0"
|
9
|
+
|
10
|
+
# pylint doesn't like bare excepts, but we need to catch all exceptions here
|
11
|
+
# pylint: disable=W0702 # bare-except
|
12
|
+
# pylint doesn't like below errors which is normally ok, but this file is copied to the right place during build
|
13
|
+
# pylint: disable=E0402 # Attempted relative import beyond top-level
|
14
|
+
# pylint: disable=E0611 # Missing name in module
|
15
|
+
# pylint: disable=W0611 # Unused import
|
16
|
+
# pylint: disable=W0401 # Wildcard import
|
17
|
+
|
18
|
+
try:
|
19
|
+
import agx
|
20
|
+
if agx.__version__ != __AGXVERSION__:
|
21
|
+
print(f"This version of agx-openplx is compiled for AGX {__AGXVERSION__} and may crash with your {agx.__version__} version, "+
|
22
|
+
"update agx-openplx or AGX to make sure the versions are suited for eachother")
|
23
|
+
except:
|
24
|
+
print("Failed finding AGX Dynamics, have you run setup_env?")
|
25
|
+
sys.exit(255)
|
26
|
+
|
27
|
+
if "DEBUG_AGXOPENPLX" in os.environ:
|
28
|
+
print("#### Using Debug build ####")
|
29
|
+
try:
|
30
|
+
from .debug.api import *
|
31
|
+
from .debug import Core
|
32
|
+
from .debug import Math
|
33
|
+
from .debug import Physics
|
34
|
+
from .debug import Simulation
|
35
|
+
except:
|
36
|
+
print("Failed finding OpenPLX modules or libraries, did you set PYTHONPATH correctly? "+
|
37
|
+
"Should point to where OpenPLX directory with binaries are located")
|
38
|
+
print("Also, make sure you are using the same Python version the libraries were built for.")
|
39
|
+
sys.exit(255)
|
40
|
+
else:
|
41
|
+
try:
|
42
|
+
from .api import *
|
43
|
+
from . import Core
|
44
|
+
from . import Math
|
45
|
+
from . import Physics
|
46
|
+
from . import Simulation
|
47
|
+
except:
|
48
|
+
print("Failed finding OpenPLX modules or libraries, did you set PYTHONPATH correctly? "+
|
49
|
+
"Should point to where OpenPLX directory with binaries are located")
|
50
|
+
print("Also, make sure you are using the same Python version the libraries were built for.")
|
51
|
+
sys.exit(255)
|
openplx/agxtoopenplx.py
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Command line utility that helps converting AGX files to OpenPLX files.
|
4
|
+
"""
|
5
|
+
import os
|
6
|
+
import sys
|
7
|
+
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, SUPPRESS
|
8
|
+
import agx
|
9
|
+
import agxIO
|
10
|
+
import agxSDK
|
11
|
+
from openplx import AgxToOpenPlxMapper, __version__, set_log_level
|
12
|
+
from openplx.versionaction import VersionAction
|
13
|
+
|
14
|
+
init = agx.AutoInit()
|
15
|
+
|
16
|
+
|
17
|
+
def parse_args():
|
18
|
+
parser = ArgumentParser(description="Convert .agx and .aagx files to .openplx", formatter_class=ArgumentDefaultsHelpFormatter)
|
19
|
+
parser.add_argument("agxfile", help="the .agx or .aagx file to load")
|
20
|
+
parser.add_argument("--root-system-name", metavar="<root system name>", help="Override the name of the root system model")
|
21
|
+
parser.add_argument("--export-folder", metavar="<export folder>", help="Where to write exported trimesh:es", default="./")
|
22
|
+
parser.add_argument("--loglevel", choices=["trace", "debug", "info", "warn", "error", "critical", "off"], help="Set log level", default="info")
|
23
|
+
parser.add_argument("--version", help="Show version", action=VersionAction, nargs=0, default=SUPPRESS)
|
24
|
+
parser.add_argument("--realprecision", help="Set precision of generated real values", type=int, default=6)
|
25
|
+
return parser.parse_known_args()
|
26
|
+
|
27
|
+
|
28
|
+
def run():
|
29
|
+
args, _ = parse_args()
|
30
|
+
set_log_level(args.loglevel)
|
31
|
+
simulation = agxSDK.Simulation()
|
32
|
+
assembly = agxSDK.AssemblyRef(agxSDK.Assembly())
|
33
|
+
if args.root_system_name is not None:
|
34
|
+
assembly.setName(args.root_system_name)
|
35
|
+
agxIO.readFile(args.agxfile, simulation, assembly.get())
|
36
|
+
|
37
|
+
# Export trimeshes relative to the current directory
|
38
|
+
export_folder = args.export_folder if os.path.isabs(args.export_folder) else os.path.join(os.getcwd(), args.export_folder)
|
39
|
+
if not os.path.exists(export_folder):
|
40
|
+
os.makedirs(export_folder)
|
41
|
+
mapper = AgxToOpenPlxMapper(export_folder, True, args.realprecision)
|
42
|
+
if ".agx" in args.agxfile:
|
43
|
+
output_file = os.path.basename(args.agxfile.replace(".agx", ".openplx"))
|
44
|
+
elif ".aagx" in args.agxfile:
|
45
|
+
output_file = os.path.basename(args.agxfile.replace(".aagx", ".openplx"))
|
46
|
+
else:
|
47
|
+
sys.exit("Invalid file format. Only .agx and .aagx files are supported.")
|
48
|
+
|
49
|
+
|
50
|
+
print("writing to", output_file)
|
51
|
+
with open(output_file, "w", encoding="utf8") as file:
|
52
|
+
file.writelines(mapper.assemblyToOpenPlx(assembly))
|
53
|
+
|
54
|
+
if __name__ == '__main__':
|
55
|
+
run()
|
openplx/anytoopenplx.py
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Command line utility that helps converting supported formats to OpenPLX files.
|
4
|
+
"""
|
5
|
+
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, SUPPRESS
|
6
|
+
from pathlib import Path
|
7
|
+
import agx
|
8
|
+
from openplx import register_plugins, parseWithPlugin, __version__, set_log_level
|
9
|
+
from openplx.Core import OpenPlxContext, getRegisteredPlugins, StringVector
|
10
|
+
from openplx.versionaction import VersionAction
|
11
|
+
|
12
|
+
|
13
|
+
def parse_args():
|
14
|
+
parser = ArgumentParser(description="Convert any (supported) file to .openplx", formatter_class=ArgumentDefaultsHelpFormatter)
|
15
|
+
parser.add_argument("inputfile", metavar="<non-openplx-file>", help="the non-openplx file to convert")
|
16
|
+
# Next to will be added in the future, at which time agxtoopenplx will be obsolete
|
17
|
+
# parser.add_argument("--root-system-name", metavar="<root system name>", help="Override the name of the root system model")
|
18
|
+
# parser.add_argument("--export-folder", metavar="<export folder>", help="Where to write exported trimesh:es", default="./")
|
19
|
+
parser.add_argument("--loglevel", choices=["trace", "debug", "info", "warn", "error", "critical", "off"], help="Set log level", default="info")
|
20
|
+
parser.add_argument("--version", help="Show version", action=VersionAction, nargs=0, default=SUPPRESS)
|
21
|
+
parser.add_argument("--realprecision", help="Set precision of generated real values", type=int, default=6)
|
22
|
+
return parser.parse_known_args()
|
23
|
+
|
24
|
+
def run():
|
25
|
+
init = agx.AutoInit() # pylint: disable=W0612 # Unused variable 'init'
|
26
|
+
args, _ = parse_args()
|
27
|
+
set_log_level(args.loglevel)
|
28
|
+
context = OpenPlxContext(StringVector())
|
29
|
+
register_plugins(context, None)
|
30
|
+
plugins = getRegisteredPlugins(context)
|
31
|
+
|
32
|
+
extension_plugin_map = {ext: plugin for plugin in plugins for ext in plugin.extensions()}
|
33
|
+
extension = Path(args.inputfile).suffix
|
34
|
+
if extension not in extension_plugin_map:
|
35
|
+
print(f"No matching plugin found for {args.inputfile}, does not end in one of {list(extension_plugin_map.keys())}")
|
36
|
+
return
|
37
|
+
matching_plugin = extension_plugin_map[extension]
|
38
|
+
matching_plugin.setPrecision(args.realprecision)
|
39
|
+
openplx_string = parseWithPlugin(matching_plugin, args.inputfile)
|
40
|
+
|
41
|
+
print(openplx_string)
|
42
|
+
|
43
|
+
if __name__ == '__main__':
|
44
|
+
run()
|