original_docstring: 
          Updates the internal scene state of the simspark simulation. This is necessary to retrieve the position of the
          simulated agents and of the ball. Simspark sends a 'full scene graph' each time a simulated object is add/removed,
          otherwise a 'sparse scene graph' is send with only the value of the simulated objects which changed. Only the
          position of the agents and the soccerball are extracted and saved, other objects are ignored.
  
          :param data:    the scene graph full/sparse as list of lists
          :return:        None
          
docstring: Updates the internal scene state of the simspark simulation. This is necessary to retrieve the position of the
  simulated agents and of the ball. Simspark sends a 'full scene graph' each time a simulated object is add/removed,
  otherwise a 'sparse scene graph' is send with only the value of the simulated objects which changed. Only the
  position of the agents and the soccerball are extracted and saved, other objects are ignored.
docstring_tokens: Updates the internal scene state of the simspark simulation . This is necessary to retrieve the position of the simulated agents and of the ball . Simspark sends a ' full scene graph ' each time a simulated object is add / removed otherwise a ' sparse scene graph ' is send with only the value of the simulated objects which changed . Only the position of the agents and the soccerball are extracted and saved other objects are ignored .
code: def __update_scene(self, data):
          """
          Updates the internal scene state of the simspark simulation. This is necessary to retrieve the position of the
          simulated agents and of the ball. Simspark sends a 'full scene graph' each time a simulated object is add/removed,
          otherwise a 'sparse scene graph' is send with only the value of the simulated objects which changed. Only the
          position of the agents and the soccerball are extracted and saved, other objects are ignored.
  
          :param data:    the scene graph full/sparse as list of lists
          :return:        None
          """
          name, version, subversion = data[0]
  
          if name == 'RSG':  # Ruby Scene Graph, and indicates that the scene graph is a full description of the environment.
              # clear old scene graph
              del self.__scene[:]
              # apply new scene graph
              for nd in data[1]:
                  # update known objects
                  if len(nd) == 4 and isinstance(nd, list) and len(nd[3]) > 4 and 'soccerball' in nd[3][3][1]:
                      # found soccer ball
                      self.__scene.append({ 'type': 'soccerball', 'x':float(nd[2][13]), 'y':float(nd[2][14]), 'z':float(nd[2][15]) })
                  elif len(nd) >= 4 and len(nd[3]) >= 4 and len(nd[3][3]) >= 4 and len(nd[3][3][3]) >= 4 and 'naobody' in nd[3][3][3][3][1]:
                      # found an agent
                      pose = self.__get_robot_pose(nd[3][2][1:])
                      # set the nao infos
                      self.__scene.append({
                          'type': 'nao',
                          'team': nd[3][3][3][5][2][3:],
                          'number': int(nd[3][3][3][5][1][6:]) if len(nd[3][3][3][5][1])>6 else 0,
                          'x': pose[0],
                          'y': pose[1],
                          'z': pose[2],
                          'r': pose[3]
                      })
                  else:
                      # 'unknown' object
                      self.__scene.append({ 'type': 'node'})
          elif name == 'RDS':  # Ruby Diff Scene, and indicates that the scene graph is a partial description of the environment
              # check scene graph
              if len(self.__scene) == len(data[1]):
                  # iterate through scene objects and update known
                  for i, nd in enumerate(self.__scene):
                      # update ball position, only if changed
                      if nd['type'] == 'soccerball' and len(data[1][i][1]) > 2:
                          ball = self.__scene[i]
                          ball['x'] = float(data[1][i][1][13])
                          ball['y'] = float(data[1][i][1][14])
                          ball['z'] = float(data[1][i][1][15])
                          # notify the managed list of the change!
                          self.__scene[i] = ball
                      elif nd['type'] == 'nao' and len(data[1][i][1]) > 4:
                          robot = self.__scene[i]
                          pose = self.__get_robot_pose(data[1][i][1][1][1:])
                          robot['x'] = pose[0]
                          robot['y'] = pose[1]
                          robot['z'] = pose[2]
                          robot['r'] = pose[3]
                          # notify the managed list of the change!
                          self.__scene[i] = robot
              else:
                  logging.warning('Scene graph mismatch!')
          else:
              logging.warning('invalid scene graph update!')
code_tokens: def __update_scene ( self , data ) : name , version , subversion = data [ 0 ] if name == 'RSG' : del self . __scene [ : ] for nd in data [ 1 ] : if len ( nd ) == 4 and isinstance ( nd , list ) and len ( nd [ 3 ] ) > 4 and 'soccerball' in nd [ 3 ] [ 3 ] [ 1 ] : self . __scene . append ( { 'type' : 'soccerball' , 'x' : float ( nd [ 2 ] [ 13 ] ) , 'y' : float ( nd [ 2 ] [ 14 ] ) , 'z' : float ( nd [ 2 ] [ 15 ] ) } ) elif len ( nd ) >= 4 and len ( nd [ 3 ] ) >= 4 and len ( nd [ 3 ] [ 3 ] ) >= 4 and len ( nd [ 3 ] [ 3 ] [ 3 ] ) >= 4 and 'naobody' in nd [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 1 ] : pose = self . __get_robot_pose ( nd [ 3 ] [ 2 ] [ 1 : ] ) self . __scene . append ( { 'type' : 'nao' , 'team' : nd [ 3 ] [ 3 ] [ 3 ] [ 5 ] [ 2 ] [ 3 : ] , 'number' : int ( nd [ 3 ] [ 3 ] [ 3 ] [ 5 ] [ 1 ] [ 6 : ] ) if len ( nd [ 3 ] [ 3 ] [ 3 ] [ 5 ] [ 1 ] ) > 6 else 0 , 'x' : pose [ 0 ] , 'y' : pose [ 1 ] , 'z' : pose [ 2 ] , 'r' : pose [ 3 ] } ) else : self . __scene . append ( { 'type' : 'node' } ) elif name == 'RDS' : if len ( self . __scene ) == len ( data [ 1 ] ) : for i , nd in enumerate ( self . __scene ) : if nd [ 'type' ] == 'soccerball' and len ( data [ 1 ] [ i ] [ 1 ] ) > 2 : ball = self . __scene [ i ] ball [ 'x' ] = float ( data [ 1 ] [ i ] [ 1 ] [ 13 ] ) ball [ 'y' ] = float ( data [ 1 ] [ i ] [ 1 ] [ 14 ] ) ball [ 'z' ] = float ( data [ 1 ] [ i ] [ 1 ] [ 15 ] ) self . __scene [ i ] = ball elif nd [ 'type' ] == 'nao' and len ( data [ 1 ] [ i ] [ 1 ] ) > 4 : robot = self . __scene [ i ] pose = self . __get_robot_pose ( data [ 1 ] [ i ] [ 1 ] [ 1 ] [ 1 : ] ) robot [ 'x' ] = pose [ 0 ] robot [ 'y' ] = pose [ 1 ] robot [ 'z' ] = pose [ 2 ] robot [ 'r' ] = pose [ 3 ] self . __scene [ i ] = robot else : logging . warning ( 'Scene graph mismatch!' ) else : logging . warning ( 'invalid scene graph update!' )
short_docstring: Updates the internal scene state of the simspark simulation.
short_docstring_tokens: Updates the internal scene state of the simspark simulation .
comment: """
          Updates the internal scene state of the simspark simulation. This is necessary to retrieve the position of the
          simulated agents and of the ball. Simspark sends a 'full scene graph' each time a simulated object is add/removed,
          otherwise a 'sparse scene graph' is send with only the value of the simulated objects which changed. Only the
          position of the agents and the soccerball are extracted and saved, other objects are ignored.
  
          :param data:    the scene graph full/sparse as list of lists
          :return:        None
          """$SEP$# Ruby Scene Graph, and indicates that the scene graph is a full description of the environment.$SEP$# clear old scene graph$SEP$# apply new scene graph$SEP$# update known objects$SEP$# found soccer ball$SEP$# found an agent$SEP$# set the nao infos$SEP$# 'unknown' object$SEP$# Ruby Diff Scene, and indicates that the scene graph is a partial description of the environment$SEP$# check scene graph$SEP$# iterate through scene objects and update known$SEP$# update ball position, only if changed$SEP$# notify the managed list of the change!$SEP$# notify the managed list of the change!