-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of PackageMap and an ament resource
- Loading branch information
1 parent
14d52a3
commit 543402f
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Shows how to locate and parse a simple model from the ROS 2 ament index. | ||
For more details on the ament index, please see: | ||
https://github.com/ament/ament_cmake/blob/master/ament_cmake_core/doc/resource_index.md | ||
""" # noqa | ||
|
||
import sys | ||
|
||
import pytest | ||
|
||
from pydrake.multibody.parsing import Parser | ||
from pydrake.multibody.plant import MultibodyPlant | ||
|
||
|
||
def test_parse_model(): | ||
plant = MultibodyPlant(time_step=0.0) | ||
parser = Parser(plant) | ||
# TODO(eric.cousineau): Incorporate `AMENT_PREFIX_PATH` into | ||
# PackageMap::PopulateFromRosPackagePath(). | ||
parser.package_map().PopulateFromEnvironment("AMENT_PREFIX_PATH") | ||
# TODO(eric.cousineau): Use a non-test resource. | ||
parser.AddModelsFromUrl( | ||
"package://rviz_default_plugins/test_meshes/test.urdf" | ||
) | ||
plant.Finalize() | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(pytest.main(sys.argv)) |