(floor_size, remove_ball)
return etree.tostring(mjcf, pretty_print=True)
Sets floor size, removes ball and walls (Stand and Move tasks).
Sets floor size, removes ball and walls (Stand and Move tasks).
Sets floor size removes ball and walls ( Stand and Move tasks ) .
def make_model(floor_size, remove_ball):
  """Sets floor size, removes ball and walls (Stand and Move tasks)."""
  xml_string = common.read_model('dog.xml')
  parser = etree.XMLParser(remove_blank_text=True)
  mjcf = etree.XML(xml_string, parser)

  # set floor size.
  floor = xml_tools.find_element(mjcf, 'geom', 'floor')
  floor.attrib['size'] = str(floor_size) + ' ' + str(floor_size) + ' .1'

  if remove_ball:
    # Remove ball, target and walls.
    ball = xml_tools.find_element(mjcf, 'body', 'ball')
    ball.getparent().remove(ball)
    target = xml_tools.find_element(mjcf, 'geom', 'target')
    target.getparent().remove(target)
    ball_cam = xml_tools.find_element(mjcf, 'camera', 'ball')
    ball_cam.getparent().remove(ball_cam)
    head_cam = xml_tools.find_element(mjcf, 'camera', 'head')
    head_cam.getparent().remove(head_cam)
    for wall_name in ['px', 'nx', 'py', 'ny']:
      wall = xml_tools.find_element(mjcf, 'geom', 'wall_' + wall_name)
      wall.getparent().remove(wall)

  return etree.tostring(mjcf, pretty_print=True)
def make_model ( floor_size , remove_ball ) : xml_string = common . read_model ( 'dog.xml' ) parser = etree . XMLParser ( remove_blank_text = True ) mjcf = etree . XML ( xml_string , parser ) # set floor size. floor = xml_tools . find_element ( mjcf , 'geom' , 'floor' ) floor . attrib [ 'size' ] = str ( floor_size ) + ' ' + str ( floor_size ) + ' .1' if remove_ball : # Remove ball, target and walls. ball = xml_tools . find_element ( mjcf , 'body' , 'ball' ) ball . getparent ( ) . remove ( ball ) target = xml_tools . find_element ( mjcf , 'geom' , 'target' ) target . getparent ( ) . remove ( target ) ball_cam = xml_tools . find_element ( mjcf , 'camera' , 'ball' ) ball_cam . getparent ( ) . remove ( ball_cam ) head_cam = xml_tools . find_element ( mjcf , 'camera' , 'head' ) head_cam . getparent ( ) . remove ( head_cam ) for wall_name in [ 'px' , 'nx' , 'py' , 'ny' ] : wall = xml_tools . find_element ( mjcf , 'geom' , 'wall_' + wall_name ) wall . getparent ( ) . remove ( wall ) return etree . tostring ( mjcf , pretty_print = True )