fix(timestamp):add onProcess sync lock to make sure imgData be unique; issue[EYES-26]
This commit is contained in:
parent
764ccba041
commit
3c687d43ca
|
@ -209,6 +209,7 @@ void Processor::Run() {
|
|||
}
|
||||
bool ok = false;
|
||||
try {
|
||||
std::unique_lock<std::mutex> lk(mtx_data_process_unique_);
|
||||
if (callback_) {
|
||||
if (callback_(input_.get(), output_.get(), parent_)) {
|
||||
ok = true;
|
||||
|
|
|
@ -103,6 +103,7 @@ class Processor :
|
|||
|
||||
bool input_ready_;
|
||||
std::mutex mtx_input_ready_;
|
||||
std::mutex mtx_data_process_unique_;
|
||||
std::condition_variable cond_input_ready_;
|
||||
|
||||
bool idle_;
|
||||
|
|
|
@ -589,6 +589,17 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
|||
stream, [this, stream](const api::StreamData &data) {
|
||||
ros::Time stamp = checkUpTimeStamp(
|
||||
data.img->timestamp, stream);
|
||||
if (stream == Stream::DEPTH) {
|
||||
static long long last_img = 0;
|
||||
static ros::Time last = ros::Time(0);
|
||||
static int cont = 0;
|
||||
cont++;
|
||||
if (stamp <= last) {
|
||||
std::cout << "di " << cont <<"ci: " << data.img->timestamp <<"&" << last_img << "|" << last << "&" <<stamp << std::endl;
|
||||
}
|
||||
last = stamp;
|
||||
last_img = data.img->timestamp;
|
||||
}
|
||||
static std::size_t count = 0;
|
||||
++count;
|
||||
publishData(stream, data, count, stamp);
|
||||
|
|
Loading…
Reference in New Issue
Block a user