dartpy 0.1.0.post107__cp312-cp312-win_amd64.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.

Potentially problematic release.


This version of dartpy might be problematic. Click here for more details.

Files changed (68) hide show
  1. OpenThreads.dll +0 -0
  2. assimp-vc143-mt.dll +0 -0
  3. brotlicommon.dll +0 -0
  4. brotlidec.dll +0 -0
  5. bz2.dll +0 -0
  6. ccd.dll +0 -0
  7. console_bridge.dll +0 -0
  8. dartpy-0.1.0.post107.dist-info/LICENSE +31 -0
  9. dartpy-0.1.0.post107.dist-info/METADATA +70 -0
  10. dartpy-0.1.0.post107.dist-info/RECORD +68 -0
  11. dartpy-0.1.0.post107.dist-info/WHEEL +5 -0
  12. dartpy-0.1.0.post107.dist-info/top_level.txt +2 -0
  13. dartpy.cp312-win_amd64.pyd +0 -0
  14. fontconfig-1.dll +0 -0
  15. freetype.dll +0 -0
  16. libexpat.dll +0 -0
  17. libpng16.dll +0 -0
  18. minizip.dll +0 -0
  19. nlopt.dll +0 -0
  20. ode_double.dll +0 -0
  21. osg.dll +0 -0
  22. osgDB.dll +0 -0
  23. osgGA.dll +0 -0
  24. osgShadow.dll +0 -0
  25. osgText.dll +0 -0
  26. osgUtil.dll +0 -0
  27. osgViewer.dll +0 -0
  28. poly2tri.dll +0 -0
  29. pugixml.dll +0 -0
  30. tests/__init__.py +0 -0
  31. tests/integration/__init__.py +0 -0
  32. tests/integration/test_joint_force_torque.py +305 -0
  33. tests/unit/__init__.py +0 -0
  34. tests/unit/collision/__init__.py +0 -0
  35. tests/unit/collision/test_collision.py +249 -0
  36. tests/unit/common/__init__.py +0 -0
  37. tests/unit/common/test_logging.py +20 -0
  38. tests/unit/common/test_stopwatch.py +50 -0
  39. tests/unit/common/test_string.py +42 -0
  40. tests/unit/common/test_uri.py +20 -0
  41. tests/unit/constraint/__init__.py +0 -0
  42. tests/unit/constraint/test_constraint.py +42 -0
  43. tests/unit/dynamics/__init__.py +0 -0
  44. tests/unit/dynamics/test_aspect.py +15 -0
  45. tests/unit/dynamics/test_body_node.py +65 -0
  46. tests/unit/dynamics/test_inertia.py +76 -0
  47. tests/unit/dynamics/test_inverse_kinematics.py +98 -0
  48. tests/unit/dynamics/test_joint.py +149 -0
  49. tests/unit/dynamics/test_meta_skeleton.py +41 -0
  50. tests/unit/dynamics/test_simple_frame.py +54 -0
  51. tests/unit/dynamics/test_skeleton.py +23 -0
  52. tests/unit/math/__init__.py +0 -0
  53. tests/unit/math/test_random.py +40 -0
  54. tests/unit/optimizer/__init__.py +0 -0
  55. tests/unit/optimizer/test_optimizer.py +93 -0
  56. tests/unit/simulation/__init__.py +0 -0
  57. tests/unit/simulation/test_world.py +45 -0
  58. tests/unit/utils/__init__.py +0 -0
  59. tests/unit/utils/test_dart_loader.py +72 -0
  60. tests/unit/utils/test_mjcf_parser.py +19 -0
  61. tests/unit/utils/test_sdf_parser.py +21 -0
  62. tests/unit/utils/test_skel_parser.py +22 -0
  63. tests/unit/v7/__init__.py +0 -0
  64. tests/unit/v7/test_import.py +11 -0
  65. tests/util.py +18 -0
  66. tinyxml2.dll +0 -0
  67. urdfdom_world.dll +0 -0
  68. zlib1.dll +0 -0
OpenThreads.dll ADDED
Binary file
assimp-vc143-mt.dll ADDED
Binary file
brotlicommon.dll ADDED
Binary file
brotlidec.dll ADDED
Binary file
bz2.dll ADDED
Binary file
ccd.dll ADDED
Binary file
console_bridge.dll ADDED
Binary file
@@ -0,0 +1,31 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2011-2016, Humanoid Lab, Georgia Tech Research Corporation
4
+ Copyright (c) 2016-2017, Personal Robotics Lab, Carnegie Mellon University
5
+ Copyright (c) 2011-2019, Graphics Lab, Georgia Tech Research Corporation
6
+ Copyright (c) 2017-2019, Personal Robotics Lab, University of Washington
7
+ Copyright (c) 2017-2019, Open Source Robotics Foundation
8
+ Copyright (c) 2019-2024, The Movement Lab, Stanford University
9
+ Copyright (c) 2019-2024, Jeongseok Lee
10
+ All rights reserved.
11
+
12
+ Redistribution and use in source and binary forms, with or without
13
+ modification, are permitted provided that the following conditions are met:
14
+
15
+ * Redistributions of source code must retain the above copyright notice, this
16
+ list of conditions and the following disclaimer.
17
+
18
+ * Redistributions in binary form must reproduce the above copyright notice,
19
+ this list of conditions and the following disclaimer in the documentation
20
+ and/or other materials provided with the distribution.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: dartpy
3
+ Version: 0.1.0.post107
4
+ Summary: Python API of Dynamic Animation and Robotics Toolkit.
5
+ Home-page: https://github.com/dartsim/dart.git
6
+ Author: Jeongseok Lee
7
+ Author-email: jslee02@gmail.com
8
+ License: BSD 2-Clause
9
+ Keywords: dartsim robotics
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Framework :: Robot Framework
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Requires-Python: >=3.7
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy
22
+ Provides-Extra: test
23
+ Requires-Dist: pytest >=6.0 ; extra == 'test'
24
+
25
+ # DART
26
+
27
+
28
+
29
+ <br>
30
+
31
+ <p align="center">
32
+
33
+ <img src="https://raw.githubusercontent.com/dartsim/dart/master/docs/dart_logo_377x107.jpg" alt="DART: Dynamic Animation and Robotics Toolkit">
34
+
35
+ </p>
36
+
37
+
38
+
39
+ ## Documentation
40
+
41
+
42
+
43
+ For more information on DART, please visit the DART documentation: [English](https://dart.readthedocs.io/) | [한국어](https://dart-ko.readthedocs.io/) (WIP)
44
+
45
+
46
+
47
+ ## Project Status
48
+
49
+
50
+
51
+ | Item | Status |
52
+
53
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+
55
+ | Build | [![CI Ubuntu](https://github.com/dartsim/dart/actions/workflows/ci_ubuntu.yml/badge.svg)](https://github.com/dartsim/dart/actions/workflows/ci_ubuntu.yml) [![CI macOS](https://github.com/dartsim/dart/actions/workflows/ci_macos.yml/badge.svg)](https://github.com/dartsim/dart/actions/workflows/ci_macos.yml) [![CI Windows](https://github.com/dartsim/dart/actions/workflows/ci_windows.yml/badge.svg)](https://github.com/dartsim/dart/actions/workflows/ci_windows.yml) |
56
+
57
+ | Doc, Coverage, Linter | [![API Documentation](https://github.com/dartsim/dart/actions/workflows/api_doc.yml/badge.svg)](https://github.com/dartsim/dart/actions/workflows/api_doc.yml) [![Documentation Status](https://readthedocs.org/projects/dart/badge/?version=latest)](https://dart.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/dartsim/dart/branch/main/graph/badge.svg)](https://codecov.io/gh/dartsim/dart) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/2d95a9b951be4b73a71097670ec351e8)](https://www.codacy.com/gh/dartsim/dart/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=dartsim/dart&amp;utm_campaign=Badge_Grade) |
58
+
59
+ | Packages | [![Packaging status](https://repology.org/badge/vertical-allrepos/dartsim.svg)](https://repology.org/project/dartsim/versions) [![Publish dartpy](https://github.com/dartsim/dart/actions/workflows/publish_dartpy.yml/badge.svg)](https://github.com/dartsim/dart/actions/workflows/publish_dartpy.yml) |
60
+
61
+ | Maintenance | [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/dartsim/dart.svg)](http://isitmaintained.com/project/dartsim/dart "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/dartsim/dart.svg)](http://isitmaintained.com/project/dartsim/dart "Percentage of issues still open") |
62
+
63
+
64
+
65
+ ## Citation
66
+
67
+
68
+
69
+ If you use DART in an academic publication, please consider citing this [JOSS Paper](https://doi.org/10.21105/joss.00500) [[BibTeX](https://gist.github.com/jslee02/998b8809e3ae1b7aef6ef04dd2ad5e27)]
70
+
@@ -0,0 +1,68 @@
1
+ OpenThreads.dll,sha256=xwRI1vSevKegySdNMySXpkZQa1Ne8PZ17bSXTTeTrhI,32768
2
+ assimp-vc143-mt.dll,sha256=qF3gmfMIuttJmISSleHE-5QjWrM93riIBcEykQ-h0EY,5400064
3
+ brotlicommon.dll,sha256=9I4VL8B3ZwH6BGeBQAXJyahU1Cp3-csJmi3EelCSDR4,137216
4
+ brotlidec.dll,sha256=GpXQcJl_qvKCQO8BDYOuK-TMbODwMpe-wNn4MWqfEaA,50176
5
+ bz2.dll,sha256=ZCoakaZjkFYPhkGXrq5Ri6UkCjDD_ffRDIGse6dM0hQ,75264
6
+ ccd.dll,sha256=IJ8ibQVhScsryJp2HrvEA8XPInaqUmrWcluBlU7b5J8,37888
7
+ console_bridge.dll,sha256=LOgqiEg0RZE3bTTSdEVaupsjsz-huiFBqDC0QVCdsEM,24576
8
+ dartpy.cp312-win_amd64.pyd,sha256=Nz8udYsE0woyicTw5ANEXQ5udCYwDa4h8Dl6B6xc4rw,9481216
9
+ fontconfig-1.dll,sha256=8XoIgDiM5NBNNRbRIQw1L0qcNlEJnA-J8j8AA3JmAas,285184
10
+ freetype.dll,sha256=adw4ak368AhMSgmtPBaHq94VHfjWSfE06pbWu2_jTZc,691200
11
+ libexpat.dll,sha256=D2ovnnD4NzVZu3JoNrL1oOx2CoutRJfKimjmZ2WX2kg,157184
12
+ libpng16.dll,sha256=Oxw_87pVsNU-MieE69o1i9ZyAiVsBaePspF78HMvYhg,199680
13
+ minizip.dll,sha256=eWR8UJkJ2xistIlpbpr6zQqfYkleGSLfZFykhREXxgI,47104
14
+ nlopt.dll,sha256=BXc7lG6FTds_S3elgI07rdhqHmOYDUZZRSd1KR25BoA,525824
15
+ ode_double.dll,sha256=gd_PMf4-4xe2_vr40CxpDAztDTIk6Nlj6xA3TKleGY4,707072
16
+ osg.dll,sha256=AE5X8PMikzDSmlqBYiBo6pd6Ep5EEPYtGnsqK0mY8pE,2738688
17
+ osgDB.dll,sha256=6CsezZMSLkXVZ9vGna9U3d6H7F1-bYT1CVZFfYdpv9A,953344
18
+ osgGA.dll,sha256=BWNaYe3vBnIKT9sHCfkKmyD8PvAOyMD0G6LHa1xIGqE,325632
19
+ osgShadow.dll,sha256=mquNEjRLmX4-G2DpxfNbSh6bBgwgbbx77uiSMUswyQM,470528
20
+ osgText.dll,sha256=9STzTG7mA_ZJzujTGlchau4ZHvhJzKLYMgSVQYKGvY8,321536
21
+ osgUtil.dll,sha256=9d_drEtVaKfxWyERxgQwT5-DtaE6HX38ng8LWwVBn8E,1334784
22
+ osgViewer.dll,sha256=a00rDlOEC7dps8FVzTZRvH2HdSxTEca1hyG8Ij1XJ4A,743936
23
+ poly2tri.dll,sha256=5twzwTrV8ToYbCWqayQV14OeBoIA3qqXRIrr0dB8qtg,43008
24
+ pugixml.dll,sha256=DBJ7utB7LfagqIVm_OblDib-B8RItpbELxEhgF9O73Q,190464
25
+ tinyxml2.dll,sha256=qxsav7kiFUBWw3NGg2kvL9u_GhsaQEsbbX7d43WqnkY,95232
26
+ urdfdom_world.dll,sha256=AriC9bXiamguF9ARxh5zDXuM5drsZQrUJqv_WF5puQ8,161792
27
+ zlib1.dll,sha256=DmCyg4ruoOCnnNgTarQfAI6I7Bd5v-iStj2CuhF0ffg,89600
28
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ tests/util.py,sha256=54Hn0E0aD61sKl5xKZ7iM2TtH-OT-ecPvepucfViROc,490
30
+ tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ tests/integration/test_joint_force_torque.py,sha256=lPFlYMGZ--hP-8IOnbkdPejzDLlRmtth8wDvyQGVuyI,10551
32
+ tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ tests/unit/collision/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
+ tests/unit/collision/test_collision.py,sha256=7dlkIxl5-l7H9bt3P24ntsmcu8VCgggWrzNKMdMLTEU,7804
35
+ tests/unit/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ tests/unit/common/test_logging.py,sha256=YRTY-ScNizYeqmpxb2VRhY4uH98m-Lb5WE7VBb0n2WY,435
37
+ tests/unit/common/test_stopwatch.py,sha256=fNWNy-AzUuz3yhn7KHrhqwjxJ8Q18F5RFolCpwsBJzs,1280
38
+ tests/unit/common/test_string.py,sha256=CiXjAhTBMKH6_CuVwGteyflq2uKClxx-QZm8h_SGiew,1562
39
+ tests/unit/common/test_uri.py,sha256=HyXNYoW7p332zNUQRFaAN_-Xbh62MJjHYSP0MEeXjH8,765
40
+ tests/unit/constraint/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ tests/unit/constraint/test_constraint.py,sha256=nw0vv0hGV5Jx7gU3flLqUiK3SXUihJtCgs_V1qXsvmk,1403
42
+ tests/unit/dynamics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ tests/unit/dynamics/test_aspect.py,sha256=s9e5GlIJZ4OEO8c85yUPqvCNlZV9W-fktn7XYwnzc_U,395
44
+ tests/unit/dynamics/test_body_node.py,sha256=TlzI6jM20cPTzlc47x9bKF3zSewoG2kYaOXmLKbYcuw,2197
45
+ tests/unit/dynamics/test_inertia.py,sha256=SdAT2KNQ3fW27x8pgq13T9dXyQIcZ1CEvH8b1A55acg,2202
46
+ tests/unit/dynamics/test_inverse_kinematics.py,sha256=DdCruJpuPnj2HO59gkF5Z6hpYm1ZvVeuq3DyPodXzfI,2798
47
+ tests/unit/dynamics/test_joint.py,sha256=XJv2fHYvrZZTLI2RiLCZ85ZgE00nwSFcTF8luWchmWQ,4588
48
+ tests/unit/dynamics/test_meta_skeleton.py,sha256=KCqZRXx0UnPh8nptCfM_5OszL_YlDzStSdOu8a_m9x4,1107
49
+ tests/unit/dynamics/test_simple_frame.py,sha256=YjIp8b-R3qXLncvw-JyIwD_ClQC-4lku4eAvQGIk9d4,1991
50
+ tests/unit/dynamics/test_skeleton.py,sha256=C-wY5Der2cVl7Y4pHBV-lB8eLpgFBU2p764cSlYKG8A,548
51
+ tests/unit/math/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ tests/unit/math/test_random.py,sha256=2WoH-3lv2iQQrCKZXN914GNuCpmhC5wXafHUr7LJ_Wk,828
53
+ tests/unit/optimizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
+ tests/unit/optimizer/test_optimizer.py,sha256=fegkKe0DR5vLqFBlxwWOEK9HrZcglWGrv7RL05InwP0,2584
55
+ tests/unit/simulation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
+ tests/unit/simulation/test_world.py,sha256=yT0TknYuLF1kl-hhC3COnOs0ivfXUZ9gABSeoQqrXN0,1362
57
+ tests/unit/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ tests/unit/utils/test_dart_loader.py,sha256=Oq_5mfogGFFUXkNFTAgPBE1yAjk7Vgkl0DRl93hjlkI,2288
59
+ tests/unit/utils/test_mjcf_parser.py,sha256=RD-5ZLK0IeqtA2Zth07-1SznjSSuLlBzhOfZUZbhJho,357
60
+ tests/unit/utils/test_sdf_parser.py,sha256=Tiea-pVHC2ZE7dsMhPPykbc5L2IHxtQTYanuFLgAQXw,491
61
+ tests/unit/utils/test_skel_parser.py,sha256=a_nTYkT5yBPWNqOSow5bEMPALgJUb3Owvu8PBzkZzyI,577
62
+ tests/unit/v7/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
+ tests/unit/v7/test_import.py,sha256=ih2zs8JCYUEf1mBPTbjVZLSPrL3miQQ5HI0OWGfC5bo,154
64
+ dartpy-0.1.0.post107.dist-info/LICENSE,sha256=4DWlDbIdXGvZMkvRwozhkDtn4QjniOiacm_E6R1b8Js,1771
65
+ dartpy-0.1.0.post107.dist-info/METADATA,sha256=tYp7VHbWbcrqxx6ozkt0h82k4aCp47BZCU4RiDYhCzM,5657
66
+ dartpy-0.1.0.post107.dist-info/WHEEL,sha256=fZWyj_84lK0cA-ZNCsdwhbJl0OTrpWkxInEn424qrSs,102
67
+ dartpy-0.1.0.post107.dist-info/top_level.txt,sha256=uS54APWVBb-a3RHZ0OUaZMgYA3_YFTZ-6m_1uYJFlls,18
68
+ dartpy-0.1.0.post107.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
5
+
@@ -0,0 +1,2 @@
1
+ dartpy_math
2
+ tests
Binary file
fontconfig-1.dll ADDED
Binary file
freetype.dll ADDED
Binary file
libexpat.dll ADDED
Binary file
libpng16.dll ADDED
Binary file
minizip.dll ADDED
Binary file
nlopt.dll ADDED
Binary file
ode_double.dll ADDED
Binary file
osg.dll ADDED
Binary file
osgDB.dll ADDED
Binary file
osgGA.dll ADDED
Binary file
osgShadow.dll ADDED
Binary file
osgText.dll ADDED
Binary file
osgUtil.dll ADDED
Binary file
osgViewer.dll ADDED
Binary file
poly2tri.dll ADDED
Binary file
pugixml.dll ADDED
Binary file
tests/__init__.py ADDED
File without changes
File without changes
@@ -0,0 +1,305 @@
1
+ import math
2
+
3
+ import dartpy as dart
4
+ import numpy as np
5
+ import pytest
6
+
7
+
8
+ def read_world(uri: dart.common.Uri):
9
+ options = dart.utils.SdfParser.Options()
10
+ options.mDefaultRootJointType = dart.utils.SdfParser.RootJointType.FIXED
11
+ world = dart.utils.SdfParser.readWorld(uri, options)
12
+ for i in range(world.getNumSkeletons()):
13
+ skel = world.getSkeleton(i)
14
+ for j in range(skel.getNumJoints()):
15
+ joint = skel.getJoint(j)
16
+ joint.setLimitEnforcement(True)
17
+ return world
18
+
19
+
20
+ def test_static():
21
+ # Load world
22
+ world = read_world("dart://sample/sdf/test/force_torque_test.world")
23
+ assert world is not None
24
+ assert world.getNumSkeletons() == 1
25
+
26
+ # Check if the world is correctly loaded
27
+ model_1 = world.getSkeleton(0)
28
+ assert model_1 is not None
29
+ assert model_1.getName() == "model_1"
30
+ assert model_1.getNumBodyNodes() == 2
31
+ assert model_1.getNumJoints() == 2
32
+
33
+ world.setGravity([0, 0, -50])
34
+
35
+ # Simulate 1 step
36
+ world.step()
37
+ t = world.getTime()
38
+
39
+ # Get time step size
40
+ dt = world.getTimeStep()
41
+ assert dt > 0
42
+ assert t == pytest.approx(dt)
43
+
44
+ # Get joint and get force torque
45
+ link_1 = model_1.getBodyNode("link_1")
46
+ assert link_1 is not None
47
+ link_2 = model_1.getBodyNode("link_2")
48
+ assert link_2 is not None
49
+ joint_01 = model_1.getJoint("joint_01")
50
+ assert joint_01 is not None
51
+ joint_12 = model_1.getJoint("joint_12")
52
+ assert joint_12 is not None
53
+
54
+ tf = dart.math.Isometry3()
55
+
56
+ # Run 10 steps
57
+ for _ in range(10):
58
+ world.step()
59
+
60
+ # ----------------------
61
+ # Test joint_01 wrench
62
+ # ----------------------
63
+
64
+ # Reference adjustment for the difference of the joint frame conventions
65
+ # between Gazebo and DART
66
+ tf.set_identity()
67
+ tf.set_translation(joint_01.getTransformFromParentBodyNode().translation())
68
+ parent_frame01 = dart.dynamics.SimpleFrame(
69
+ dart.dynamics.Frame.World(), "parent_frame01", tf
70
+ )
71
+ tf.set_identity()
72
+ tf.set_translation(joint_01.getTransformFromChildBodyNode().translation())
73
+ child_frame01 = dart.dynamics.SimpleFrame(link_1, "child_frame01", tf)
74
+
75
+ parent_f01 = joint_01.getWrenchToParentBodyNode(parent_frame01)
76
+ assert (parent_f01 == [0, 0, 0, 0, 0, 1000]).all()
77
+
78
+ child_f01 = joint_01.getWrenchToChildBodyNode(child_frame01)
79
+ assert (child_f01 == -parent_f01).all()
80
+
81
+ # ----------------------
82
+ # Test joint_12 wrench
83
+ # ----------------------
84
+
85
+ # Reference adjustment for the difference of the joint frame conventions
86
+ # between Gazebo and DART
87
+ tf.set_identity()
88
+ tf.set_translation(joint_12.getTransformFromParentBodyNode().translation())
89
+ parent_frame12 = dart.dynamics.SimpleFrame(link_1, "parent_frame12", tf)
90
+ tf.set_identity()
91
+ tf.set_translation(joint_12.getTransformFromChildBodyNode().translation())
92
+ child_frame12 = dart.dynamics.SimpleFrame(link_2, "child_frame12", tf)
93
+
94
+ parent_f12 = joint_12.getWrenchToParentBodyNode(parent_frame12)
95
+ assert (parent_f12 == [0, 0, 0, 0, 0, 500]).all()
96
+
97
+ child_f12 = joint_12.getWrenchToChildBodyNode(child_frame12)
98
+ assert (child_f12 == -parent_f12).all()
99
+
100
+
101
+ def test_force_torque_at_joint_limits():
102
+ # Load world
103
+ world = read_world("dart://sample/sdf/test/force_torque_test.world")
104
+ assert world is not None
105
+ assert world.getNumSkeletons() == 1
106
+
107
+ # Check if the world is correctly loaded
108
+ model_1 = world.getSkeleton(0)
109
+ assert model_1 is not None
110
+ assert model_1.getName() == "model_1"
111
+ assert model_1.getNumBodyNodes() == 2
112
+ assert model_1.getNumJoints() == 2
113
+
114
+ world.setGravity([0, 0, -50])
115
+
116
+ # Simulate 1 step
117
+ world.step()
118
+ t = world.getTime()
119
+
120
+ # Get time step size
121
+ dt = world.getTimeStep()
122
+ assert dt > 0
123
+ assert t == pytest.approx(dt)
124
+
125
+ # Get joint and get force torque
126
+ link_1 = model_1.getBodyNode("link_1")
127
+ assert link_1 is not None
128
+ link_2 = model_1.getBodyNode("link_2")
129
+ assert link_2 is not None
130
+ joint_01 = model_1.getJoint("joint_01")
131
+ assert joint_01 is not None
132
+ joint_12 = model_1.getJoint("joint_12")
133
+ assert joint_12 is not None
134
+
135
+ # Change gravity so that the top link topples over, then remeasure
136
+ world.setGravity([-30, 10, -50])
137
+
138
+ # Wait for dynamics to be stabilized
139
+ for i in range(2000):
140
+ world.step()
141
+
142
+ tf = dart.math.Isometry3()
143
+
144
+ # Run 5 steps
145
+ for _ in range(5):
146
+ world.step()
147
+
148
+ # ----------------------
149
+ # Test joint_01 wrench
150
+ # ----------------------
151
+
152
+ # Reference adjustment for the difference of the joint frame conventions
153
+ # between Gazebo and DART
154
+ tf.set_identity()
155
+ tf.set_translation(joint_01.getTransformFromParentBodyNode().translation())
156
+ parent_frame01 = dart.dynamics.SimpleFrame(
157
+ dart.dynamics.Frame.World(), "parent_frame01", tf
158
+ )
159
+ tf.set_identity()
160
+ tf.set_translation(joint_01.getTransformFromChildBodyNode().translation())
161
+ child_frame01 = dart.dynamics.SimpleFrame(link_1, "child_frame01", tf)
162
+
163
+ parent_f01 = joint_01.getWrenchToParentBodyNode(parent_frame01)
164
+ assert np.isclose(
165
+ parent_f01, [750, 0, -450, 600, -200, 1000], rtol=0.1, atol=4.5
166
+ ).all()
167
+
168
+ child_f01 = joint_01.getWrenchToChildBodyNode(child_frame01)
169
+ assert np.isclose(
170
+ child_f01, [-750, -450, 0, -600, 1000, 200], rtol=0.1, atol=4.5
171
+ ).all()
172
+
173
+ # ----------------------
174
+ # Test joint_12 wrench
175
+ # ----------------------
176
+
177
+ # Reference adjustment for the difference of the joint frame conventions
178
+ # between Gazebo and DART
179
+ tf.set_identity()
180
+ tf.set_translation(joint_12.getTransformFromParentBodyNode().translation())
181
+ parent_frame12 = dart.dynamics.SimpleFrame(link_1, "parent_frame12", tf)
182
+ tf.set_identity()
183
+ tf.set_translation(joint_12.getTransformFromChildBodyNode().translation())
184
+ child_frame12 = dart.dynamics.SimpleFrame(link_2, "child_frame12", tf)
185
+
186
+ parent_f12 = joint_12.getWrenchToParentBodyNode(parent_frame12)
187
+ assert np.isclose(
188
+ parent_f12, [250, 150, 0, 300, -500, -100], rtol=0.1, atol=0.1
189
+ ).all()
190
+
191
+ child_f12 = joint_12.getWrenchToChildBodyNode(child_frame12)
192
+ assert np.isclose(
193
+ child_f12, [-250, -150, 0, -300, 500, 100], rtol=0.1, atol=0.1
194
+ ).all()
195
+
196
+
197
+ def test_force_torque_at_joint_limits_with_external_forces():
198
+ # Load world
199
+ world = read_world("dart://sample/sdf/test/force_torque_test2.world")
200
+ assert world is not None
201
+ assert world.getNumSkeletons() == 1
202
+
203
+ # Check if the world is correctly loaded
204
+ model_1 = world.getSkeleton(0)
205
+ assert model_1 is not None
206
+ assert model_1.getName() == "boxes"
207
+ assert model_1.getNumBodyNodes() == 3
208
+ assert model_1.getNumJoints() == 3
209
+ assert model_1.getNumDofs() == 2
210
+
211
+ # The first joint is fixed joint
212
+ assert model_1.getRootJoint().getType() == dart.dynamics.WeldJoint.getStaticType()
213
+
214
+ world.setGravity([0, 0, -50])
215
+
216
+ # Simulate 1 step
217
+ world.step()
218
+ t = world.getTime()
219
+
220
+ # Get time step size
221
+ dt = world.getTimeStep()
222
+ assert dt > 0
223
+ assert t == pytest.approx(dt)
224
+
225
+ # Get joint and get force torque
226
+ link_1 = model_1.getBodyNode("link1")
227
+ assert link_1 is not None
228
+ link_2 = model_1.getBodyNode("link2")
229
+ assert link_2 is not None
230
+ link_3 = model_1.getBodyNode("link3")
231
+ assert link_3 is not None
232
+ joint_12 = model_1.getJoint("joint1")
233
+ assert joint_12 is not None
234
+ joint_23 = model_1.getJoint("joint2")
235
+ assert joint_23 is not None
236
+
237
+ tf = dart.math.Isometry3()
238
+
239
+ # Run 45005 steps
240
+ kp1 = 5e4
241
+ kp2 = 1e4
242
+ target1 = 0
243
+ target2 = -0.25 * math.pi
244
+ steps = 4500
245
+ for _ in range(steps):
246
+ # PD control
247
+ j1_state = joint_12.getPosition(0)
248
+ j2_state = joint_23.getPosition(0)
249
+ p1_error = target1 - j1_state
250
+ p2_error = target2 - j2_state
251
+ effort1 = kp1 * p1_error
252
+ effort2 = kp2 * p2_error
253
+ joint_12.setForce(0, effort1)
254
+ joint_23.setForce(0, effort2)
255
+
256
+ world.step()
257
+
258
+ assert joint_12.getPosition(0) == pytest.approx(target1, abs=1e-1)
259
+ assert joint_23.getPosition(0) == pytest.approx(target2, abs=1e-1)
260
+
261
+ tol = 2
262
+
263
+ # ----------------------
264
+ # Test joint_12 wrench
265
+ # ----------------------
266
+
267
+ # Reference adjustment for the difference of the joint frame conventions
268
+ # between Gazebo and DART
269
+ tf.set_identity()
270
+ tf.set_translation(joint_12.getTransformFromParentBodyNode().translation())
271
+ parent_frame01 = dart.dynamics.SimpleFrame(link_1, "parent_frame01", tf)
272
+ tf.set_identity()
273
+ tf.set_translation(joint_12.getTransformFromChildBodyNode().translation())
274
+ child_frame01 = dart.dynamics.SimpleFrame(link_2, "child_frame01", tf)
275
+
276
+ parent_f01 = joint_12.getWrenchToParentBodyNode(parent_frame01)
277
+ assert np.isclose(parent_f01, [25, -175, 0, 0, 0, 300], rtol=0.01, atol=tol).all()
278
+
279
+ child_f01 = joint_12.getWrenchToChildBodyNode(child_frame01)
280
+ assert np.isclose(child_f01, [-25, 175, 0, 0, 0, -300], rtol=0.01, atol=tol).all()
281
+
282
+ # ----------------------
283
+ # Test joint_23 wrench
284
+ # ----------------------
285
+
286
+ # Reference adjustment for the difference of the joint frame conventions
287
+ # between Gazebo and DART
288
+ tf.set_identity()
289
+ tf.set_translation(joint_23.getTransformFromParentBodyNode().translation())
290
+ parent_frame12 = dart.dynamics.SimpleFrame(link_2, "parent_frame12", tf)
291
+ tf.set_identity()
292
+ tf.set_translation(joint_23.getTransformFromChildBodyNode().translation())
293
+ child_frame12 = dart.dynamics.SimpleFrame(link_3, "child_frame12", tf)
294
+
295
+ parent_f12 = joint_23.getWrenchToParentBodyNode(parent_frame12)
296
+ assert np.isclose(parent_f12, [25, 0, 0, 0, 0, 50], rtol=0.01, atol=tol).all()
297
+
298
+ child_f12 = joint_23.getWrenchToChildBodyNode(child_frame12)
299
+ assert np.isclose(
300
+ child_f12, [-17.678, 0, 17.679, -35.355, 0, -35.355], rtol=0.01, atol=tol
301
+ ).all()
302
+
303
+
304
+ if __name__ == "__main__":
305
+ pytest.main()
tests/unit/__init__.py ADDED
File without changes
File without changes