agx-openplx 0.15.10__cp312-cp312-manylinux_2_39_x86_64.whl
Sign up to get free protection for your applications and to get access to all the features.
- agx_openplx-0.15.10.dist-info/METADATA +67 -0
- agx_openplx-0.15.10.dist-info/RECORD +41 -0
- agx_openplx-0.15.10.dist-info/WHEEL +4 -0
- agx_openplx-0.15.10.dist-info/entry_points.txt +8 -0
- openplx/Core.py +7781 -0
- openplx/DriveTrain.py +8972 -0
- openplx/Math.py +5372 -0
- openplx/Physics.py +39861 -0
- openplx/Physics1D.py +5534 -0
- openplx/Physics3D.py +39782 -0
- openplx/Robotics.py +14922 -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-312-x86_64-linux-gnu.so +0 -0
- openplx/_CorePythonSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_DriveTrainSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_MathSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_Physics1DSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_Physics3DSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_PhysicsSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_RoboticsSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_SimulationSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_TerrainSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_UrdfSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_VehiclesSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/_VisualsSwig.cpython-312-x86_64-linux-gnu.so +0 -0
- openplx/__init__.py +55 -0
- openplx/agxtoopenplx.py +55 -0
- openplx/anytoopenplx.py +44 -0
- openplx/api.py +1353 -0
- openplx/migrate.py +190 -0
- openplx/migration_hint.py +14 -0
- openplx/migrations.py +703 -0
- openplx/openplx_application.py +138 -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,55 @@
|
|
1
|
+
# pylint: disable=invalid-name
|
2
|
+
"""
|
3
|
+
__init__ module for OpenPLX package
|
4
|
+
"""
|
5
|
+
import os
|
6
|
+
import sys
|
7
|
+
import traceback
|
8
|
+
# Use agx_env if available
|
9
|
+
import importlib.util
|
10
|
+
if importlib.util.find_spec("agx_env"):
|
11
|
+
import agx_env # pylint: disable=unused-import
|
12
|
+
__AGXVERSION__ = "2.39.1.0"
|
13
|
+
__version__ = "0.15.10"
|
14
|
+
|
15
|
+
try:
|
16
|
+
import agx
|
17
|
+
if agx.__version__ != __AGXVERSION__:
|
18
|
+
print(f"This version of agx-openplx is compiled for AGX {__AGXVERSION__} and may crash with your {agx.__version__} version, "+
|
19
|
+
"update agx-openplx or AGX to make sure the versions are suited for eachother")
|
20
|
+
except Exception as e: # pylint: disable=broad-exception-caught
|
21
|
+
traceback.print_exc()
|
22
|
+
print("Failed finding AGX Dynamics, have you run setup_env?")
|
23
|
+
sys.exit(255)
|
24
|
+
|
25
|
+
if "DEBUG_AGXOPENPLX" in os.environ:
|
26
|
+
print("#### Using Debug build ####")
|
27
|
+
try:
|
28
|
+
# pylint: disable=relative-beyond-top-level, wildcard-import, unused-import, no-name-in-module
|
29
|
+
from .debug.api import *
|
30
|
+
from .debug import Core
|
31
|
+
from .debug import Math
|
32
|
+
from .debug import Physics
|
33
|
+
from .debug import Simulation
|
34
|
+
# pylint: enable=relative-beyond-top-level, wildcard-import, unused-import, no-name-in-module
|
35
|
+
except Exception as e: # pylint: disable=broad-exception-caught
|
36
|
+
traceback.print_exc()
|
37
|
+
print("Failed finding OpenPLX modules or libraries, did you set PYTHONPATH correctly? "+
|
38
|
+
"Should point to where OpenPLX directory with binaries are located.")
|
39
|
+
print("Also, make sure you are using the same Python version the libraries were built for.")
|
40
|
+
sys.exit(255)
|
41
|
+
else:
|
42
|
+
try:
|
43
|
+
# pylint: disable=relative-beyond-top-level, wildcard-import, unused-import, no-name-in-module
|
44
|
+
from .api import *
|
45
|
+
from . import Core
|
46
|
+
from . import Math
|
47
|
+
from . import Physics
|
48
|
+
from . import Simulation
|
49
|
+
# pylint: enable=relative-beyond-top-level, wildcard-import, unused-import, no-name-in-module
|
50
|
+
except Exception as e: # pylint: disable=broad-exception-caught
|
51
|
+
traceback.print_exc()
|
52
|
+
print("Failed finding OpenPLX modules or libraries, did you set PYTHONPATH correctly? "+
|
53
|
+
"Should point to where OpenPLX directory with binaries are located.")
|
54
|
+
print("Also, make sure you are using the same Python version the libraries were built for.")
|
55
|
+
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()
|