MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / func

Function func

dm_control/entities/props/duplo/utils.py:66–82  ·  view source on GitHub ↗

Returns +1 if the bricks separate under this force, and -1 otherwise.

(force)

Source from the content-addressed store, hash-verified

64 bound_attachment_frame = physics.bind(attachment_frame)
65
66 def func(force):
67 """Returns +1 if the bricks separate under this force, and -1 otherwise."""
68 with physics.model.disable('gravity'):
69 # Reset the simulation.
70 physics.reset()
71 # Get the initial height.
72 initial_height = bound_attachment_frame.xpos[2]
73 # Apply an upward force to the attachment frame.
74 bound_attachment_frame.xfrc_applied[2] = force
75 # Advance the simulation until either the height threshold or time limit
76 # is reached.
77 while physics.time() < time_limit:
78 physics.step()
79 distance_lifted = bound_attachment_frame.xpos[2] - initial_height
80 if distance_lifted > height_threshold:
81 return 1.0
82 return -1.0
83
84 # Ensure that the min and max forces bracket the true separation force.
85 while func(min_force) > 0:

Callers 14

measure_separation_forceFunction · 0.70
test_unary_operatorMethod · 0.50
test_binary_operatorMethod · 0.50
callMethod · 0.50
wrapped_funcFunction · 0.50
map_materialsFunction · 0.50
testCopyOrPickleModelMethod · 0.50
testCopyOrPickleDataMethod · 0.50

Calls 4

disableMethod · 0.80
resetMethod · 0.45
timeMethod · 0.45
stepMethod · 0.45

Tested by 9

test_unary_operatorMethod · 0.40
test_binary_operatorMethod · 0.40
callMethod · 0.40
testCopyOrPickleModelMethod · 0.40
testCopyOrPickleDataMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…