-
Notifications
You must be signed in to change notification settings - Fork 721
Musculoskeletal dog creation #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vittorione94
wants to merge
9
commits into
google-deepmind:main
Choose a base branch
from
vittorione94:musculoskeletal_dog_creation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
00b1761
musculoskeletal dog creation
vittorione94 e746de3
Merge branch 'google-deepmind:main' into musculoskeletal_dog_creation
vittorione94 6c23c64
reduced texture size
vittorione94 24018b0
Merge branch 'google-deepmind:main' into musculoskeletal_dog_creation
vittorione94 cfe0f57
addressed YT code review changes
vittorione94 96c4eb7
Merge branch 'google-deepmind:main' into musculoskeletal_dog_creation
vittorione94 a909ac1
Merge branch 'google-deepmind:main' into musculoskeletal_dog_creation
vittorione94 9a3230c
Merge branch 'google-deepmind:main' into musculoskeletal_dog_creation
vittorione94 29672b2
removed pyvista and pykdtree dependency
vittorione94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or 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,21 @@ | ||
import build_torso | ||
import build_neck | ||
import add_markers | ||
import build_tail | ||
import create_skin | ||
import build_front_legs | ||
import build_back_legs | ||
import add_muscles | ||
import add_wrapping_geoms | ||
import add_torque_actuators | ||
|
||
build_torso = build_torso.create_torso | ||
build_neck = build_neck.create_neck | ||
add_markers = add_markers.add_markers | ||
build_tail = build_tail.create_tail | ||
create_skin = create_skin.create | ||
build_back_legs = build_back_legs.create_back_legs | ||
build_front_legs = build_front_legs.create_front_legs | ||
add_muscles = add_muscles.add_muscles | ||
add_wrapping_geoms = add_wrapping_geoms.add_wrapping_geoms | ||
add_torque_actuators = add_torque_actuators.add_motors |
75 changes: 75 additions & 0 deletions
75
dm_control/locomotion/walkers/assets/dog_v2/add_markers.py
vittorione94 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,75 @@ | ||
# Copyright 2023 The dm_control Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================ | ||
|
||
"""Add markers to the dog model, used for motion capture tracking.""" | ||
|
||
MARKERS_PER_BODY = { | ||
"torso": ( | ||
(-0.25, 0, 0.13), | ||
(-0.1, 0, 0.13), | ||
(0.05, 0, 0.15), | ||
(-0.25, -0.06, -0.01), | ||
(-0.1, -0.08, -0.02), | ||
(0.05, -0.09, -0.02), | ||
(-0.25, 0.06, -0.01), | ||
(-0.1, 0.08, -0.02), | ||
(0.05, 0.09, -0.02), | ||
), | ||
"C_6": ((0.05, -0.05, 0), (0.05, 0.05, 0),), | ||
"upper_arm": ((0.04, 0, 0),), | ||
"lower_arm": ((0.025, 0, 0), (0.025, 0, -0.1),), | ||
"hand": ((0, -0.02, 0), (0, 0.02, 0), (0.02, -0.02, -0.08), (0.02, 0.02, -0.08),), | ||
"finger": ((0.065, 0, 0),), | ||
"pelvis": ((0.04, -0.07, 0.02), (0.04, 0.07, 0.02),), | ||
"upper_leg": ((-0.03, 0.04, 0),), | ||
"lower_leg": ((0.04, 0, 0), (-0.04, 0.035, 0),), | ||
"foot": ((0, -0.02, 0), (0, 0.02, 0), (0, -0.02, -0.1), (0, 0.03, -0.1),), | ||
"toe": ((0.055, 0, 0),), | ||
"Ca_10": ((0, 0, 0.01),), | ||
"skull": ((0.01, 0, 0.04), (0, -0.05, 0), (0, 0.05, 0), (-0.1, 0, 0.02),), | ||
} | ||
|
||
|
||
def add_markers(model): | ||
vittorione94 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"""Add markers to the given model. | ||
|
||
Args: | ||
model: The model to add markers to. | ||
""" | ||
bodies = model.find_all("body") | ||
|
||
total_markers = 0 | ||
for body in bodies: | ||
for name, markers_pos in MARKERS_PER_BODY.items(): | ||
if name in body.name and "anchor" not in body.name: | ||
marker_idx = 0 | ||
for pos in markers_pos: | ||
pos = list(pos) | ||
if "_R" in body.name: | ||
pos[1] *= -1 | ||
body.add( | ||
"site", | ||
name="marker_" + body.name + "_" + str(marker_idx), | ||
pos=pos, | ||
dclass="marker", | ||
) | ||
|
||
marker_idx += 1 | ||
total_markers += 1 | ||
|
||
for i in range(total_markers): | ||
marker_body = model.worldbody.add( | ||
"body", name="marker_" + str(i), mocap=True) | ||
marker_body.add("site", name="marker_" + str(i), dclass="mocap_marker") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.