example-robot-data-loaders 6.0.0__2-py313-none-any.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.
@@ -0,0 +1,174 @@
1
+ import sys
2
+ import typing
3
+ from os.path import dirname, exists, join
4
+
5
+ import numpy as np
6
+ import pinocchio as pin
7
+ from pinocchio.robot_wrapper import RobotWrapper
8
+
9
+ try:
10
+ from .path import EXAMPLE_ROBOT_DATA_MODEL_DIR, EXAMPLE_ROBOT_DATA_SOURCE_DIR
11
+ except ImportError:
12
+ pass
13
+
14
+
15
+ def getModelPath(subpath, verbose=False):
16
+ source = dirname(dirname(dirname(__file__))) # top level source directory
17
+ paths = [
18
+ # function called from "make release" in build/ dir
19
+ join(dirname(dirname(dirname(source))), "robots"),
20
+ # function called from a build/ dir inside top level source
21
+ join(dirname(source), "robots"),
22
+ # function called from top level source dir
23
+ join(source, "robots"),
24
+ ]
25
+ try:
26
+ _ = EXAMPLE_ROBOT_DATA_MODEL_DIR
27
+
28
+ # function called from installed project
29
+ paths.append(EXAMPLE_ROBOT_DATA_MODEL_DIR)
30
+ # function called from off-tree build dir
31
+ paths.append(EXAMPLE_ROBOT_DATA_SOURCE_DIR)
32
+ except NameError:
33
+ pass
34
+ paths += [join(p, "../../../share/example-robot-data/robots") for p in sys.path]
35
+ for path in paths:
36
+ if exists(join(path, subpath.strip("/"))):
37
+ if verbose:
38
+ print(f"using {path} as modelPath")
39
+ return path
40
+ raise OSError(f"{subpath} not found")
41
+
42
+
43
+ def readParamsFromSrdf(
44
+ model,
45
+ SRDF_PATH,
46
+ verbose=False,
47
+ has_rotor_parameters=True,
48
+ referencePose="half_sitting",
49
+ ):
50
+ if has_rotor_parameters:
51
+ pin.loadRotorParameters(model, SRDF_PATH, verbose)
52
+ model.armature = np.multiply(
53
+ model.rotorInertia.flat, np.square(model.rotorGearRatio.flat)
54
+ )
55
+ pin.loadReferenceConfigurations(model, SRDF_PATH, verbose)
56
+ q0 = pin.neutral(model)
57
+ if referencePose is not None:
58
+ q0 = model.referenceConfigurations[referencePose].copy()
59
+ q0 = pin.normalize(model, q0)
60
+ return q0
61
+
62
+
63
+ class RobotLoader:
64
+ path = ""
65
+ urdf_filename = ""
66
+ srdf_filename = ""
67
+ sdf_filename = ""
68
+ sdf_root_link_name = ""
69
+ sdf_parent_guidance: typing.ClassVar = []
70
+ urdf_subpath = "robots"
71
+ srdf_subpath = "srdf"
72
+ sdf_subpath = ""
73
+ ref_posture = "half_sitting"
74
+ has_rotor_parameters = False
75
+ free_flyer = False
76
+ model_path = None
77
+
78
+ def __init__(self, verbose=False):
79
+ self.verbose = verbose
80
+ if self.urdf_filename:
81
+ if self.sdf_filename:
82
+ raise AttributeError("Please choose between URDF *or* SDF")
83
+ df_path = join(self.path, self.urdf_subpath, self.urdf_filename)
84
+ builder = RobotWrapper.BuildFromURDF
85
+ if self.model_path is None:
86
+ self.model_path = getModelPath(df_path, self.verbose)
87
+ self.df_path = join(self.model_path, df_path)
88
+ self.robot = builder(
89
+ self.df_path,
90
+ [join(self.model_path, "../..")],
91
+ pin.JointModelFreeFlyer() if self.free_flyer else None,
92
+ )
93
+ else:
94
+ df_path = join(self.path, self.sdf_subpath, self.sdf_filename)
95
+ try:
96
+ builder = RobotWrapper.BuildFromSDF
97
+ if self.model_path is None:
98
+ self.model_path = getModelPath(df_path, self.verbose)
99
+ self.df_path = join(self.model_path, df_path)
100
+ if tuple(int(i) for i in pin.__version__.split(".")) > (2, 9, 1):
101
+ self.robot = builder(
102
+ self.df_path,
103
+ package_dirs=[join(self.model_path, "../..")],
104
+ root_joint=(
105
+ pin.JointModelFreeFlyer() if self.free_flyer else None
106
+ ),
107
+ root_link_name=self.sdf_root_link_name,
108
+ parent_guidance=self.sdf_parent_guidance,
109
+ )
110
+ else:
111
+ self.robot = builder(
112
+ self.df_path,
113
+ package_dirs=[join(self.model_path, "../..")],
114
+ root_joint=(
115
+ pin.JointModelFreeFlyer() if self.free_flyer else None
116
+ ),
117
+ )
118
+ except AttributeError:
119
+ raise ImportError("Building SDF models require pinocchio >= 3.0.0")
120
+
121
+ if self.srdf_filename:
122
+ self.srdf_path = join(
123
+ self.model_path, self.path, self.srdf_subpath, self.srdf_filename
124
+ )
125
+ self.robot.q0 = readParamsFromSrdf(
126
+ self.robot.model,
127
+ self.srdf_path,
128
+ self.verbose,
129
+ self.has_rotor_parameters,
130
+ self.ref_posture,
131
+ )
132
+
133
+ if pin.WITH_COLLISION:
134
+ # Add all collision pairs
135
+ self.robot.collision_model.addAllCollisionPairs()
136
+
137
+ # Remove collision pairs per SRDF
138
+ pin.removeCollisionPairs(
139
+ self.robot.model, self.robot.collision_model, self.srdf_path, False
140
+ )
141
+
142
+ # Recreate collision data since the collision pairs changed
143
+ self.robot.collision_data = self.robot.collision_model.createData()
144
+ else:
145
+ self.srdf_path = None
146
+ self.robot.q0 = pin.neutral(self.robot.model)
147
+ root = getModelPath(self.path)
148
+ self.robot.urdf = join(root, self.path, self.urdf_subpath, self.urdf_filename)
149
+
150
+ if self.free_flyer:
151
+ self.addFreeFlyerJointLimits()
152
+
153
+ def addFreeFlyerJointLimits(self):
154
+ ub = self.robot.model.upperPositionLimit
155
+ ub[:7] = 1
156
+ self.robot.model.upperPositionLimit = ub
157
+ lb = self.robot.model.lowerPositionLimit
158
+ lb[:7] = -1
159
+ self.robot.model.lowerPositionLimit = lb
160
+
161
+ def generate_capsule_name(self, base_name: str, existing_names: list) -> str:
162
+ """Generates a unique capsule name for a geometry object.
163
+
164
+ Args:
165
+ base_name (str): The base name of the geometry object.
166
+ existing_names (list): List of names already assigned to capsules.
167
+
168
+ Returns:
169
+ str: Unique capsule name.
170
+ """
171
+ i = 0
172
+ while f"{base_name}_capsule_{i}" in existing_names:
173
+ i += 1
174
+ return f"{base_name}_capsule_{i}"
@@ -0,0 +1 @@
1
+ prepend-non-duplicate;PYTHONPATH;lib/python3.13/site-packages
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: example-robot-data-loaders
3
+ Version: 6.0.0
4
+ Summary: Set of robot URDFs for benchmarking and developed examples.
5
+ Requires-Python: >=3.9
6
+ License-Expression: BSD-3-Clause
7
+ License-File: LICENSE
8
+ Project-URL: Changelog, https://github.com/Gepetto/example-robot-data/blob/devel/CHANGELOG.md
9
+ Home-page: https://github.com/cmake-wheel/example-robot-data-loaders
10
+ Project-URL: Upstream, https://github.com/gepetto/example-robot-data
11
+ Requires-Dist: cmeel
12
+ Requires-Dist: example-robot-data == 6.0.0
13
+ Requires-Dist: pin
14
+ Provides-Extra: build
15
+ Requires-Dist: pin[build]; extra == "build"
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Example robot URDFs
19
+
20
+ [![pipeline status](https://gitlab.laas.fr/gepetto/example-robot-data/badges/master/pipeline.svg)](https://gitlab.laas.fr/gepetto/example-robot-data/-/commits/master)
21
+ [![conde version](https://img.shields.io/conda/vn/conda-forge/example-robot-data.svg)](https://anaconda.org/conda-forge/example-robot-data)
22
+ [![conde download](https://anaconda.org/conda-forge/example-robot-data/badges/downloads.svg)](https://anaconda.org/conda-forge/example-robot-data)
23
+ [![PyPI version](https://badge.fury.io/py/example-robot-data.svg)](https://badge.fury.io/py/example-robot-data)
24
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gepetto/example-robot-data/master.svg)](https://results.pre-commit.ci/latest/github/gepetto/example-robot-data/master)
25
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
26
+
27
+
28
+ This repository includes a set of robot descriptions that are aimed to be used in benchmarking, unit-tests, teachings,
29
+ tutorials or show-cases. These source files do not intend to substitute their original repositories.
30
+
31
+ ## :penguin: Installation
32
+
33
+ ### :package: From Debian / Ubuntu packages, with [robotpkg](http://robotpkg.openrobots.org)
34
+
35
+ 1. If you have never added robotpkg's software repository, [do it now](http://robotpkg.openrobots.org/debian.html):
36
+ ```bash
37
+ sudo tee /etc/apt/sources.list.d/robotpkg.list <<EOF
38
+ deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -sc) robotpkg
39
+ EOF
40
+
41
+ curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add -
42
+ sudo apt update
43
+ ```
44
+
45
+ 2. installation of example-robot-data and its python utils:
46
+ ```bash
47
+ sudo apt install robotpkg-py3\*-example-robot-data
48
+ ```
49
+
50
+ ### :snake: From <img src="https://s3.amazonaws.com/conda-dev/conda_logo.svg" height="18">
51
+
52
+ As simple as that:
53
+ ```bash
54
+ conda install example-robot-data -c conda-forge
55
+ ```
56
+
57
+ ### :turtle: With ROS
58
+
59
+ Just clone it (with `--recursive`) into a catkin workspace.
60
+
61
+ ### :file_folder: From source
62
+
63
+ Clone it (with `--recursive`), create a `build` directory inside, and:
64
+ ```bash
65
+ cmake .. && make && make install
66
+ ```
67
+
68
+ ## :robot: Show a robot with [gepetto-gui](https://github.com/gepetto/gepetto-viewer-corba)
69
+
70
+ `python -m example_robot_data -h` to list available robots.
71
+
72
+ ## :copyright: Credits
73
+
74
+ ### :writing_hand: Written by
75
+
76
+ - [Carlos Mastalli](https://cmastalli.github.io/), Heriot-Watt University :uk:
77
+ - [Guilhem Saurel](https://github.com/nim65s), LAAS-CNRS :fr:
78
+
79
+ ### :construction_worker: With contributions from
80
+
81
+ - [Justin Carpentier](https://jcarpent.github.io/), INRIA :fr:
82
+ - [Pierre Fernbach](https://pfernbach.github.io/), LAAS-CNRS :fr:
83
+ - [Florent Lamiraux](https://gepettoweb.laas.fr/index.php/Members/FlorentLamiraux), LAAS-CNRS :fr:
84
+ - [Wolfgang Merkt](http://www.wolfgangmerkt.com/research/), University of Oxford :uk:
85
+ - [Josep Martí Saumell](https://www.iri.upc.edu/staff/jmarti), IRI: CSIC-UPC :es:
86
+ - [Louis Montaut](https://lmontaut.github.io/), INRIA :fr:, CTU :czech_republic:
87
+ - [Sergi Martinez](https://www.romilab.org/team/sergi-martinez), Heriot-Watt University :uk:
@@ -0,0 +1,14 @@
1
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/__init__.py,sha256=0lyD9YlRJvYLxV_l3DQm8a4-cA-0fGzOA5wgOhUuxqM,100
2
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/__main__.py,sha256=quK3TThFd-BdVyKaqlv2zh78NaihN2IUj0i_ElnH_AI,423
3
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/human.py,sha256=Z15jHzFo6YmoJvdv7UGZLQB_r1nOcoxv2pTxg8ZiTD8,54997
4
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/panda.py,sha256=Yv2TGH3GA-9ntknxWIuvP3hA04Dcs4vp98R3ycp9_YE,2635
5
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/path.py,sha256=09WHOd9R2C81nqM91eR5RmvqdzjcQb_fBZaEWGXzIK4,256
6
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/robots_loader.py,sha256=syq1qfjyEF23xlhbWiQO37NnuB6ii97YNoAQpGYK5Wo,13405
7
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/talos.py,sha256=7qe1nsDI6IABB5bVupE4T-8pcrnXadYDEssHat8b3dg,3147
8
+ cmeel.prefix/lib/python3.13/site-packages/example_robot_data/utils.py,sha256=20nFPIUd1ScClV0ABvSFjCmMpc96R-UV_Ql6jHKSMrY,6290
9
+ cmeel.prefix/share/example-robot-data/hook/python_path.dsv,sha256=D6cqo4YjImPvt0melLbqjTlofOg69PnUoDRB1HNxnAo,61
10
+ example_robot_data_loaders-6.0.0.dist-info/licenses/LICENSE,sha256=KnA8ca5oHFD2ISur9XxCfCe2UWSY_K9WndPqFnE1nkI,1421
11
+ example_robot_data_loaders-6.0.0.dist-info/METADATA,sha256=mnwlzGQP6WNK2YZ2FfEC-RB__zJg5p6BNzJ6pi7U4Kw,3791
12
+ example_robot_data_loaders-6.0.0.dist-info/WHEEL,sha256=NqmveBolVyqirbZbvnIuYXfmnZ2lc5KxXfmkxoZDUnE,96
13
+ example_robot_data_loaders-6.0.0.dist-info/top_level.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ example_robot_data_loaders-6.0.0.dist-info/RECORD,,
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: cmeel 0.61.0
3
+ Root-Is-Purelib: false
4
+ Tag: py313-none-any
5
+ Build: 2
6
+
@@ -0,0 +1,26 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (C) 2018-2026 LAAS-CNRS, University of Edinburgh, INRIA
4
+ Copyright note valid unless otherwise stated in individual files.
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+
10
+ 1. Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.