22 #include "pcl_db_retrieve_thread.h"
24 #include <blackboard/utils/on_message_waker.h>
25 #include <interfaces/PclDatabaseRetrieveInterface.h>
58 foutput_->is_dense =
false;
60 output_ = pcl_utils::cloudptr_from_refptr(foutput_);
63 foriginal_->is_dense =
false;
65 original_ = pcl_utils::cloudptr_from_refptr(foriginal_);
106 std::vector<long long> times(1);
107 std::string database;
108 std::string collection;
109 std::string target_frame;
110 bool original_timestamp;
112 if (retrieve_if_->msgq_empty())
115 if (PclDatabaseRetrieveInterface::RetrieveMessage *msg = retrieve_if_->msgq_first_safe(msg)) {
116 retrieve_if_->set_final(
false);
117 retrieve_if_->set_msgid(msg->id());
118 retrieve_if_->set_error(
"");
119 retrieve_if_->write();
121 timestamp = msg->timestamp();
122 times[0] = timestamp;
123 database = (strcmp(msg->database(),
"") != 0) ? msg->database() : cfg_database_;
124 collection = msg->collection();
125 target_frame = msg->target_frame();
126 original_timestamp = msg->is_original_timestamp();
129 retrieve_if_->msgq_pop();
132 retrieve_if_->msgq_pop();
134 logger->
log_info(
name(),
"Restoring from '%s' for the time %li", collection.c_str(), timestamp);
136 ApplicabilityStatus st_xyz, st_xyzrgb;
137 long actual_time = 0;
139 pl_xyz_->
applicable(times, database, collection);
140 if ((st_xyz = pl_xyz_->
applicable(times, database, collection)) == APPLICABLE) {
142 pl_xyz_->
retrieve(timestamp, database, collection, target_frame, actual_time);
143 }
else if ((st_xyzrgb = pl_xyzrgb_->
applicable(times, database, collection)) == APPLICABLE) {
145 pl_xyzrgb_->
retrieve(timestamp, database, collection, target_frame, actual_time);
146 if (!original_timestamp) {
148 pcl_utils::set_time(foutput_, now);
154 retrieve_if_->set_error(
"No applicable merging pipeline known (for details see log)");
157 if (actual_time != 0) {
158 if (original_timestamp) {
159 Time now((
long)actual_time);
161 pcl_utils::get_time(foutput_, last);
165 pcl_utils::set_time(foutput_, now);
168 pcl_utils::set_time(foutput_, now);
172 retrieve_if_->set_final(
true);
173 retrieve_if_->write();