Skip to content

Commit c36590f

Browse files
committed
fixed adding markers bug with tuples; updateed directories
1 parent 2c0db7a commit c36590f

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

dm_control/locomotion/walkers/assets/dog_v2/add_markers.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
(-0.1, 0.08, -0.02),
2828
(0.05, 0.09, -0.02),
2929
),
30-
"C_6": ((0.05, -0.05, 0), (0.05, 0.05, 0)),
31-
"upper_arm": ((0.04, 0, 0)),
32-
"lower_arm": ((0.025, 0, 0), (0.025, 0, -0.1)),
33-
"hand": ((0, -0.02, 0), (0, 0.02, 0), (0.02, -0.02, -0.08), (0.02, 0.02, -0.08)),
34-
"finger": ((0.065, 0, 0)),
35-
"pelvis": ((0.04, -0.07, 0.02), (0.04, 0.07, 0.02)),
36-
"upper_leg": ((-0.03, 0.04, 0)),
37-
"lower_leg": ((0.04, 0, 0), (-0.04, 0.035, 0)),
38-
"foot": ((0, -0.02, 0), (0, 0.02, 0), (0, -0.02, -0.1), (0, 0.03, -0.1)),
39-
"toe": ((0.055, 0, 0)),
40-
"Ca_10": ((0, 0, 0.01)),
41-
"skull": ((0.01, 0, 0.04), (0, -0.05, 0), (0, 0.05, 0), (-0.1, 0, 0.02)),
30+
"C_6": ((0.05, -0.05, 0), (0.05, 0.05, 0),),
31+
"upper_arm": ((0.04, 0, 0),),
32+
"lower_arm": ((0.025, 0, 0), (0.025, 0, -0.1),),
33+
"hand": ((0, -0.02, 0), (0, 0.02, 0), (0.02, -0.02, -0.08), (0.02, 0.02, -0.08),),
34+
"finger": ((0.065, 0, 0),),
35+
"pelvis": ((0.04, -0.07, 0.02), (0.04, 0.07, 0.02),),
36+
"upper_leg": ((-0.03, 0.04, 0),),
37+
"lower_leg": ((0.04, 0, 0), (-0.04, 0.035, 0),),
38+
"foot": ((0, -0.02, 0), (0, 0.02, 0), (0, -0.02, -0.1), (0, 0.03, -0.1),),
39+
"toe": ((0.055, 0, 0),),
40+
"Ca_10": ((0, 0, 0.01),),
41+
"skull": ((0.01, 0, 0.04), (0, -0.05, 0), (0, 0.05, 0), (-0.1, 0, 0.02),),
4242
}
4343

4444

@@ -59,6 +59,7 @@ def add_markers(model):
5959
if name in body.name and "anchor" not in body.name:
6060
marker_idx = 0
6161
for pos in markers_pos:
62+
pos = list(pos)
6263
if "_R" in body.name:
6364
pos[1] *= -1
6465
body.add(

dm_control/locomotion/walkers/assets/dog_v2/build_dog.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878

7979
BASE_MODEL = "dog_base.xml"
8080
ASSET_RELPATH = "../../../../suite/dog_assets"
81-
ASSET_DIR = os.path.dirname(__file__) + "/" + ASSET_RELPATH
82-
print(ASSET_DIR)
81+
CURRENT_DIR = os.path.dirname(__file__)
82+
ASSET_DIR = CURRENT_DIR + "/" + ASSET_RELPATH
8383

8484

8585
def exclude_contacts(model):
@@ -187,7 +187,7 @@ def main(argv):
187187
lengthrange_from_joints = FLAGS["lengthrange_from_joints"].default
188188

189189
print("Load base model.")
190-
with open(BASE_MODEL, "r") as f:
190+
with open(os.path.join(CURRENT_DIR, BASE_MODEL), "r") as f:
191191
model = mjcf.from_file(f)
192192

193193
# Helper constants:
@@ -491,7 +491,7 @@ def main(argv):
491491

492492
print("Add <compiler meshdir/>, for locally-loadable model")
493493
compiler = etree.Element(
494-
"compiler", meshdir=ASSET_RELPATH, texturedir=ASSET_RELPATH
494+
"compiler", meshdir=os.path.join(CURRENT_DIR, ASSET_RELPATH), texturedir=os.path.join(CURRENT_DIR, ASSET_RELPATH)
495495
)
496496
root.insert(0, compiler)
497497

@@ -520,7 +520,7 @@ def main(argv):
520520
name = "dog_muscles_{}_{}.xml".format(
521521
muscle_strength_scale, muscle_dynamics)
522522

523-
f = open(name, "wb")
523+
f = open(os.path.join(CURRENT_DIR, name), "wb")
524524
f.write(xml_string)
525525
f.close()
526526

0 commit comments

Comments
 (0)