25 #include "asr_object_database/ObjectMetaData.h" 26 #include "asr_world_model/GetRecognizerName.h" 27 #include "asr_world_model/GetIntermediateObjectWeight.h" 53 <asr_object_database::ObjectMetaData>(
"/asr_object_database/object_meta_data");
55 <asr_world_model::GetRecognizerName>(
"/env/asr_world_model/get_recognizer_name");
56 intermediate_object_weight_service_client = mNodeHandle.
serviceClient 57 <asr_world_model::GetIntermediateObjectWeight>(
"/env/asr_world_model/get_intermediate_object_weight");
76 ObjectMetaDataResponsePtr responsePtr = statePtr->object_metadata_cache[objectTypeName];
79 asr_world_model::GetRecognizerName getRecognizerName;
80 getRecognizerName.request.object_type = objectTypeName;
82 if (!statePtr->recognizer_name_service_client.exists()) {
83 ROS_ERROR_STREAM(
"/env/asr_world_model/get_recognizer_name service is not available");
85 statePtr->recognizer_name_service_client.call(getRecognizerName);
87 std::string recognizer = getRecognizerName.response.recognizer_name;
89 if (recognizer.compare(
"") == 0) {
90 ROS_ERROR_STREAM(
"No recognizer name received from world_model for object type " << objectTypeName <<
".");
93 asr_object_database::ObjectMetaData objectMetaData;
94 objectMetaData.request.object_type = objectTypeName;
95 objectMetaData.request.recognizer = recognizer;
97 if (!statePtr->object_metadata_service_client.exists()) {
98 ROS_ERROR_STREAM(
"/asr_object_database/object_meta_data service is not available");
101 statePtr->object_metadata_service_client.call(objectMetaData);
103 if (!objectMetaData.response.is_valid) {
104 ROS_ERROR_STREAM(
"objectMetadata response is not valid for object type " << objectTypeName);
109 statePtr->object_metadata_cache[objectTypeName] = responsePtr;
120 IntermediateObjectWeightResponsePtr responsePtr = statePtr->intermediate_object_cache[objectTypeName];
123 asr_world_model::GetIntermediateObjectWeight getIntermediateObjectWeight;
124 getIntermediateObjectWeight.request.object_type = objectTypeName;
126 if (!statePtr->intermediate_object_weight_service_client.exists()) {
127 ROS_ERROR_STREAM(
"/env/asr_world_model/get_intermediate_object_weight service is not available");
130 statePtr->intermediate_object_weight_service_client.call(getIntermediateObjectWeight);
132 ROS_ERROR_STREAM(
"GOT WEIGHT FROM WORLD MODEL " << getIntermediateObjectWeight.response.value);
136 statePtr->intermediate_object_cache[objectTypeName] = responsePtr;
ros::NodeHandle mNodeHandle
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ros::ServiceClient object_metadata_service_client
IntermediateObjectWeightResponse::Ptr IntermediateObjectWeightResponsePtr
ros::ServiceClient recognizer_name_service_client
std::map< std::string, IntermediateObjectWeightResponsePtr > intermediate_object_cache
std::map< std::string, ObjectMetaDataResponsePtr > object_metadata_cache
IntermediateObjectWeightResponsePtr getIntermediateObjectValue(std::string objectTypeName)
this namespace contains all generally usable classes.
ObjectMetaDataResponsePtr getObjectMetaData(std::string objectTypeName)
static boost::shared_ptr< State > InstancePtr()
asr_object_database::ObjectMetaData::Response ObjectMetaDataResponse
asr_world_model::GetIntermediateObjectWeight::Response IntermediateObjectWeightResponse
ObjectMetaDataResponse::Ptr ObjectMetaDataResponsePtr
#define ROS_ERROR_STREAM(args)
ros::ServiceClient intermediate_object_weight_service_client