-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5caf508
commit f37909a
Showing
3 changed files
with
99 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from typing import Sequence | ||
|
||
from bs4 import BeautifulSoup | ||
|
||
|
||
def dump_srdf(disable_collisions: Sequence[dict], srdf_path): | ||
srdf = BeautifulSoup("<robot></robot>", "xml") | ||
for disable_collision in disable_collisions: | ||
tag = srdf.new_tag("disable_collisions") | ||
tag["link1"] = disable_collision["link1"] | ||
tag["link2"] = disable_collision["link2"] | ||
tag["reason"] = disable_collision.get("reason", "Default") | ||
srdf.robot.append(tag) | ||
|
||
srdf_str = srdf.prettify() | ||
with open(srdf_path, "w") as f: | ||
f.write(srdf_str) |