parameters: (self,camera_transforms=None,marker_transforms=None)
return_statement: return res
docstring: Returns a list of predicted residuals for a given set of camera 
          and marker transforms.
  
          Args:
              camera_transforms (list of se3 elements, optional): length
                  `len(self.cameras)`. If None, then it is assumed that all
                  cameras have transforms (`local_coordinates`) specified.
              marker_transforms (list of se3 elements, optional): length
                  `len(self.markers)`. If None, then it is assumed that all
                  markers have transforms (`local_coordinates`) specified.
          
          Returns:
              A list of residuals (prediction - observed value)
              corresponding to the values in `self.observations`.
docstring_summary: Returns a list of predicted residuals for a given set of camera 
          and marker transforms.
docstring_tokens: Returns a list of predicted residuals for a given set of camera and marker transforms .
function: def predictedResiduals(self,camera_transforms=None,marker_transforms=None) -> List[Vector]:
          """Returns a list of predicted residuals for a given set of camera 
          and marker transforms.
  
          Args:
              camera_transforms (list of se3 elements, optional): length
                  `len(self.cameras)`. If None, then it is assumed that all
                  cameras have transforms (`local_coordinates`) specified.
              marker_transforms (list of se3 elements, optional): length
                  `len(self.markers)`. If None, then it is assumed that all
                  markers have transforms (`local_coordinates`) specified.
          
          Returns:
              A list of residuals (prediction - observed value)
              corresponding to the values in `self.observations`.
          """
          if camera_transforms is None:
              camera_transforms = dict()
          if not isinstance(camera_transforms,dict):
              if len(self.cameras)==1:
                  #be tolerant
                  camera_transforms = {list(self.cameras.keys())[0]:camera_transforms}
          if any(i not in camera_transforms for i,c in self.cameras.items()):
              camera_transforms = camera_transforms.copy()
              for i,c in self.cameras.items():
                  if i not in camera_transforms:
                      print("Reading camera transform",i)
                      camera_transforms[i] = c.local_coordinates
                      if c.local_coordinates is None:
                          raise ValueError("No transform specified for camera {}".format(i))
          if marker_transforms is None:
              marker_transforms = dict()
          if not isinstance(marker_transforms,dict):
              if len(self.markers)==1:
                  #be tolerant
                  marker_transforms = {list(self.markers.keys())[0]:marker_transforms}
          if any(i not in marker_transforms for i,m in self.markers.items()):
              marker_transforms = marker_transforms.copy()
              for i,m in self.markers.items():
                  if i not in marker_transforms:
                      print("Reading marker transform",i)
                      marker_transforms[i] = m.local_coordinates
                      if m.local_coordinates is None:
                          raise ValueError("No transform specified for marker {}".format(i))
              
          res = []
          for o in self.observations:
              cam = self.cameras[o.camera_id]
              if cam.intrinsics is not None:
                  fx,fy,cx,cy = cam.intrinsics['fx'],cam.intrinsics['fy'],cam.intrinsics['cx'],cam.intrinsics['cy']
              marker = self.markers[o.marker_id]
              Tm_local = marker_transforms[o.marker_id]
              Tc_local = camera_transforms[o.camera_id]
              if isinstance(marker,TransformMarker):
                  Tm_c = se3.mul(se3.inv(Tc_local),se3.mul(o.hand_eye_transform,Tm_local))
                  if isinstance(o,PixelObservation):
                      #projection
                      xyz = se3.apply(Tm_c,marker.local_features[o.feature_id])
                      pixel = [fx*xyz[0]/xyz[2] + cx,fy*xyz[1]/xyz[2] + cy]
                      res.append(vectorops.sub(pixel,o.value))
                  elif isinstance(o,PointObservation):
                      #point
                      feature = o.feature_id
                      xyz = se3.apply(Tm_c,marker.local_features[o.feature_id])
                      res.append(vectorops.sub(xyz,o.value))
                  else:
                      #transform
                      res.append(se3.error(Tm_c,o.value))
              else:
                  xyz = se3.apply(se3.inv(Tc_local),se3.apply(o.hand_eye_transform,Tm_local))
                  if isinstance(o,PixelObservation):
                      #projection
                      pixel = [fx*xyz[0]/xyz[2] + cx,fy*xyz[1]/xyz[2] + cy]
                      res.append(vectorops.sub(pixel,o.value))
                  elif isinstance(o,PointObservation):
                      #point
                      res.append(vectorops.sub(xyz,o.value))
                  else:
                      raise ValueError("Uh.. can't get a TransformObservation for a PointMarker")
          return res
function_tokens: def predictedResiduals ( self , camera_transforms = None , marker_transforms = None ) -> List [ Vector ] : if camera_transforms is None : camera_transforms = dict ( ) if not isinstance ( camera_transforms , dict ) : if len ( self . cameras ) == 1 : #be tolerant camera_transforms = { list ( self . cameras . keys ( ) ) [ 0 ] : camera_transforms } if any ( i not in camera_transforms for i , c in self . cameras . items ( ) ) : camera_transforms = camera_transforms . copy ( ) for i , c in self . cameras . items ( ) : if i not in camera_transforms : print ( "Reading camera transform" , i ) camera_transforms [ i ] = c . local_coordinates if c . local_coordinates is None : raise ValueError ( "No transform specified for camera {}" . format ( i ) ) if marker_transforms is None : marker_transforms = dict ( ) if not isinstance ( marker_transforms , dict ) : if len ( self . markers ) == 1 : #be tolerant marker_transforms = { list ( self . markers . keys ( ) ) [ 0 ] : marker_transforms } if any ( i not in marker_transforms for i , m in self . markers . items ( ) ) : marker_transforms = marker_transforms . copy ( ) for i , m in self . markers . items ( ) : if i not in marker_transforms : print ( "Reading marker transform" , i ) marker_transforms [ i ] = m . local_coordinates if m . local_coordinates is None : raise ValueError ( "No transform specified for marker {}" . format ( i ) ) res = [ ] for o in self . observations : cam = self . cameras [ o . camera_id ] if cam . intrinsics is not None : fx , fy , cx , cy = cam . intrinsics [ 'fx' ] , cam . intrinsics [ 'fy' ] , cam . intrinsics [ 'cx' ] , cam . intrinsics [ 'cy' ] marker = self . markers [ o . marker_id ] Tm_local = marker_transforms [ o . marker_id ] Tc_local = camera_transforms [ o . camera_id ] if isinstance ( marker , TransformMarker ) : Tm_c = se3 . mul ( se3 . inv ( Tc_local ) , se3 . mul ( o . hand_eye_transform , Tm_local ) ) if isinstance ( o , PixelObservation ) : #projection xyz = se3 . apply ( Tm_c , marker . local_features [ o . feature_id ] ) pixel = [ fx * xyz [ 0 ] / xyz [ 2 ] + cx , fy * xyz [ 1 ] / xyz [ 2 ] + cy ] res . append ( vectorops . sub ( pixel , o . value ) ) elif isinstance ( o , PointObservation ) : #point feature = o . feature_id xyz = se3 . apply ( Tm_c , marker . local_features [ o . feature_id ] ) res . append ( vectorops . sub ( xyz , o . value ) ) else : #transform res . append ( se3 . error ( Tm_c , o . value ) ) else : xyz = se3 . apply ( se3 . inv ( Tc_local ) , se3 . apply ( o . hand_eye_transform , Tm_local ) ) if isinstance ( o , PixelObservation ) : #projection pixel = [ fx * xyz [ 0 ] / xyz [ 2 ] + cx , fy * xyz [ 1 ] / xyz [ 2 ] + cy ] res . append ( vectorops . sub ( pixel , o . value ) ) elif isinstance ( o , PointObservation ) : #point res . append ( vectorops . sub ( xyz , o . value ) ) else : raise ValueError ( "Uh.. can't get a TransformObservation for a PointMarker" ) return res