cookie_description 1.0.0__tar.gz
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.
- cookie_description-1.0.0/CHANGELOG.md +13 -0
- cookie_description-1.0.0/LICENSE +212 -0
- cookie_description-1.0.0/NOTICE +6 -0
- cookie_description-1.0.0/PKG-INFO +86 -0
- cookie_description-1.0.0/README.md +61 -0
- cookie_description-1.0.0/cookie_description/__init__.py +17 -0
- cookie_description-1.0.0/cookie_description/__main__.py +30 -0
- cookie_description-1.0.0/cookie_description/collision_viser_visualizer.py +96 -0
- cookie_description-1.0.0/cookie_description/meshes/ankle_stator.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/knee_bumper.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/knee_stator.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/mj5208_rotor.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/mj5208_stator.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/oak_d_lite.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/qdd100_rotor.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/qdd100_stator.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/rotor_connector.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/torso.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/wheel_hub.stl +0 -0
- cookie_description-1.0.0/cookie_description/meshes/wheel_tire.stl +0 -0
- cookie_description-1.0.0/cookie_description/paths.py +29 -0
- cookie_description-1.0.0/cookie_description/simulation.py +69 -0
- cookie_description-1.0.0/cookie_description/urdf/cookie.urdf +1187 -0
- cookie_description-1.0.0/cookie_description/visualizer.py +469 -0
- cookie_description-1.0.0/cookie_description/xacro/cookie.xacro +19 -0
- cookie_description-1.0.0/cookie_description/xacro/leg.xacro +228 -0
- cookie_description-1.0.0/cookie_description/xacro/materials.xacro +40 -0
- cookie_description-1.0.0/cookie_description/xacro/torso.xacro +148 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/box_collision_inertial.xacro +17 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/box_inertial.xacro +18 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/bumper_segment.xacro +20 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/cylinder_collision_inertial.xacro +18 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/cylinder_inertial.xacro +18 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/mj5208_joint.xacro +54 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/qdd100_joint.xacro +51 -0
- cookie_description-1.0.0/cookie_description/xacro/utils/virtual_link.xacro +19 -0
- cookie_description-1.0.0/pyproject.toml +174 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
Start this changelog.
|
|
11
|
+
|
|
12
|
+
[unreleased]: https://codeberg.org/stephane-caron/cookie_description/compare/v1.0.0...main
|
|
13
|
+
[1.0.0]: https://codeberg.org/stephane-caron/cookie_description/releases/tag/v1.0.0
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
203
|
+
COOKIE SUBCOMPONENTS:
|
|
204
|
+
|
|
205
|
+
This project includes visual mesh files from mjbots Robotic Systems
|
|
206
|
+
<https://mjbots.com/> and distributed under the Apache License, Version 2.0.
|
|
207
|
+
The original files were the mj5208 CAD model and qdd100 STEP file.
|
|
208
|
+
|
|
209
|
+
This project includes a mesh file distributed under the MIT License at:
|
|
210
|
+
<https://github.com/luxonis/oak-hardware/tree/7d569e3ccdff30014a498dc6c64a2e0dcad6964c/DM9095_OAK-D-LITE_DepthAI_USB3C/3D_Models>.
|
|
211
|
+
The original file was named `DM9095_enclosure.STL`. The mesh was rescaled
|
|
212
|
+
the origin of its coordinate system was centered.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cookie_description
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Robot description for Cookie.
|
|
5
|
+
Author-email: Stéphane Caron <stephane.caron@normalesup.org>
|
|
6
|
+
Maintainer-email: Stéphane Caron <stephane.caron@normalesup.org>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Project-URL: Changelog, https://codeberg.org/stephane-caron/cookie_description/blob/master/CHANGELOG.md
|
|
22
|
+
Project-URL: Source, https://codeberg.org/stephane-caron/cookie_description
|
|
23
|
+
Project-URL: Tracker, https://codeberg.org/stephane-caron/cookie_description/issues
|
|
24
|
+
|
|
25
|
+
# Cookie wheeled biped robot
|
|
26
|
+
|
|
27
|
+
<img src="https://user-images.githubusercontent.com/1189580/169594012-2d685579-2b66-4470-9def-57bd0656b420.png" align="right" width="300">
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/cookie_description/)
|
|
30
|
+
|
|
31
|
+
URDF descriptions for [Cookie](https://github.com/orgs/upkie/discussions/545), an original redesign of [Upkie wheeled bipeds](https://github.com/upkie/upkie).
|
|
32
|
+
|
|
33
|
+
## Trying it out
|
|
34
|
+
|
|
35
|
+
You can use [uv](https://docs.astral.sh/uv/) to check out the robot description directly from the command line:
|
|
36
|
+
|
|
37
|
+
```console
|
|
38
|
+
uvx cookie_description simulation # simulate a Cookie in PyBullet
|
|
39
|
+
uvx cookie_description visualizer # display the Cookie description in Viser
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you have [pixi](https://pixi.prefix.dev/), you can run the same commands with `pixi run`.
|
|
43
|
+
|
|
44
|
+
## Python module
|
|
45
|
+
|
|
46
|
+
The `cookie_description` module helps retrieve the robot description in Python. It can be installed from PyPI:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install cookie_description
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Start by importing it:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import cookie_description
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The module provides the following paths:
|
|
59
|
+
|
|
60
|
+
<dl>
|
|
61
|
+
<dt>
|
|
62
|
+
<code>cookie_description.PATH</code>
|
|
63
|
+
</dt>
|
|
64
|
+
<dd>
|
|
65
|
+
Path to the "cookie_description" folder itself.
|
|
66
|
+
</dd>
|
|
67
|
+
<dt>
|
|
68
|
+
<code>cookie_description.MESHES_PATH</code>
|
|
69
|
+
</dt>
|
|
70
|
+
<dd>
|
|
71
|
+
Path to the "meshes" folder.
|
|
72
|
+
</dd>
|
|
73
|
+
<dt>
|
|
74
|
+
<code>cookie_description.URDF_PATH</code>
|
|
75
|
+
</dt>
|
|
76
|
+
<dd>
|
|
77
|
+
Path to the URDF file of the model.
|
|
78
|
+
</dd>
|
|
79
|
+
<dt>
|
|
80
|
+
<code>cookie_description.XACRO_PATH</code>
|
|
81
|
+
</dt>
|
|
82
|
+
<dd>
|
|
83
|
+
Path to the Xacro file of the model.
|
|
84
|
+
</dd>
|
|
85
|
+
</dl>
|
|
86
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Cookie wheeled biped robot
|
|
2
|
+
|
|
3
|
+
<img src="https://user-images.githubusercontent.com/1189580/169594012-2d685579-2b66-4470-9def-57bd0656b420.png" align="right" width="300">
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/cookie_description/)
|
|
6
|
+
|
|
7
|
+
URDF descriptions for [Cookie](https://github.com/orgs/upkie/discussions/545), an original redesign of [Upkie wheeled bipeds](https://github.com/upkie/upkie).
|
|
8
|
+
|
|
9
|
+
## Trying it out
|
|
10
|
+
|
|
11
|
+
You can use [uv](https://docs.astral.sh/uv/) to check out the robot description directly from the command line:
|
|
12
|
+
|
|
13
|
+
```console
|
|
14
|
+
uvx cookie_description simulation # simulate a Cookie in PyBullet
|
|
15
|
+
uvx cookie_description visualizer # display the Cookie description in Viser
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If you have [pixi](https://pixi.prefix.dev/), you can run the same commands with `pixi run`.
|
|
19
|
+
|
|
20
|
+
## Python module
|
|
21
|
+
|
|
22
|
+
The `cookie_description` module helps retrieve the robot description in Python. It can be installed from PyPI:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
pip install cookie_description
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Start by importing it:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import cookie_description
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The module provides the following paths:
|
|
35
|
+
|
|
36
|
+
<dl>
|
|
37
|
+
<dt>
|
|
38
|
+
<code>cookie_description.PATH</code>
|
|
39
|
+
</dt>
|
|
40
|
+
<dd>
|
|
41
|
+
Path to the "cookie_description" folder itself.
|
|
42
|
+
</dd>
|
|
43
|
+
<dt>
|
|
44
|
+
<code>cookie_description.MESHES_PATH</code>
|
|
45
|
+
</dt>
|
|
46
|
+
<dd>
|
|
47
|
+
Path to the "meshes" folder.
|
|
48
|
+
</dd>
|
|
49
|
+
<dt>
|
|
50
|
+
<code>cookie_description.URDF_PATH</code>
|
|
51
|
+
</dt>
|
|
52
|
+
<dd>
|
|
53
|
+
Path to the URDF file of the model.
|
|
54
|
+
</dd>
|
|
55
|
+
<dt>
|
|
56
|
+
<code>cookie_description.XACRO_PATH</code>
|
|
57
|
+
</dt>
|
|
58
|
+
<dd>
|
|
59
|
+
Path to the Xacro file of the model.
|
|
60
|
+
</dd>
|
|
61
|
+
</dl>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
"""Robot description for Cookie."""
|
|
7
|
+
|
|
8
|
+
from .paths import MESHES_PATH, PATH, URDF_PATH, XACRO_PATH
|
|
9
|
+
|
|
10
|
+
__version__ = "1.0.0"
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"MESHES_PATH",
|
|
14
|
+
"PATH",
|
|
15
|
+
"URDF_PATH",
|
|
16
|
+
"XACRO_PATH",
|
|
17
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
"""Entry point for ``uvx cookie_description <command>``."""
|
|
7
|
+
|
|
8
|
+
import runpy
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
COMMANDS = {
|
|
12
|
+
"simulation": "cookie_description.simulation",
|
|
13
|
+
"visualizer": "cookie_description.visualizer",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main():
|
|
18
|
+
"""Run a cookie_description command."""
|
|
19
|
+
if len(sys.argv) < 2 or sys.argv[1] not in COMMANDS:
|
|
20
|
+
available = ", ".join(sorted(COMMANDS))
|
|
21
|
+
print("Usage: cookie_description <command>")
|
|
22
|
+
print(f"Available commands: {available}")
|
|
23
|
+
sys.exit(1)
|
|
24
|
+
command = sys.argv[1]
|
|
25
|
+
sys.argv = sys.argv[1:] # shift so the submodule sees clean argv
|
|
26
|
+
runpy.run_module(COMMANDS[command], run_name="__main__")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
from pinocchio import visualize
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CollisionViserVisualizer(visualize.ViserVisualizer):
|
|
10
|
+
"""ViserVisualizer that renders collision geometries as wireframes.
|
|
11
|
+
|
|
12
|
+
While making Cookie's URDF, it is useful to overlay collision meshes on top
|
|
13
|
+
of the visual meshes to verify their fit. Viser's alpha-blending is
|
|
14
|
+
order-dependent and doesn't perform depth sorting, so transparent collision
|
|
15
|
+
meshes appear incorrectly from certain viewing angles. We thus render them
|
|
16
|
+
as wireframes.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
_visual_opacity: float = 1.0
|
|
20
|
+
_visual_handles: list # list of (handle, parent_frame_id) pairs
|
|
21
|
+
_collision_handles: list # list of (handle, parent_frame_id) pairs
|
|
22
|
+
|
|
23
|
+
def loadViewerModel(self, *args, **kwargs):
|
|
24
|
+
"""Reset tracked handles before (re)loading the model."""
|
|
25
|
+
self._visual_handles = []
|
|
26
|
+
self._collision_handles = []
|
|
27
|
+
super().loadViewerModel(*args, **kwargs)
|
|
28
|
+
|
|
29
|
+
def loadViewerGeometryObject(self, geometry_object, prefix="", color=None):
|
|
30
|
+
"""Load geometry object with wireframe rendering for collision meshes.
|
|
31
|
+
|
|
32
|
+
Temporarily patches the Viser scene creation methods to inject
|
|
33
|
+
wireframe=True before delegating to the parent implementation. The
|
|
34
|
+
patch is scoped to a single geometry object and cleaned up in a finally
|
|
35
|
+
block.
|
|
36
|
+
"""
|
|
37
|
+
scene = self.viewer.scene
|
|
38
|
+
_METHODS = ("add_box", "add_icosphere", "add_mesh_simple")
|
|
39
|
+
|
|
40
|
+
is_collision = "collision" in prefix
|
|
41
|
+
parent_frame = int(geometry_object.parentFrame)
|
|
42
|
+
|
|
43
|
+
for method_name in _METHODS:
|
|
44
|
+
original = getattr(scene, method_name)
|
|
45
|
+
|
|
46
|
+
def patched(
|
|
47
|
+
*args,
|
|
48
|
+
_orig=original,
|
|
49
|
+
_collision=is_collision,
|
|
50
|
+
_pf=parent_frame,
|
|
51
|
+
**kwargs,
|
|
52
|
+
):
|
|
53
|
+
if _collision:
|
|
54
|
+
kwargs["wireframe"] = True
|
|
55
|
+
kwargs.pop("opacity", None)
|
|
56
|
+
else:
|
|
57
|
+
kwargs["opacity"] = self._visual_opacity
|
|
58
|
+
handle = _orig(*args, **kwargs)
|
|
59
|
+
if _collision:
|
|
60
|
+
self._collision_handles.append((handle, _pf))
|
|
61
|
+
else:
|
|
62
|
+
self._visual_handles.append((handle, _pf))
|
|
63
|
+
return handle
|
|
64
|
+
|
|
65
|
+
setattr(scene, method_name, patched)
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
super().loadViewerGeometryObject(geometry_object, prefix, color)
|
|
69
|
+
finally:
|
|
70
|
+
for method_name in _METHODS:
|
|
71
|
+
delattr(scene, method_name)
|
|
72
|
+
|
|
73
|
+
def set_visual_opacity(self, value: float) -> None:
|
|
74
|
+
"""Update opacity of all loaded visual meshes uniformly."""
|
|
75
|
+
self._visual_opacity = value
|
|
76
|
+
for handle, _ in self._visual_handles:
|
|
77
|
+
handle.opacity = value
|
|
78
|
+
|
|
79
|
+
def set_joint_focus(
|
|
80
|
+
self, highlighted_frames: frozenset, dim_opacity: float = 0.2
|
|
81
|
+
) -> None:
|
|
82
|
+
"""Make parent and child link visuals opaque, dim everything else.
|
|
83
|
+
|
|
84
|
+
Also restricts collision mesh visibility to the highlighted frames.
|
|
85
|
+
"""
|
|
86
|
+
for handle, parent_frame in self._visual_handles:
|
|
87
|
+
handle.opacity = (
|
|
88
|
+
1.0 if parent_frame in highlighted_frames else dim_opacity
|
|
89
|
+
)
|
|
90
|
+
for handle, parent_frame in self._collision_handles:
|
|
91
|
+
handle.visible = parent_frame in highlighted_frames
|
|
92
|
+
|
|
93
|
+
def set_all_collisions_visible(self, visible: bool) -> None:
|
|
94
|
+
"""Set visibility on all individual collision handles."""
|
|
95
|
+
for handle, _ in self._collision_handles:
|
|
96
|
+
handle.visible = visible
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Paths to the URDF package and main description for Cookie.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
# Path to the cookie_description module
|
|
13
|
+
PATH = os.path.dirname(os.path.realpath(__file__))
|
|
14
|
+
|
|
15
|
+
# Path to the meshes folder
|
|
16
|
+
MESHES_PATH = os.path.join(PATH, "meshes")
|
|
17
|
+
|
|
18
|
+
# Path to the robot's URDF
|
|
19
|
+
URDF_PATH = os.path.join(PATH, "urdf", "cookie.urdf")
|
|
20
|
+
|
|
21
|
+
# Path to the robot's Xacro source
|
|
22
|
+
XACRO_PATH = os.path.join(PATH, "xacro", "cookie.xacro")
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"MESHES_PATH",
|
|
26
|
+
"PATH",
|
|
27
|
+
"URDF_PATH",
|
|
28
|
+
"XACRO_PATH",
|
|
29
|
+
]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Load a robot description, specified from the command line, in PyBullet.
|
|
8
|
+
|
|
9
|
+
This example requires PyBullet, which is installed by ``pip install pybullet``.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import math
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
import loop_rate_limiters
|
|
16
|
+
import pybullet
|
|
17
|
+
import pybullet_data
|
|
18
|
+
|
|
19
|
+
from .paths import PATH, URDF_PATH
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
pybullet.connect(pybullet.GUI)
|
|
23
|
+
pybullet.configureDebugVisualizer(pybullet.COV_ENABLE_GUI, 0)
|
|
24
|
+
pybullet.configureDebugVisualizer(pybullet.COV_ENABLE_SHADOWS, 0)
|
|
25
|
+
pybullet.setAdditionalSearchPath(PATH)
|
|
26
|
+
pybullet.setAdditionalSearchPath(os.path.dirname(PATH))
|
|
27
|
+
robot = pybullet.loadURDF(URDF_PATH)
|
|
28
|
+
pybullet.setGravity(0, 0, -9.81)
|
|
29
|
+
pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())
|
|
30
|
+
plane = pybullet.loadURDF("plane.urdf")
|
|
31
|
+
pybullet.resetBasePositionAndOrientation(
|
|
32
|
+
robot, [0, 0, 1.5], [0, 0.5, 0.7, 0.3]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Find hip and knee joint indices
|
|
36
|
+
hip_indices = []
|
|
37
|
+
knee_indices = []
|
|
38
|
+
for i in range(pybullet.getNumJoints(robot)):
|
|
39
|
+
joint_info = pybullet.getJointInfo(robot, i)
|
|
40
|
+
joint_name = joint_info[1].decode("utf-8")
|
|
41
|
+
if joint_info[2] != pybullet.JOINT_REVOLUTE:
|
|
42
|
+
continue
|
|
43
|
+
pybullet.setJointMotorControl2(
|
|
44
|
+
robot, i, pybullet.VELOCITY_CONTROL, force=0
|
|
45
|
+
)
|
|
46
|
+
if "hip" in joint_name:
|
|
47
|
+
hip_indices.append(i)
|
|
48
|
+
elif "knee" in joint_name:
|
|
49
|
+
knee_indices.append(i)
|
|
50
|
+
|
|
51
|
+
rate = loop_rate_limiters.RateLimiter(frequency=200.0)
|
|
52
|
+
pybullet.setTimeStep(rate.dt)
|
|
53
|
+
t = 0.0
|
|
54
|
+
while True:
|
|
55
|
+
hip_target = 0.4 * math.sin(2.0 * math.pi * 0.5 * t)
|
|
56
|
+
knee_target = -2.0 * hip_target
|
|
57
|
+
for idx in hip_indices:
|
|
58
|
+
pybullet.setJointMotorControl2(
|
|
59
|
+
robot, idx, pybullet.POSITION_CONTROL,
|
|
60
|
+
targetPosition=hip_target, force=10.0,
|
|
61
|
+
)
|
|
62
|
+
for idx in knee_indices:
|
|
63
|
+
pybullet.setJointMotorControl2(
|
|
64
|
+
robot, idx, pybullet.POSITION_CONTROL,
|
|
65
|
+
targetPosition=knee_target, force=10.0,
|
|
66
|
+
)
|
|
67
|
+
pybullet.stepSimulation()
|
|
68
|
+
t += rate.dt
|
|
69
|
+
rate.sleep()
|