Class VisionConsultant

java.lang.Object
edu.tufts.hrilab.consultant.Consultant<VisionReference>
edu.tufts.hrilab.vision.consultant.VisionConsultant
All Implemented Interfaces:
ConsultantInterface, VisionConsultantInterface
Direct Known Subclasses:
MockVisionConsultant, RealVisionConsultant

public abstract class VisionConsultant extends Consultant<VisionReference> implements VisionConsultantInterface
  • Field Details

    • visionTypes

      protected final Map<Long,Set<VisionReference>> visionTypes
      Map from typeId to VisionReference.
    • visionComponent

      protected VisionInterface visionComponent
      To give the consultant access to vision api methods and the STM.
  • Constructor Details

  • Method Details

    • writeReferencesToFile

      public boolean writeReferencesToFile(String filename)
      Write vision references to file using JSON.
      Parameters:
      filename -
      Returns:
    • loadReferencesFromFile

      public void loadReferencesFromFile(String filename)
      Load pre-defined vision references from file via JSON.
      Parameters:
      filename -
    • assertProperties

      public boolean assertProperties(Map<Variable,Symbol> bindings, Double prob, List<Term> properties)
      Description copied from interface: ConsultantInterface
      an attempt is made to bring the knowledge base in line with the provided bindings, list of properties, and probability value.
      Specified by:
      assertProperties in interface ConsultantInterface
      Overrides:
      assertProperties in class Consultant<VisionReference>
      Parameters:
      bindings - list of bindings in tuple form (free-variable and refId pair)
      prob - probability value
      properties - list of Properties
      Returns:
      whether the updated was successful?
    • assertProperties

      public boolean assertProperties(Symbol refId, List<Term> properties)
      Description copied from interface: ConsultantInterface
      Add properties to already existing object ref. Each property should contain a connection to the existing ref either by refId or refId's variable.
      Specified by:
      assertProperties in interface ConsultantInterface
      Overrides:
      assertProperties in class Consultant<VisionReference>
      Returns:
    • getInitialDomain

      public List<Symbol> getInitialDomain(List<Term> query)
      Description copied from interface: ConsultantInterface
      Returns a list of currently known refIds (it takes a seq of Properties, to optionally do some pre-processing to return a list of relevant candidates).
      Specified by:
      getInitialDomain in interface ConsultantInterface
      Overrides:
      getInitialDomain in class Consultant<VisionReference>
      Returns:
      list of currently known ids
    • setTypeId

      public void setTypeId(Symbol objectRef, Long typeId)
    • getTypeId

      public Long getTypeId(Symbol objectRef)
      Description copied from interface: VisionConsultantInterface
      Get the underlying vision typeId associated with the object reference.
      Specified by:
      getTypeId in interface VisionConsultantInterface
      Returns:
    • getTokens

      public List<MemoryObject> getTokens(Symbol objectRef)
      Description copied from interface: VisionConsultantInterface
      Get tokens for an object reference. For now, this method just calls the getTokens method that takes in a typeId. In the future, this should probably not automatically start a visual search, but instead look through LTM which currently doesn't exist.
      Specified by:
      getTokens in interface VisionConsultantInterface
      Returns:
    • getTokenIds

      public List<Long> getTokenIds(Symbol objectRef)
      Description copied from interface: VisionConsultantInterface
      Get token IDs for an object reference. For now, this method just calls the getTokenIds method that takes in a typeId. In the future, this should probably not automatically start a visual search, but instead look through LTM which currently doesn't exist.
      Specified by:
      getTokenIds in interface VisionConsultantInterface
      Returns:
    • removeReference

      public boolean removeReference(Symbol objectRef)
      This method should probably be removed. Only added for object learning hack in AvailableLearners.
      Parameters:
      objectRef -
      Returns:
    • getReferences

      public List<Symbol> getReferences(Long typeId)
      Get POWER reference for vision type ID.
      Parameters:
      typeId -
      Returns:
    • getReferences

      public List<Symbol> getReferences()
      Get all POWER references known to vision.
      Returns:
    • getReferences

      public List<Symbol> getReferences(List<Term> properties)
      Get POWER reference that contain all specified properties.
      Parameters:
      properties -
      Returns:
    • getVariable

      public Variable getVariable(Symbol objectRef)
      Get free-variable for specified object reference.
      Parameters:
      objectRef -
      Returns:
    • localConvertToType

      public <U> U localConvertToType(Symbol refId, Class<U> type)
      Specified by:
      localConvertToType in class Consultant<VisionReference>
    • localConvertToType

      public <U> U localConvertToType(Symbol refId, Class<U> type, List<? extends Term> constraints)
      Specified by:
      localConvertToType in class Consultant<VisionReference>
    • convertToGrasps

      protected List<Grasp> convertToGrasps(MemoryObject mo, List<? extends Term> constraints)
    • convertToType

      protected <U> U convertToType(Object object, Class<U> type)