File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
robot_descriptions/loaders Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to this project will be documented in this file.
44
5+ ## Unreleased
6+
7+ ### Added
8+
9+ - Loader: yourdfpy
10+
511## [ 0.5.0] - 2022/09/19
612
713### Added
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+ #
4+ # Copyright 2022 Stéphane Caron
5+ #
6+ # Licensed under the Apache License, Version 2.0 (the "License");
7+ # you may not use this file except in compliance with the License.
8+ # You may obtain a copy of the License at
9+ #
10+ # http://www.apache.org/licenses/LICENSE-2.0
11+ #
12+ # Unless required by applicable law or agreed to in writing, software
13+ # distributed under the License is distributed on an "AS IS" BASIS,
14+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ # See the License for the specific language governing permissions and
16+ # limitations under the License.
17+
18+ """
19+ Load a robot description in yourdfpy.
20+ """
21+
22+ from importlib import import_module # type: ignore
23+
24+ import yourdfpy
25+
26+
27+ def load_robot_description (description_name : str ) -> yourdfpy .URDF :
28+ """
29+ Load a robot description in yourdfpy.
30+
31+ Args:
32+ description_name: Name of the robot description.
33+
34+ Returns:
35+ Robot model for yourdfpy.
36+ """
37+ module = import_module (f"robot_descriptions.{ description_name } " )
38+ if not hasattr (module , "URDF_PATH" ):
39+ raise ValueError (f"{ description_name } is not a URDF description" )
40+
41+ return yourdfpy .URDF .load (module .URDF_PATH )
You can’t perform that action at this time.
0 commit comments