Package edu.tufts.hrilab.consultant.pose
Class PoseConsultant
java.lang.Object
edu.tufts.hrilab.consultant.Consultant<PoseReference>
edu.tufts.hrilab.consultant.pose.PoseConsultant
- All Implemented Interfaces:
ConsultantInterface
-
Field Summary
Fields inherited from class edu.tufts.hrilab.consultant.Consultant
defaultProperties, kbName, log, propertiesHandled, refConstructor, references, refNumber
-
Constructor Summary
ConstructorsConstructorDescriptionPoseConsultant
(Class<PoseReference> refClass, String kbName, List<String> properties) -
Method Summary
Modifier and TypeMethodDescriptionlong
calculateDistance
(Symbol ref1, Symbol ref2) void
externalUpdateReferenceNumber
(int externalCurrentRefNumber) Handles updating the refNumber when there are multiple consultants which could be generating new references.protected Symbol
Generates the new refId based on the refNumber counter, and increments.getReference
(Symbol refId) void
loadReferencesFromFile
(String filename) Load pre-defined pose references from file via JSON.<U> U
localConvertToType
(Symbol refId, Class<U> type) <U> U
localConvertToType
(Symbol refId, Class<U> type, List<? extends Term> constraints) toString()
boolean
writeReferencesToFile
(String filename) Write all references to file.Methods inherited from class edu.tufts.hrilab.consultant.Consultant
addPropertiesHandled, addReference, assertProperties, assertProperties, convertToType, convertToType, createReference, createReferences, getActivatedEntities, getAssertedProperties, getInitialDomain, getKBName, getPropertiesHandled, getReferencesWithAllProperties, getReferencesWithAnyProperties, notifyNewPropertySubscribers, process, registerForNewPropertyNotification, retractProperties, stripQuotesFromMorpheme, unregisterForNewPropertyNotification
-
Constructor Details
-
PoseConsultant
-
-
Method Details
-
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 classConsultant<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
- Specified by:
localConvertToType
in classConsultant<PoseReference>
-
localConvertToType
- Specified by:
localConvertToType
in classConsultant<PoseReference>
-
getReferenceSummaries
- Overrides:
getReferenceSummaries
in classConsultant<PoseReference>
-
getReference
- Overrides:
getReference
in classConsultant<PoseReference>
-
toString
-
calculateDistance
-
loadReferencesFromFile
Load pre-defined pose references from file via JSON.- Parameters:
filename
-
-
writeReferencesToFile
Write all references to file.- Parameters:
filename
-- Returns:
- if write was successful
-