(use_peg, insert)
return etree.tostring(mjcf, pretty_print=True), common.ASSETS
Returns a tuple containing the model XML string and a dict of assets.
Returns a tuple containing the model XML string and a dict of assets.
Returns a tuple containing the model XML string and a dict of assets .
def make_model(use_peg, insert):
  """Returns a tuple containing the model XML string and a dict of assets."""
  xml_string = common.read_model('manipulator.xml')
  parser = etree.XMLParser(remove_blank_text=True)
  mjcf = etree.XML(xml_string, parser)

  # Select the desired prop.
  if use_peg:
    required_props = ['peg', 'target_peg']
    if insert:
      required_props += ['slot']
  else:
    required_props = ['ball', 'target_ball']
    if insert:
      required_props += ['cup']

  # Remove unused props
  for unused_prop in _ALL_PROPS.difference(required_props):
    prop = xml_tools.find_element(mjcf, 'body', unused_prop)
    prop.getparent().remove(prop)

  return etree.tostring(mjcf, pretty_print=True), common.ASSETS
def make_model ( use_peg , insert ) : xml_string = common . read_model ( 'manipulator.xml' ) parser = etree . XMLParser ( remove_blank_text = True ) mjcf = etree . XML ( xml_string , parser ) # Select the desired prop. if use_peg : required_props = [ 'peg' , 'target_peg' ] if insert : required_props += [ 'slot' ] else : required_props = [ 'ball' , 'target_ball' ] if insert : required_props += [ 'cup' ] # Remove unused props for unused_prop in _ALL_PROPS . difference ( required_props ) : prop = xml_tools . find_element ( mjcf , 'body' , unused_prop ) prop . getparent ( ) . remove ( prop ) return etree . tostring ( mjcf , pretty_print = True ) , common . ASSETS