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

Function _make_body

dm_control/suite/lqr.py:110–137  ·  view source on GitHub ↗

Returns an `etree.Element` defining a body. Args: body_id: Id of the created body. stiffness_range: A tuple of (stiffness_lower_bound, stiffness_uppder_bound). The stiffness of the joint is drawn uniformly from this range. damping_range: A tuple of (damping_lower_bound, damping_

(body_id, stiffness_range, damping_range, random)

Source from the content-addressed store, hash-verified

108
109
110def _make_body(body_id, stiffness_range, damping_range, random):
111 """Returns an `etree.Element` defining a body.
112
113 Args:
114 body_id: Id of the created body.
115 stiffness_range: A tuple of (stiffness_lower_bound, stiffness_uppder_bound).
116 The stiffness of the joint is drawn uniformly from this range.
117 damping_range: A tuple of (damping_lower_bound, damping_upper_bound). The
118 damping of the joint is drawn uniformly from this range.
119 random: A `numpy.random.RandomState` instance.
120
121 Returns:
122 A new instance of `etree.Element`. A body element with two children: joint
123 and geom.
124 """
125 body_name = 'body_{}'.format(body_id)
126 joint_name = 'joint_{}'.format(body_id)
127 geom_name = 'geom_{}'.format(body_id)
128
129 body = etree.Element('body', name=body_name)
130 body.set('pos', '.25 0 0')
131 joint = etree.SubElement(body, 'joint', name=joint_name)
132 body.append(etree.Element('geom', name=geom_name))
133 joint.set('stiffness',
134 str(random.uniform(stiffness_range[0], stiffness_range[1])))
135 joint.set('damping',
136 str(random.uniform(damping_range[0], damping_range[1])))
137 return body
138
139
140def _make_model(n_bodies,

Callers 1

_make_modelFunction · 0.70

Calls 1

setMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…