agx-openplx 0.15.0__cp39-cp39-win_amd64.whl → 0.15.1__cp39-cp39-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- agx_openplx-0.15.1.dist-info/METADATA +63 -0
- agx_openplx-0.15.1.dist-info/RECORD +41 -0
- openplx/_AgxOpenPlxPyApi.cp39-win_amd64.pyd +0 -0
- openplx/_CorePythonSwig.cp39-win_amd64.pyd +0 -0
- openplx/_DriveTrainSwig.cp39-win_amd64.pyd +0 -0
- openplx/_MathSwig.cp39-win_amd64.pyd +0 -0
- openplx/_Physics1DSwig.cp39-win_amd64.pyd +0 -0
- openplx/_Physics3DSwig.cp39-win_amd64.pyd +0 -0
- openplx/_PhysicsSwig.cp39-win_amd64.pyd +0 -0
- openplx/_RoboticsSwig.cp39-win_amd64.pyd +0 -0
- openplx/_SimulationSwig.cp39-win_amd64.pyd +0 -0
- openplx/_TerrainSwig.cp39-win_amd64.pyd +0 -0
- openplx/_UrdfSwig.cp39-win_amd64.pyd +0 -0
- openplx/_VehiclesSwig.cp39-win_amd64.pyd +0 -0
- openplx/_VisualsSwig.cp39-win_amd64.pyd +0 -0
- openplx/__init__.py +1 -1
- openplx/migrate.py +27 -7
- openplx/migrations.py +16 -0
- openplx/openplx_application.py +10 -8
- openplx/openplx_view.py +1 -1
- agx_openplx-0.15.0.dist-info/METADATA +0 -232
- agx_openplx-0.15.0.dist-info/RECORD +0 -41
- {agx_openplx-0.15.0.dist-info → agx_openplx-0.15.1.dist-info}/WHEEL +0 -0
- {agx_openplx-0.15.0.dist-info → agx_openplx-0.15.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: agx-openplx
|
3
|
+
Version: 0.15.1
|
4
|
+
Summary: AGX-OpenPLX python interface development
|
5
|
+
Home-page: https://pub.algoryx.dev/openplx/
|
6
|
+
License: Apache 2.0
|
7
|
+
Author: Algoryx
|
8
|
+
Author-email: algoryx@algoryx.com
|
9
|
+
Requires-Python: >=3.8
|
10
|
+
Classifier: Intended Audience :: Manufacturing
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
12
|
+
Classifier: License :: Other/Proprietary License
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
21
|
+
Requires-Dist: agx (==2.38.0.2)
|
22
|
+
Requires-Dist: openplx-bundles (>=0.15.1,<0.16.0)
|
23
|
+
Requires-Dist: pclick (>=0.4.1,<0.5.0)
|
24
|
+
Description-Content-Type: text/markdown
|
25
|
+
|
26
|
+
# AGX OpenPLX
|
27
|
+
|
28
|
+
The agx-openplx package implements all OpenPLX bundles such as Physics, Robotics, DriveTrain and Simulation using [AGX Dynamics Real-time multi-body simulation](https://www.algoryx.se/agx-dynamics/).
|
29
|
+
The package contains python bindings and native libraries needed to load and run .openplx files.
|
30
|
+
|
31
|
+
See [OpenPLX documentation](https://pub.algoryx.dev/openplx/) for more info on OpenPLX.
|
32
|
+
|
33
|
+
## Prerequisites
|
34
|
+
|
35
|
+
- Python 3.9 on Windows or OSX
|
36
|
+
- Python 3.8 on Ubuntu 20.04
|
37
|
+
- Python 3.10 on Ubuntu 22.04
|
38
|
+
- [AGX Dynamics](https://www.algoryx.se/agx-dynamics/) 2.38.0.2 and an AGX Dynamics License
|
39
|
+
|
40
|
+
At [OpenPLX documentation](https://pub.algoryx.dev/openplx/getopenplx/) you can find out which older version of OpenPLX matches which version of AGX.
|
41
|
+
|
42
|
+
## Install
|
43
|
+
|
44
|
+
To get the version corresponding to your AGX on Windows do:
|
45
|
+
|
46
|
+
```bash
|
47
|
+
setup_env.bat
|
48
|
+
pip install %AGX_DATA_DIR%/agx-pypi
|
49
|
+
pip install -U agx-openplx
|
50
|
+
```
|
51
|
+
|
52
|
+
To get the version corresponding to your AGX on OSX and Linux do:
|
53
|
+
|
54
|
+
```bash
|
55
|
+
source setup_env.sh
|
56
|
+
pip3 install $AGX_DATA_DIR/agx-pypi
|
57
|
+
pip3 install -U agx-openplx
|
58
|
+
```
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
63
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
openplx/__init__.py,sha256=EArbIZbutmQl-IsSwvqFrSTNqL6iEDk6jWWdBg00450,2101
|
2
|
+
openplx/_AgxOpenPlxPyApi.cp39-win_amd64.pyd,sha256=xbUJXePkmnp-ItdI8Dl5LyoEulL0804hAbIb9ykSq4k,6322176
|
3
|
+
openplx/_CorePythonSwig.cp39-win_amd64.pyd,sha256=h_EAH2osNZN5YzbnPm3FpnkEqOM2MxwbjnoFZFU23vI,2550272
|
4
|
+
openplx/_DriveTrainSwig.cp39-win_amd64.pyd,sha256=IRxecez-v6HtPEJDWJ0rb0nTM8K3wqZny-solEy5JGI,2826752
|
5
|
+
openplx/_MathSwig.cp39-win_amd64.pyd,sha256=Urn4mLjI-nFswhUpJohfJ3JrhZOKtkGv9KR61yHrqWU,1313792
|
6
|
+
openplx/_Physics1DSwig.cp39-win_amd64.pyd,sha256=7IIjG5aLSMqzJLrPd5pG3ibL6duvZnBqrvRE5HoOGQc,2173440
|
7
|
+
openplx/_Physics3DSwig.cp39-win_amd64.pyd,sha256=xY4wZkd276KHG1eQLIQ8rceRihxH4U86xkaXM9rZNa4,12642816
|
8
|
+
openplx/_PhysicsSwig.cp39-win_amd64.pyd,sha256=o2LNHB9jTvbDKSyMK7wtrl49zyFMItR1jqYFeLgzqPY,9691136
|
9
|
+
openplx/_RoboticsSwig.cp39-win_amd64.pyd,sha256=rLb3fFgjgwE17FMiWv1L5yPRa7XrQjwVyHtpdtUu2no,5177344
|
10
|
+
openplx/_SimulationSwig.cp39-win_amd64.pyd,sha256=kOi89KwrKL2hnxE7q0UiQtnqAKAFJSvb-mo56VYjXCk,632320
|
11
|
+
openplx/_TerrainSwig.cp39-win_amd64.pyd,sha256=7_K9gTcwGtXMfbcJ25IU5KU41vhYJlvH1WUPhTvLtKQ,1536512
|
12
|
+
openplx/_UrdfSwig.cp39-win_amd64.pyd,sha256=tvi-k7CsI9VU0mrm0Pdu2s4JHepCd-WCejMVoXQ32LU,698368
|
13
|
+
openplx/_VehiclesSwig.cp39-win_amd64.pyd,sha256=F4kayBXSVXaVWsGmuAf4Q1z3UMNdzxYWyJSLhhdUglo,3124224
|
14
|
+
openplx/_VisualsSwig.cp39-win_amd64.pyd,sha256=8gGQkFBvL9Gnp2-hf59Rv8bWsIkAnkNACPkWkRxpPis,1281024
|
15
|
+
openplx/agxtoopenplx.py,sha256=LCt_tm9tffb0aA5ZsVAqvD1w276NKuq2MQ9vOZS1V1I,2477
|
16
|
+
openplx/anytoopenplx.py,sha256=ckINLkHMyraBaIhdJfVXcaeVNh6m7BnyEx9or3j7mxo,2318
|
17
|
+
openplx/api.py,sha256=XoU3a-t2bNxO71FeBpuGgENsVaR14DrlPpkCE4cJRn8,48252
|
18
|
+
openplx/Core.py,sha256=lQcUoerxSC-TjMSjdNFWGjnQ1eQKVpFJhGl0sTlPkE0,277824
|
19
|
+
openplx/DriveTrain.py,sha256=e3ntEsPnXXhw3LWqNsP78A5aZaMNwd_jDa9cjShmP_g,427468
|
20
|
+
openplx/Math.py,sha256=hi3zI0KfxZNqy8u78nEm55bZGo0ZoWgqA8piOE2e2B8,193933
|
21
|
+
openplx/migrate.py,sha256=3kupvPeccEGwoBxWEoLH4a-tkcl7fXaGKkVgYSfccJI,6587
|
22
|
+
openplx/migration_hint.py,sha256=JiD5f7DzCVNoN-N_VweRNIKnSmCRqxhRof4QiR-1rEs,617
|
23
|
+
openplx/migrations.py,sha256=KY1fIEwI6mgcw6ZHj-pJepzHHJj-R6xds68uIBs_RpE,16128
|
24
|
+
openplx/openplx_application.py,sha256=mVyv19mh18OqoqWdh15ouWFIDezr2IGLyn_dQRNfFrc,6536
|
25
|
+
openplx/openplx_serialize.py,sha256=0_hKFnBP8IQ4f22vW6RLHRRNxUZVSu21Lcrgy6lbqPc,1491
|
26
|
+
openplx/openplx_validate.py,sha256=PgbC1K0OzKC2rknUtqYWXyCca5TKnZdpkg_ZresGvOY,2112
|
27
|
+
openplx/openplx_view.py,sha256=Rmg2uWhaDQ4WMEsKlDTcMBSoPIFDNXXZzN7ytFU9ZgQ,365
|
28
|
+
openplx/Physics.py,sha256=uoxRlbDAfIJ-uWtAo3W33VXuv_79ZHco4Nw4KEj6Rl8,1920631
|
29
|
+
openplx/Physics1D.py,sha256=zumBcg-GGIW39BXkywKVldM3FtSWhUFX2aLbZFHRahU,352638
|
30
|
+
openplx/Physics3D.py,sha256=Zu70VSG1gbmnvageGT07xIQXXMmNvuICkCfpM0e_Y8I,2480375
|
31
|
+
openplx/Robotics.py,sha256=gaq0xM3ZuhvIINeoKP14xENZqTw_B5px_gh40-m-_mI,814741
|
32
|
+
openplx/Simulation.py,sha256=xab3Q6-d90xNuPk--zjTB-XO8BNEv48equ_Ms48PLf8,47374
|
33
|
+
openplx/Terrain.py,sha256=RhhE6CboZ88n5CbHlyhLzG78vwpjY1sViGgpg7HHuyU,188775
|
34
|
+
openplx/Urdf.py,sha256=Z9Q5dKrSPIEgXS9JE7cYKl4zgkhbrdlmV3vBcORE0KY,24434
|
35
|
+
openplx/Vehicles.py,sha256=ljYCuwGfA-qqQywHdcI530mIzqIq1DNgb1_d2Jmo5_4,458867
|
36
|
+
openplx/versionaction.py,sha256=u0rZ34x1-KtLHM93OBN2BsFAxEAv6HDLadvu14en5io,294
|
37
|
+
openplx/Visuals.py,sha256=xTDmvGIxyJPWSgH20CWwQRPDHwOFp48nBl8fo8sN0JY,190953
|
38
|
+
agx_openplx-0.15.1.dist-info/entry_points.txt,sha256=IyHBVBNuH_4ZhfWnB1ZVXYtpKG_QT7dwGIUMLWdyhrc,263
|
39
|
+
agx_openplx-0.15.1.dist-info/METADATA,sha256=dvmCfwyGWb7uK73YK3cGxhw-4__IGcZAB1_fqTicaFY,2128
|
40
|
+
agx_openplx-0.15.1.dist-info/WHEEL,sha256=T7hzPzFWHJiWCVylm2UCj5payilA7ulisMC0IiBEe3o,96
|
41
|
+
agx_openplx-0.15.1.dist-info/RECORD,,
|
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
CHANGED
openplx/migrate.py
CHANGED
@@ -15,6 +15,8 @@ from openplx import __version__, get_error_strings
|
|
15
15
|
from openplx.Core import OpenPlxContext, parseFromFile, analyze, StringVector, DocumentVector
|
16
16
|
from openplx.migrations import collect_migrations, ReplaceOp
|
17
17
|
from openplx.versionaction import VersionAction
|
18
|
+
from openplx import register_plugins
|
19
|
+
import agx
|
18
20
|
|
19
21
|
def download_package_version(package_name, version):
|
20
22
|
"""Download a specific version of a package from PyPI."""
|
@@ -60,18 +62,27 @@ def has_errors(openplx_context):
|
|
60
62
|
return True
|
61
63
|
return False
|
62
64
|
|
63
|
-
def refactor_openplx_file(openplxfile, bundle_path_vec, from_version, to_version) -> bool:
|
65
|
+
def refactor_openplx_file(openplxfile, bundle_path_vec, from_version, to_version) -> bool: # pylint: disable=too-many-locals
|
64
66
|
print(f"Migrating {openplxfile} from {from_version} to {to_version}")
|
65
|
-
openplx_context = OpenPlxContext(bundle_path_vec)
|
66
67
|
migrations = collect_migrations(from_version, to_version)
|
68
|
+
print(f"Found {len(migrations)} migrations ", [m.__name__ for m in migrations])
|
69
|
+
|
70
|
+
file_rename_migrations = []
|
71
|
+
for migration in [m for m in migrations if m.__name__ == "rename_from_brick_to_openplx"]:
|
72
|
+
file_rename_migrations.append(migration(openplxfile))
|
73
|
+
if (openplxfile.endswith("config.openplx") or openplxfile.endswith("config.brick")):
|
74
|
+
for m in file_rename_migrations:
|
75
|
+
m.apply_to(None, None)
|
76
|
+
return True
|
67
77
|
|
78
|
+
migrations = [m for m in migrations if m.__name__ != "rename_from_brick_to_openplx"]
|
79
|
+
openplx_context = OpenPlxContext(bundle_path_vec)
|
80
|
+
register_plugins(openplx_context, None)
|
68
81
|
documents = parse_and_analyze(openplxfile, openplx_context)
|
69
82
|
|
70
83
|
if has_errors(openplx_context):
|
71
84
|
return False
|
72
85
|
|
73
|
-
print(f"Found {len(migrations)} migrations ", [m.__name__ for m in migrations])
|
74
|
-
|
75
86
|
order_group = [(key, list(group)) for key, group in itertools.groupby(migrations, lambda m: m.openplx_order)]
|
76
87
|
order_group.sort(key=lambda pair: pair[0])
|
77
88
|
|
@@ -84,9 +95,14 @@ def refactor_openplx_file(openplxfile, bundle_path_vec, from_version, to_version
|
|
84
95
|
if Path(openplxfile).samefile(key):
|
85
96
|
with open(key, 'r', encoding="utf8") as file:
|
86
97
|
lines = file.readlines()
|
87
|
-
|
98
|
+
replace_ops = [op for op in op_group if isinstance(op, ReplaceOp)]
|
99
|
+
lines = ReplaceOp.apply_many(replace_ops, lines)
|
88
100
|
with open(key, 'w', encoding="utf8") as file:
|
89
101
|
file.writelines(lines)
|
102
|
+
|
103
|
+
for m in file_rename_migrations:
|
104
|
+
m.apply_to(None, None)
|
105
|
+
|
90
106
|
return True
|
91
107
|
|
92
108
|
def run_openplx_migrate(args):
|
@@ -118,7 +134,7 @@ def run_openplx_migrate(args):
|
|
118
134
|
if os.path.isdir(args.openplxfile):
|
119
135
|
for root, _, files in os.walk(args.openplxfile):
|
120
136
|
for file in files:
|
121
|
-
if file.endswith(".openplx")
|
137
|
+
if file.endswith(".openplx") or file.endswith(".brick"):
|
122
138
|
openplxfile = os.path.join(root, file)
|
123
139
|
if not refactor_openplx_file(openplxfile, bundle_path_vec, args.from_version, args.to_version):
|
124
140
|
success = False
|
@@ -131,6 +147,10 @@ def run_openplx_migrate(args):
|
|
131
147
|
print(f"Refactor from {args.from_version} to {args.to_version} failed due to errors!")
|
132
148
|
print("Note, some files might have been partially migrated.")
|
133
149
|
|
134
|
-
|
150
|
+
def run():
|
135
151
|
arguments, _ = parse_args()
|
152
|
+
init = agx.AutoInit() # pylint: disable=W0612 # Unused variable 'init'
|
136
153
|
run_openplx_migrate(arguments)
|
154
|
+
|
155
|
+
if __name__ == '__main__':
|
156
|
+
run()
|
openplx/migrations.py
CHANGED
@@ -450,6 +450,11 @@ def migrations_for_0_13_1(documents):
|
|
450
450
|
|
451
451
|
return [ReplaceOp(op) for op in ops]
|
452
452
|
|
453
|
+
@migration("0.14.0", "0.15.0")
|
454
|
+
def rename_from_brick_to_openplx(document_path):
|
455
|
+
|
456
|
+
return ChangeExtensionOp(Path(document_path), ".openplx")
|
457
|
+
|
453
458
|
|
454
459
|
def split_version(v):
|
455
460
|
match = re.match(r"^(\d+)\.(\d+)\.(\d+)", v)
|
@@ -482,6 +487,17 @@ class MigrateOp(ABC): # pylint: disable=R0903 # Too few public methods
|
|
482
487
|
pass
|
483
488
|
|
484
489
|
|
490
|
+
class ChangeExtensionOp(MigrateOp):
|
491
|
+
def __init__(self, path: Path, new_extension: str):
|
492
|
+
self.path = path
|
493
|
+
self.new_extension = new_extension
|
494
|
+
|
495
|
+
def __str__(self):
|
496
|
+
return f"{{ {self.path}, {self.new_extension} }}"
|
497
|
+
|
498
|
+
def apply_to(self, _lines, _offset):
|
499
|
+
self.path.rename(self.path.with_suffix(self.new_extension))
|
500
|
+
|
485
501
|
class ReplaceOp(MigrateOp):
|
486
502
|
def __init__(self, op: RefactorReplaceOp):
|
487
503
|
self.path = Path(op.source_id)
|
openplx/openplx_application.py
CHANGED
@@ -21,6 +21,7 @@ def dummy_build_scene():
|
|
21
21
|
|
22
22
|
class AgxHelpAction(Action):
|
23
23
|
def __call__(self, parser, namespace, values, option_string=None):
|
24
|
+
sys.argv.append("--usage")
|
24
25
|
OpenPlxApplication(dummy_build_scene).start_agx()
|
25
26
|
sys.exit(0)
|
26
27
|
|
@@ -38,7 +39,7 @@ class OpenPlxApplication:
|
|
38
39
|
self.build_scene_file = sys.modules[self.build_scene.__module__].__file__ if build_scene_file is None else build_scene_file
|
39
40
|
|
40
41
|
@staticmethod
|
41
|
-
def
|
42
|
+
def setup_args_parser(openplxfile = None):
|
42
43
|
parser = ArgumentParser(description="View OpenPLX models", formatter_class=ArgumentDefaultsHelpFormatter)
|
43
44
|
if openplxfile is None:
|
44
45
|
parser.add_argument("openplxfile", help="the .openplx file to load")
|
@@ -58,13 +59,13 @@ class OpenPlxApplication:
|
|
58
59
|
default="info")
|
59
60
|
parser.add_argument("--modelname", help="The model to load (defaults to last model in file)", metavar="<name>", default=None)
|
60
61
|
parser.add_argument("--reload-on-update", help="Reload scene automatically when source is updated", action="store_true", default=SUPPRESS)
|
61
|
-
parser.add_argument("--
|
62
|
+
parser.add_argument("--agxhelp", help="Show AGX specific help", action=AgxHelpAction, nargs=0, default=SUPPRESS)
|
62
63
|
parser.add_argument("--version", help="Show version", action=VersionAction, nargs=0, default=SUPPRESS)
|
63
|
-
return parser
|
64
|
+
return parser
|
64
65
|
|
65
66
|
@staticmethod
|
66
|
-
def
|
67
|
-
args, extra_args = OpenPlxApplication.
|
67
|
+
def prepare_scene(openplxfile = None):
|
68
|
+
args, extra_args = OpenPlxApplication.setup_args_parser(openplxfile).parse_known_args()
|
68
69
|
set_log_level(args.loglevel)
|
69
70
|
if extra_args:
|
70
71
|
print(f"Passing these args to AGX: {(' ').join(extra_args)}")
|
@@ -123,11 +124,12 @@ class OpenPlxApplication:
|
|
123
124
|
def start_agx(self):
|
124
125
|
# Tell AGX where build_scene is located
|
125
126
|
sys.argv[0] = self.build_scene_file
|
126
|
-
# pylint: disable=W0612 # Unused variable 'init'
|
127
127
|
# Use __main__ otherwise AGX will just skip the init
|
128
|
-
|
128
|
+
# pylint: disable=unused-variable
|
129
|
+
init = init_app(name="__main__", scenes=[(self.build_scene, "1")], autoStepping=True, onShutdown=self.on_shutdown)
|
130
|
+
# pylint: enable=unused-variable
|
129
131
|
|
130
132
|
def run(self):
|
131
133
|
signal.signal(signal.SIGINT, self.ctrl_break_handler)
|
132
|
-
self.
|
134
|
+
self.setup_args_parser("").parse_known_args()
|
133
135
|
self.start_agx()
|
openplx/openplx_view.py
CHANGED
@@ -5,7 +5,7 @@ Command line utility that loads OpenPLX files and loads them into an AGX Simulat
|
|
5
5
|
from openplx.openplx_application import OpenPlxApplication
|
6
6
|
|
7
7
|
def openplx_view_build_scene():
|
8
|
-
OpenPlxApplication.
|
8
|
+
OpenPlxApplication.prepare_scene()
|
9
9
|
|
10
10
|
def run():
|
11
11
|
OpenPlxApplication(openplx_view_build_scene).run()
|
@@ -1,232 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: agx-openplx
|
3
|
-
Version: 0.15.0
|
4
|
-
Summary: AGX-OpenPLX python interface development
|
5
|
-
Home-page: https://pub.algoryx.dev/openplx/
|
6
|
-
License: Apache 2.0
|
7
|
-
Author: Algoryx
|
8
|
-
Author-email: algoryx@algoryx.com
|
9
|
-
Requires-Python: >=3.8
|
10
|
-
Classifier: Intended Audience :: Manufacturing
|
11
|
-
Classifier: Intended Audience :: Science/Research
|
12
|
-
Classifier: License :: Other/Proprietary License
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
19
|
-
Classifier: Topic :: Scientific/Engineering :: Physics
|
20
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
21
|
-
Requires-Dist: agx (==2.38.0.2)
|
22
|
-
Requires-Dist: openplx-bundles (>=0.15.0,<0.16.0)
|
23
|
-
Requires-Dist: pclick (>=0.4.1,<0.5.0)
|
24
|
-
Description-Content-Type: text/markdown
|
25
|
-
|
26
|
-
# AGX OpenPLX
|
27
|
-
|
28
|
-
The agx-openplx package implements all OpenPLX bundles such as Physics, Robotics, DriveTrain and Simulation using [AGX Dynamics Real-time multi-body simulation](https://www.algoryx.se/agx-dynamics/).
|
29
|
-
The package contains python bindings and native libraries needed to load and run .openplx files.
|
30
|
-
|
31
|
-
See [OpenPLX documentation](https://pub.algoryx.dev/openplx/) for more info on OpenPLX.
|
32
|
-
|
33
|
-
## Prerequisites
|
34
|
-
|
35
|
-
- Python 3.9 on Windows or OSX
|
36
|
-
- Python 3.8 on Ubuntu 20.04
|
37
|
-
- Python 3.10 on Ubuntu 22.04
|
38
|
-
- [AGX Dynamics](https://www.algoryx.se/agx-dynamics/) 2.38.0.2 and an AGX Dynamics License
|
39
|
-
|
40
|
-
At [OpenPLX documentation](https://pub.algoryx.dev/openplx/getopenplx/) you can find out which older version of OpenPLX matches which version of AGX.
|
41
|
-
|
42
|
-
## Install
|
43
|
-
|
44
|
-
To get the version corresponding to your AGX on Windows do:
|
45
|
-
|
46
|
-
```bash
|
47
|
-
setup_env.bat
|
48
|
-
pip install %AGX_DATA_DIR%/agx-pypi
|
49
|
-
pip install -U agx-openplx
|
50
|
-
```
|
51
|
-
|
52
|
-
To get the version corresponding to your AGX on OSX and Linux do:
|
53
|
-
|
54
|
-
```bash
|
55
|
-
source setup_env.sh
|
56
|
-
pip3 install $AGX_DATA_DIR/agx-pypi
|
57
|
-
pip3 install -U agx-openplx
|
58
|
-
```
|
59
|
-
|
60
|
-
## License
|
61
|
-
|
62
|
-
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
63
|
-
|
64
|
-
## Usage Examples
|
65
|
-
|
66
|
-
Given the python file and openplx file below, run with:
|
67
|
-
|
68
|
-
```bash
|
69
|
-
python3 inverted_pendulum.py
|
70
|
-
```
|
71
|
-
|
72
|
-
To just simulate the openplx file without controllers, do:
|
73
|
-
|
74
|
-
```bash
|
75
|
-
openplx_view inverted_pendulum.openplx
|
76
|
-
```
|
77
|
-
|
78
|
-
or `python3 -m openplx.openplx_view inverted_pendulum.openplx`
|
79
|
-
|
80
|
-
Store contents below in a new file named `inverted_pendulum.openplx`:
|
81
|
-
|
82
|
-
```openplx
|
83
|
-
Rod is Physics3D.Bodies.RigidBody:
|
84
|
-
inertia.mass: 10
|
85
|
-
geometry is Physics3D.Charges.Box:
|
86
|
-
size: Math.Vec3.from_xyz(0.1, 0.1, 1)
|
87
|
-
arrow is Physics3D.Charges.Box:
|
88
|
-
local_transform:
|
89
|
-
position.z: 0.5
|
90
|
-
rotation: Math.Quat.angleAxis(Math.PI / 4, Math.Vec3.Y_AXIS())
|
91
|
-
size: Math.Vec3.from_xyz(0.071, 0.1, 0.071)
|
92
|
-
mate_connector is Physics3D.Charges.MateConnector:
|
93
|
-
position.z: -geometry.size.z * 0.7
|
94
|
-
main_axis: Math.Vec3.Y_AXIS()
|
95
|
-
normal: Math.Vec3.Z_AXIS()
|
96
|
-
|
97
|
-
Cart is Physics3D.Bodies.RigidBody:
|
98
|
-
inertia.mass: 10
|
99
|
-
geometry is Physics3D.Charges.Box:
|
100
|
-
size: Math.Vec3.from_xyz(0.1, 0.1, 0.1)
|
101
|
-
connector is Physics3D.Charges.MateConnector:
|
102
|
-
main_axis: Math.Vec3.X_AXIS()
|
103
|
-
normal: Math.Vec3.Z_AXIS()
|
104
|
-
rotated_connector is Physics3D.Charges.MateConnector:
|
105
|
-
main_axis: Math.Vec3.Y_AXIS()
|
106
|
-
normal: Math.Vec3.Z_AXIS()
|
107
|
-
|
108
|
-
PendulumScene is Physics3D.System:
|
109
|
-
world_connector is Physics3D.Charges.MateConnector:
|
110
|
-
main_axis: Math.Vec3.X_AXIS()
|
111
|
-
normal: Math.Vec3.Z_AXIS()
|
112
|
-
|
113
|
-
cart is Cart
|
114
|
-
rod is Rod
|
115
|
-
|
116
|
-
prismatic is Physics3D.Interactions.Prismatic:
|
117
|
-
charges: [world_connector, cart.connector]
|
118
|
-
|
119
|
-
cart_motor is Physics3D.Interactions.LinearVelocityMotor:
|
120
|
-
desired_speed: 0
|
121
|
-
charges: prismatic.charges
|
122
|
-
|
123
|
-
hinge is Physics3D.Interactions.Hinge:
|
124
|
-
initial_angle: 0
|
125
|
-
charges: [cart.rotated_connector, rod.mate_connector]
|
126
|
-
|
127
|
-
motor_input is Physics3D.Signals.LinearVelocityMotorVelocityInput:
|
128
|
-
motor: cart_motor
|
129
|
-
|
130
|
-
hinge_angle_output is Physics3D.Signals.HingeAngleOutput:
|
131
|
-
hinge: hinge
|
132
|
-
hinge_angular_velocity_output is Physics3D.Signals.HingeAngularVelocityOutput:
|
133
|
-
hinge: hinge
|
134
|
-
|
135
|
-
cart_position_output is Physics3D.Signals.RigidBodyPositionOutput:
|
136
|
-
rigid_body: cart
|
137
|
-
cart_velocity_output is Physics3D.Signals.RigidBodyVelocityOutput:
|
138
|
-
rigid_body: cart
|
139
|
-
```
|
140
|
-
|
141
|
-
Store contents below in a new file named `inverted_pendulum.py`:
|
142
|
-
|
143
|
-
```python
|
144
|
-
import os
|
145
|
-
import signal
|
146
|
-
import agxOSG
|
147
|
-
import agxSDK
|
148
|
-
from openplxbundles import bundle_path
|
149
|
-
|
150
|
-
# Import useful utilities to access the current simulation, graphics root and application
|
151
|
-
from agxPythonModules.utils.environment import init_app, simulation, root
|
152
|
-
|
153
|
-
from openplx import Math, Physics, Physics3D, Signals
|
154
|
-
from openplx import InputSignalListener, OutputSignalListener, load_from_file
|
155
|
-
|
156
|
-
def file_dir():
|
157
|
-
return os.path.dirname(os.path.abspath(__file__))
|
158
|
-
|
159
|
-
def pendulum():
|
160
|
-
return f"{file_dir()}/inverted_pendulum.openplx"
|
161
|
-
|
162
|
-
class PDController:
|
163
|
-
def __init__(self, kp, kd, goal):
|
164
|
-
self.kp = kp
|
165
|
-
self.kd = kd
|
166
|
-
self.goal = goal
|
167
|
-
|
168
|
-
def observe(self, x, xdot):
|
169
|
-
error = self.goal - x
|
170
|
-
return self.kp * error - self.kd * xdot
|
171
|
-
|
172
|
-
|
173
|
-
class CartController(agxSDK.StepEventListener):
|
174
|
-
motor_input: Physics3D.Signals_LinearVelocityMotorVelocityInput
|
175
|
-
cart: PDController
|
176
|
-
pole: PDController
|
177
|
-
|
178
|
-
def __init__(self, motor_input: Physics3D.Signals_LinearVelocityMotorVelocityInput):
|
179
|
-
super().__init__()
|
180
|
-
self.motor_input = motor_input
|
181
|
-
self.cart = PDController(kp=10, kd=5, goal=0)
|
182
|
-
self.pole = PDController(kp=20, kd=5, goal=0)
|
183
|
-
|
184
|
-
def pre(self, time):
|
185
|
-
if time == 0.0:
|
186
|
-
hinge_angle = 0
|
187
|
-
hinge_angular_velocity = 0
|
188
|
-
cart_position = Math.Vec3.from_xyz(0,0,0)
|
189
|
-
cart_velocity = Math.Vec3.from_xyz(0,0,0)
|
190
|
-
else:
|
191
|
-
signal_values = {signal.source().getName():signal.value().value() for signal in Signals.getOutputSignals()}
|
192
|
-
hinge_angle = signal_values["PendulumScene.hinge_angle_output"]
|
193
|
-
hinge_angular_velocity = signal_values["PendulumScene.hinge_angular_velocity_output"]
|
194
|
-
cart_position = signal_values["PendulumScene.cart_position_output"]
|
195
|
-
cart_velocity = signal_values["PendulumScene.cart_velocity_output"]
|
196
|
-
|
197
|
-
u_cart = self.cart.observe(cart_position.x(), cart_velocity.x())
|
198
|
-
u_pole = self.pole.observe(hinge_angle, hinge_angular_velocity)
|
199
|
-
|
200
|
-
Signals.sendInputSignal(Physics.Signals_RealInputSignal.create(-u_cart - u_pole, self.motor_input))
|
201
|
-
|
202
|
-
|
203
|
-
def buildScene():
|
204
|
-
|
205
|
-
result = load_from_file(simulation(), pendulum(), bundle_path(), "")
|
206
|
-
assembly = result.assembly()
|
207
|
-
openplx_scene = result.scene()
|
208
|
-
# Add a signal listener so that signals are picked up from inputs
|
209
|
-
input_signal_listener = InputSignalListener(assembly)
|
210
|
-
output_signal_listener = OutputSignalListener(assembly, openplx_scene)
|
211
|
-
simulation().add(input_signal_listener, InputSignalListener.RECOMMENDED_PRIO)
|
212
|
-
simulation().add(output_signal_listener, OutputSignalListener.RECOMMENDED_PRIO)
|
213
|
-
simulation().add(assembly.get())
|
214
|
-
agxOSG.createVisual(assembly.get(), root())
|
215
|
-
|
216
|
-
motor_input: Physics3D.Signals_LinearVelocityMotorVelocityInput = openplx_scene.getDynamic("motor_input").asObject()
|
217
|
-
controller = CartController(motor_input)
|
218
|
-
simulation().add(controller)
|
219
|
-
|
220
|
-
|
221
|
-
def handler(_, __):
|
222
|
-
os._exit(0)
|
223
|
-
|
224
|
-
signal.signal(signal.SIGINT, handler)
|
225
|
-
|
226
|
-
init = init_app(name=__name__,
|
227
|
-
scenes=[(buildScene, '1')],
|
228
|
-
autoStepping=True, # Default: False
|
229
|
-
onInitialized=lambda app: print('App successfully initialized.'),
|
230
|
-
onShutdown=lambda app: print('App successfully shut down.'))
|
231
|
-
```
|
232
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
openplx/__init__.py,sha256=73QPapLJWuj5dEJzFvWM9kWQNZUWYJuUvR_2jvfAbBI,2101
|
2
|
-
openplx/_AgxOpenPlxPyApi.cp39-win_amd64.pyd,sha256=B2vaXpde6-mm5SHMUeirG1vq0tPA55S1elo3acJN6dk,6322176
|
3
|
-
openplx/_CorePythonSwig.cp39-win_amd64.pyd,sha256=pFlpaW3MzvjPdBTKNRf3ZjZJVFswXy5n57i6SQYsPDE,2550272
|
4
|
-
openplx/_DriveTrainSwig.cp39-win_amd64.pyd,sha256=XqyedEtF4h4vx4XWHATPi6C3xasH8DNZ-EoySMUbtFU,2826752
|
5
|
-
openplx/_MathSwig.cp39-win_amd64.pyd,sha256=oNdsvsSInHubZFgkTbP5_KiaqznA5ODkP7yhew0r7RQ,1313792
|
6
|
-
openplx/_Physics1DSwig.cp39-win_amd64.pyd,sha256=0eVYY5AHtdgAP4SnKBdV9u7bERX3TSGLVUor5Xkh_FE,2173440
|
7
|
-
openplx/_Physics3DSwig.cp39-win_amd64.pyd,sha256=M4MHEAtDueI4r0ka1j9eb1_ZgDy-6pt5iXRDcWC-bxU,12642816
|
8
|
-
openplx/_PhysicsSwig.cp39-win_amd64.pyd,sha256=zOZcmz6eRQJTOcbPi8uYnpoKIuh-URbj5saNSodTUHE,9691136
|
9
|
-
openplx/_RoboticsSwig.cp39-win_amd64.pyd,sha256=xyfczcxwKuuXmEKrZlqQ9wdtn0yINQAchnp3E6LoDq8,5177344
|
10
|
-
openplx/_SimulationSwig.cp39-win_amd64.pyd,sha256=5qAYufH7YdfT4x9PsbOvLydU1HYWOnK_JYdnwfDDUD4,632320
|
11
|
-
openplx/_TerrainSwig.cp39-win_amd64.pyd,sha256=Cmo6uozx7gGCuQAkbWZBKRNCxFeKXznU_smgdiRXzcc,1536512
|
12
|
-
openplx/_UrdfSwig.cp39-win_amd64.pyd,sha256=JM7b4moSJUKAeOiJ0FN39h8zrKaAXAUMh2-NHXH9ycM,698368
|
13
|
-
openplx/_VehiclesSwig.cp39-win_amd64.pyd,sha256=q_VGwVFRLfM35oiPeB8OmCF-D3jIYzfw2rENGDKMnaA,3124224
|
14
|
-
openplx/_VisualsSwig.cp39-win_amd64.pyd,sha256=75k0ifzbThqsjqsBjfVgkfEOTX7mbc0srzQbGk8x14I,1281024
|
15
|
-
openplx/agxtoopenplx.py,sha256=LCt_tm9tffb0aA5ZsVAqvD1w276NKuq2MQ9vOZS1V1I,2477
|
16
|
-
openplx/anytoopenplx.py,sha256=ckINLkHMyraBaIhdJfVXcaeVNh6m7BnyEx9or3j7mxo,2318
|
17
|
-
openplx/api.py,sha256=XoU3a-t2bNxO71FeBpuGgENsVaR14DrlPpkCE4cJRn8,48252
|
18
|
-
openplx/Core.py,sha256=lQcUoerxSC-TjMSjdNFWGjnQ1eQKVpFJhGl0sTlPkE0,277824
|
19
|
-
openplx/DriveTrain.py,sha256=e3ntEsPnXXhw3LWqNsP78A5aZaMNwd_jDa9cjShmP_g,427468
|
20
|
-
openplx/Math.py,sha256=hi3zI0KfxZNqy8u78nEm55bZGo0ZoWgqA8piOE2e2B8,193933
|
21
|
-
openplx/migrate.py,sha256=SzIjugipKu3fLDpaU91Nh3zZ_jh4h-12sO1dsNroxeU,5738
|
22
|
-
openplx/migration_hint.py,sha256=JiD5f7DzCVNoN-N_VweRNIKnSmCRqxhRof4QiR-1rEs,617
|
23
|
-
openplx/migrations.py,sha256=Rdh3Ebx-XeH-t8gAphcFyIDCADhkeZWTI4vilhxtcjk,15615
|
24
|
-
openplx/openplx_application.py,sha256=wDxdFz5MYjobFg0ofTs9yP0ce6uf_gMr33WLz-BBNJI,6479
|
25
|
-
openplx/openplx_serialize.py,sha256=0_hKFnBP8IQ4f22vW6RLHRRNxUZVSu21Lcrgy6lbqPc,1491
|
26
|
-
openplx/openplx_validate.py,sha256=PgbC1K0OzKC2rknUtqYWXyCca5TKnZdpkg_ZresGvOY,2112
|
27
|
-
openplx/openplx_view.py,sha256=4ISYX0FLsEmdUJyXfixAwyXDsvX5xlTKQLCTEmRCKbM,364
|
28
|
-
openplx/Physics.py,sha256=uoxRlbDAfIJ-uWtAo3W33VXuv_79ZHco4Nw4KEj6Rl8,1920631
|
29
|
-
openplx/Physics1D.py,sha256=zumBcg-GGIW39BXkywKVldM3FtSWhUFX2aLbZFHRahU,352638
|
30
|
-
openplx/Physics3D.py,sha256=Zu70VSG1gbmnvageGT07xIQXXMmNvuICkCfpM0e_Y8I,2480375
|
31
|
-
openplx/Robotics.py,sha256=gaq0xM3ZuhvIINeoKP14xENZqTw_B5px_gh40-m-_mI,814741
|
32
|
-
openplx/Simulation.py,sha256=xab3Q6-d90xNuPk--zjTB-XO8BNEv48equ_Ms48PLf8,47374
|
33
|
-
openplx/Terrain.py,sha256=RhhE6CboZ88n5CbHlyhLzG78vwpjY1sViGgpg7HHuyU,188775
|
34
|
-
openplx/Urdf.py,sha256=Z9Q5dKrSPIEgXS9JE7cYKl4zgkhbrdlmV3vBcORE0KY,24434
|
35
|
-
openplx/Vehicles.py,sha256=ljYCuwGfA-qqQywHdcI530mIzqIq1DNgb1_d2Jmo5_4,458867
|
36
|
-
openplx/versionaction.py,sha256=u0rZ34x1-KtLHM93OBN2BsFAxEAv6HDLadvu14en5io,294
|
37
|
-
openplx/Visuals.py,sha256=xTDmvGIxyJPWSgH20CWwQRPDHwOFp48nBl8fo8sN0JY,190953
|
38
|
-
agx_openplx-0.15.0.dist-info/entry_points.txt,sha256=IyHBVBNuH_4ZhfWnB1ZVXYtpKG_QT7dwGIUMLWdyhrc,263
|
39
|
-
agx_openplx-0.15.0.dist-info/METADATA,sha256=jfj2qYgTFOln0NfOb8u1GhFRNu6UvU-XO-bQtL3_IjU,7875
|
40
|
-
agx_openplx-0.15.0.dist-info/WHEEL,sha256=T7hzPzFWHJiWCVylm2UCj5payilA7ulisMC0IiBEe3o,96
|
41
|
-
agx_openplx-0.15.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|