Class PoseConsultant

java.lang.Object
edu.tufts.hrilab.consultant.Consultant<PoseReference>
edu.tufts.hrilab.consultant.pose.PoseConsultant
All Implemented Interfaces:
ConsultantInterface

public class PoseConsultant extends Consultant<PoseReference>
  • Constructor Details

  • Method Details

    • 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<PoseReference>
      Returns:
    • externalUpdateReferenceNumber

      public void externalUpdateReferenceNumber(int externalCurrentRefNumber)
      Handles updating the refNumber when there are multiple consultants which could be generating new references. Takes the current reference being allocated from the external consultant, and increments its current ref, assuming the passed current ref has been allocated. Logs an error if the external current ref is less than the internal current ref, which indicates that the local consultant value got updated at some point when the external consultant was missed. Does not handle general race conditions wrt simultanous allocations, etc.
      Parameters:
      externalCurrentRefNumber -
    • localConvertToType

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

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

      public String getReferenceSummaries()
      Overrides:
      getReferenceSummaries in class Consultant<PoseReference>
    • getReference

      public PoseReference getReference(Symbol refId)
      Overrides:
      getReference in class Consultant<PoseReference>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • calculateDistance

      public long calculateDistance(Symbol ref1, Symbol ref2)
    • loadReferencesFromFile

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

      public boolean writeReferencesToFile(String filename)
      Write all references to file.
      Parameters:
      filename -
      Returns:
      if write was successful