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)
| 108 | |
| 109 | |
| 110 | def _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 | |
| 140 | def _make_model(n_bodies, |
no test coverage detected
searching dependent graphs…