(self, walker, size=0.01, rgba=(0., 0., 1., .3),
                       default_to_random_position=True, random_state=None)
return sites
Adds sites corresponding to mocap tracking markers.
Adds sites corresponding to mocap tracking markers.
Adds sites corresponding to mocap tracking markers .
def add_marker_sites(self, walker, size=0.01, rgba=(0., 0., 1., .3),
                       default_to_random_position=True, random_state=None):
    """Adds sites corresponding to mocap tracking markers."""
    self.check_walker_is_compatible(walker)
    random_state = random_state or np.random
    sites = []
    if self._proto.markers:
      mocap_class = walker.mjcf_model.default.add('default', dclass='mocap')
      mocap_class.site.set_attributes(type='sphere', size=(size,), rgba=rgba,
                                      group=composer.SENSOR_SITES_GROUP)
    for marker_info in self._proto.markers.marker:
      body = walker.mjcf_model.find('body', marker_info.parent)
      if not body:
        raise ValueError('Walker model does not contain a body named {!r}'
                         .format(str(marker_info.parent)))
      pos = marker_info.position
      if not pos:
        if default_to_random_position:
          pos = random_state.uniform(-0.005, 0.005, size=3)
        else:
          pos = np.zeros(3)
      sites.append(
          body.add(
              'site', name=str(marker_info.name), pos=pos, dclass=mocap_class))
    walker.list_of_site_names = [site.name for site in sites]
    return sites
def add_marker_sites ( self , walker , size = 0.01 , rgba = ( 0. , 0. , 1. , .3 ) , default_to_random_position = True , random_state = None ) : self . check_walker_is_compatible ( walker ) random_state = random_state or np . random sites = [ ] if self . _proto . markers : mocap_class = walker . mjcf_model . default . add ( 'default' , dclass = 'mocap' ) mocap_class . site . set_attributes ( type = 'sphere' , size = ( size , ) , rgba = rgba , group = composer . SENSOR_SITES_GROUP ) for marker_info in self . _proto . markers . marker : body = walker . mjcf_model . find ( 'body' , marker_info . parent ) if not body : raise ValueError ( 'Walker model does not contain a body named {!r}' . format ( str ( marker_info . parent ) ) ) pos = marker_info . position if not pos : if default_to_random_position : pos = random_state . uniform ( - 0.005 , 0.005 , size = 3 ) else : pos = np . zeros ( 3 ) sites . append ( body . add ( 'site' , name = str ( marker_info . name ) , pos = pos , dclass = mocap_class ) ) walker . list_of_site_names = [ site . name for site in sites ] return sites