agx-openplx 0.15.0__cp310-cp310-manylinux_2_35_x86_64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. agx_openplx-0.15.0.dist-info/METADATA +232 -0
  2. agx_openplx-0.15.0.dist-info/RECORD +41 -0
  3. agx_openplx-0.15.0.dist-info/WHEEL +4 -0
  4. agx_openplx-0.15.0.dist-info/entry_points.txt +8 -0
  5. openplx/Core.py +7781 -0
  6. openplx/DriveTrain.py +8574 -0
  7. openplx/Math.py +5372 -0
  8. openplx/Physics.py +36195 -0
  9. openplx/Physics1D.py +6732 -0
  10. openplx/Physics3D.py +42524 -0
  11. openplx/Robotics.py +15762 -0
  12. openplx/Simulation.py +1056 -0
  13. openplx/Terrain.py +3891 -0
  14. openplx/Urdf.py +654 -0
  15. openplx/Vehicles.py +8793 -0
  16. openplx/Visuals.py +3901 -0
  17. openplx/_AgxOpenPlxPyApi.cpython-310-x86_64-linux-gnu.so +0 -0
  18. openplx/_CorePythonSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  19. openplx/_DriveTrainSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  20. openplx/_MathSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  21. openplx/_Physics1DSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  22. openplx/_Physics3DSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  23. openplx/_PhysicsSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  24. openplx/_RoboticsSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  25. openplx/_SimulationSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  26. openplx/_TerrainSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  27. openplx/_UrdfSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  28. openplx/_VehiclesSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  29. openplx/_VisualsSwig.cpython-310-x86_64-linux-gnu.so +0 -0
  30. openplx/__init__.py +51 -0
  31. openplx/agxtoopenplx.py +55 -0
  32. openplx/anytoopenplx.py +44 -0
  33. openplx/api.py +1337 -0
  34. openplx/migrate.py +136 -0
  35. openplx/migration_hint.py +14 -0
  36. openplx/migrations.py +521 -0
  37. openplx/openplx_application.py +133 -0
  38. openplx/openplx_serialize.py +35 -0
  39. openplx/openplx_validate.py +57 -0
  40. openplx/openplx_view.py +14 -0
  41. openplx/versionaction.py +11 -0
@@ -0,0 +1,232 @@
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
+
@@ -0,0 +1,41 @@
1
+ openplx/Core.py,sha256=8V0Y0pJANycjq8SpFEUmqb3cNiqQbFkRI8IagtcsMFE,270043
2
+ openplx/DriveTrain.py,sha256=c7N8ivmXsfTeGnVSFaEM7-CzKpjOalZK7ZpQqxgjI1Y,418894
3
+ openplx/Math.py,sha256=kTaoNjhQSmvVHmo1WV3z9GdjNvuzPSXFW6kd-UQpJAQ,188561
4
+ openplx/Physics.py,sha256=A2TcVBtnpTh7WJjpRruH1Me70kTBKaIc2k0xCMZNtjs,1884436
5
+ openplx/Physics1D.py,sha256=wix9M9SMRvmGSPrQyCKWdMM7IqdkkVI9Vi7eyrMrfIE,345906
6
+ openplx/Physics3D.py,sha256=5YQwAXEAp-CMP8Ajqvj_QKgTj3Uvp7gWI9vyRsQ5D0A,2437851
7
+ openplx/Robotics.py,sha256=NvqWJbCpk1jDZvJJVi0PijOwOpWZm2OZGZJ1_HegNj8,798979
8
+ openplx/Simulation.py,sha256=mIuypCjz1O6c9_x4O_Ro6GLhOiXRzNlZlVjdgoGYq3U,46318
9
+ openplx/Terrain.py,sha256=9CxizkDVf9UtPIyBumenXzfbxAL6yn2G_d0_ZWbv-JY,184884
10
+ openplx/Urdf.py,sha256=JOryVyaFIROiyJ9V9OMrZAS3MoUwVmJW_2TTPSsRlH4,23780
11
+ openplx/Vehicles.py,sha256=QmtdIawHlYcIRtJH4LotXSQNs06rCpxPl6e5gklUvWg,450074
12
+ openplx/Visuals.py,sha256=lYBFzzPZvMeWaKzXQgzikmO-fuDshcgf5uCJJQ-WKTM,187052
13
+ openplx/_AgxOpenPlxPyApi.cpython-310-x86_64-linux-gnu.so,sha256=Q8PCSxrbn9YMn5R1rx_cXnC80rw3CPYNMCqRDfcndy4,17444504
14
+ openplx/_CorePythonSwig.cpython-310-x86_64-linux-gnu.so,sha256=Rv9sYuuAF3oyiTWQvvQQnMNsgJE4fJ_zLfqktt4odUY,4630832
15
+ openplx/_DriveTrainSwig.cpython-310-x86_64-linux-gnu.so,sha256=eGOu78QAIZjFu0jFxAaSg_HocYxGuLlNTyUbMo0uMWE,9052712
16
+ openplx/_MathSwig.cpython-310-x86_64-linux-gnu.so,sha256=bqCkwcLnyYZ18QYJv-O6IQOp9WQHbS_wrj_vNFrcB_Q,2895048
17
+ openplx/_Physics1DSwig.cpython-310-x86_64-linux-gnu.so,sha256=pDaKv-V6NOQ1FOY6lN2nGA0kUYDG6GqW8wWhjawlvXY,5761112
18
+ openplx/_Physics3DSwig.cpython-310-x86_64-linux-gnu.so,sha256=ROxqbxoJX5_y3irwPTkCayvxfvpBuVg0M6aKf44n_SY,22234272
19
+ openplx/_PhysicsSwig.cpython-310-x86_64-linux-gnu.so,sha256=seZSHTU5ONLmksCsxoyvjIxjc4Ap3l-AelB9l8dfMJg,16498456
20
+ openplx/_RoboticsSwig.cpython-310-x86_64-linux-gnu.so,sha256=4h9U5ROddMujrMWLYDiSsekAsaVBi1IZAql1KmqQLZ4,12675480
21
+ openplx/_SimulationSwig.cpython-310-x86_64-linux-gnu.so,sha256=TA0h7w1D1ubrbkj-m2cPZ-HZ8XgKKjvNw1L4t6C8XTs,3366584
22
+ openplx/_TerrainSwig.cpython-310-x86_64-linux-gnu.so,sha256=ikpWGdpw0thVjFL4mAD6vdfFGoIrC0Mjprb9ZqYHBfM,6783776
23
+ openplx/_UrdfSwig.cpython-310-x86_64-linux-gnu.so,sha256=Y9q24B_WbFBu503c5gMEOtQRKsYA8JeJakdNBXVZB_4,5446792
24
+ openplx/_VehiclesSwig.cpython-310-x86_64-linux-gnu.so,sha256=buAusxRWGBD19Z0RHJsdNDL_yoT3OU78AuBDHPXJVmE,9039936
25
+ openplx/_VisualsSwig.cpython-310-x86_64-linux-gnu.so,sha256=i55K4RsvD9MbJcJgpY_uMjHWcH9ZxvrbNrDQvw9iGWQ,3097304
26
+ openplx/__init__.py,sha256=84JW4DGXG1xhGs6hL701s4_zXS_ksXBfgboChdrwBoE,2050
27
+ openplx/agxtoopenplx.py,sha256=gxQgZ_Pgda_5scCCBBhyu8D-jjL1yxlE7bZLtxigKCs,2422
28
+ openplx/anytoopenplx.py,sha256=qAZVnelFOVAQIpCQt3y9LlfCBHQcNmxUWXFbCZuNQUc,2274
29
+ openplx/api.py,sha256=05ECQBudlYfrMh1OgAYbq8VDsj_UlZKlPxx31RGnES0,46915
30
+ openplx/migrate.py,sha256=Lm3dyiAH-1NUV9xjtCCKOj1GldYkw5DggJM8GO_p4us,5602
31
+ openplx/migration_hint.py,sha256=2Xs2OB_HikmiynDAk4xHKhmU5N4pqOnPFPpeIWhK37Y,603
32
+ openplx/migrations.py,sha256=-j9it2oNK0A4Z-PCPyXRE0UYdU4kMpbVEVoEIjGxkFA,15094
33
+ openplx/openplx_application.py,sha256=VDSsIGCDay8__omhsdKkSRaqmvY_vH6yLHQr3fTzyzA,6346
34
+ openplx/openplx_serialize.py,sha256=Uul2-6_BwyJzg26JdgAz2MjR37mQJ6kWKjPbmE-sJzk,1456
35
+ openplx/openplx_validate.py,sha256=pqBg9WBh7OUi63dOmmCpDWt_jTn8OhCSmtgL-nmb1XY,2055
36
+ openplx/openplx_view.py,sha256=nUca0BVnTTcCzGoj8q2f3QVmZFpKd3PPptjuKqoHA18,350
37
+ openplx/versionaction.py,sha256=Obj_q69dn5GnFMZs2as87ZScPMLaLAduPppmXUzLB6I,283
38
+ agx_openplx-0.15.0.dist-info/METADATA,sha256=jfj2qYgTFOln0NfOb8u1GhFRNu6UvU-XO-bQtL3_IjU,7875
39
+ agx_openplx-0.15.0.dist-info/WHEEL,sha256=9akmB9Yw5qmIU-MKN95Pv0Mip6kpcZ0b8K__D5G3wjE,110
40
+ agx_openplx-0.15.0.dist-info/entry_points.txt,sha256=IyHBVBNuH_4ZhfWnB1ZVXYtpKG_QT7dwGIUMLWdyhrc,263
41
+ agx_openplx-0.15.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-manylinux_2_35_x86_64
@@ -0,0 +1,8 @@
1
+ [console_scripts]
2
+ agxtoopenplx=openplx.agxtoopenplx:run
3
+ anytoopenplx=openplx.anytoopenplx:run
4
+ openplx_migrate=openplx.migrate:run
5
+ openplx_serialize=openplx.openplx_serialize:run
6
+ openplx_validate=openplx.openplx_validate:run
7
+ openplx_view=openplx.openplx_view:run
8
+