Class CognexConsultant

java.lang.Object
edu.tufts.hrilab.consultant.Consultant<CognexReference>
edu.tufts.hrilab.abb.consultant.cognex.CognexConsultant
All Implemented Interfaces:
ConsultantInterface

public class CognexConsultant extends Consultant<CognexReference> implements ConsultantInterface
  • Field Details

  • Constructor Details

    • CognexConsultant

      public CognexConsultant()
  • Method Details

    • localConvertToType

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

      public <U> U localConvertToType(Symbol refId, Class<U> type, List<? extends Term> constraints)
      Specified by:
      localConvertToType in class Consultant<CognexReference>
    • 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<CognexReference>
      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<CognexReference>
      Returns:
    • addDetectionType

      public Symbol addDetectionType(Symbol descriptor, Symbol jobName)
      Adds a binding between the human descriptor and the name of the job on the cognex, these doesn't necessarily need to be the same. The system should know about all of the job names, but it doesn't have to know about the human producable descriptors?

      Once the binding is done it adds the proerty to the consultant. TODO:brad is there a way we could just get the jobs from the Cognex at start up? thT would make this a lot easier.

      Parameters:
      descriptor - human provided descriptor
      jobName - name of job on the Cognex that is used to detect the thing associated with the provided descriptor
    • createCognexRef

      public CognexReference createCognexRef(CognexJob job, List<Term> additionalProps)
    • getJobForDescriptor

      public CognexJob getJobForDescriptor(String descriptor)
      Parameters:
      descriptor -
      Returns:
    • removeReference

      public CognexReference removeReference(Symbol refId)
    • insertReference

      public boolean insertReference(Symbol refId, CognexReference ref)
    • getNextReferenceId

      protected Symbol getNextReferenceId()
      Generates the new refId based on the refNumber counter, and increments. Informs all other consultants with the same kbName of the current ref being allocated to attempt to maintain sync and avoid duplicating refs.
      Overrides:
      getNextReferenceId in class Consultant<CognexReference>
      Returns:
    • getCognexJobForDescriptor

      public CognexJob getCognexJobForDescriptor(Symbol descriptor)
    • createCogRefWithProps

      public CognexReference createCogRefWithProps(CognexJob j, List<Term> additionalProperties)
    • bindCognexResult

      public void bindCognexResult(CognexReference ref, CognexResult result, int indexIntoCognexResult)
    • getEmptyProps

      public List<Term> getEmptyProps()
    • getCognexJobForCognexReference

      public CognexJob getCognexJobForCognexReference(CognexReference ref)
      Returns the CognexJob able to detect the given reference, if it exists.
      Parameters:
      ref - The CognexReference to fetch the matching CognexJob of.
      Returns:
      The CognexJob associated with this reference.
    • getCognexReferenceForID

      public CognexReference getCognexReferenceForID(Symbol refId)
    • setGraspPointForJob

      public void setGraspPointForJob(CognexJob job, String graspPoint)
    • getGraspPoseForJob

      public String getGraspPoseForJob(CognexJob job)
    • getMatchingResult

      public CognexResult getMatchingResult(CognexReference toReBind, List<CognexResult> results)
    • createCogRefWithProperty

      public Symbol createCogRefWithProperty(Symbol jobDescriptor, Term property)
    • addReference

      public void addReference(CognexReference newRef)
      Description copied from class: Consultant
      Add new reference from some source (file or learning) to the consultant
      Overrides:
      addReference in class Consultant<CognexReference>
      Parameters:
      newRef - new reference to add
    • getActivatedEntities

      public Map<Symbol,Double> getActivatedEntities()
      Description copied from interface: ConsultantInterface
      Get a list of currently highly salient entities that should be considered "activated."
      Specified by:
      getActivatedEntities in interface ConsultantInterface
      Overrides:
      getActivatedEntities in class Consultant<CognexReference>
      Returns:
      list of refIds and probability pairs