Merge branch into develop
This commit is contained in:
		
						commit
						12adc79096
					
				@ -252,7 +252,7 @@ MotionIntrinsics Device::GetMotionIntrinsics(bool *ok) const {
 | 
				
			|||||||
    return *motion_intrinsics_;
 | 
					    return *motion_intrinsics_;
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    *ok = false;
 | 
					    *ok = false;
 | 
				
			||||||
    LOG(WARNING) << "Motion intrinsics not found";
 | 
					    VLOG(2) << "Motion intrinsics not found";
 | 
				
			||||||
    return {};
 | 
					    return {};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -263,7 +263,7 @@ Extrinsics Device::GetMotionExtrinsics(const Stream &from, bool *ok) const {
 | 
				
			|||||||
    return motion_from_extrinsics_.at(from);
 | 
					    return motion_from_extrinsics_.at(from);
 | 
				
			||||||
  } catch (const std::out_of_range &e) {
 | 
					  } catch (const std::out_of_range &e) {
 | 
				
			||||||
    *ok = false;
 | 
					    *ok = false;
 | 
				
			||||||
    LOG(WARNING) << "Motion extrinsics from " << from << " not found";
 | 
					    VLOG(2) << "Motion extrinsics from " << from << " not found";
 | 
				
			||||||
    return {};
 | 
					    return {};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -580,7 +580,7 @@ void Device::ReadAllInfos() {
 | 
				
			|||||||
    VLOG(2) << "Motion extrinsics left to imu: {"
 | 
					    VLOG(2) << "Motion extrinsics left to imu: {"
 | 
				
			||||||
            << GetMotionExtrinsics(Stream::LEFT) << "}";
 | 
					            << GetMotionExtrinsics(Stream::LEFT) << "}";
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    LOG(WARNING) << "Motion intrinsics & extrinsics not exist";
 | 
					    VLOG(2) << "Motion intrinsics & extrinsics not exist";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -50,9 +50,9 @@ bool unpack_stereo_img_data(
 | 
				
			|||||||
  //   << ", checksum=0x" << std::hex << static_cast<int>(img_packet.checksum);
 | 
					  //   << ", checksum=0x" << std::hex << static_cast<int>(img_packet.checksum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (img_packet.header != 0x3B) {
 | 
					  if (img_packet.header != 0x3B) {
 | 
				
			||||||
    LOG(WARNING) << "Image packet header must be 0x3B, but 0x" << std::hex
 | 
					    VLOG(2) << "Image packet header must be 0x3B, but 0x" << std::hex
 | 
				
			||||||
                 << std::uppercase << std::setw(2) << std::setfill('0')
 | 
					            << std::uppercase << std::setw(2) << std::setfill('0')
 | 
				
			||||||
                 << static_cast<int>(img_packet.header) << " now";
 | 
					            << static_cast<int>(img_packet.header) << " now";
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -61,11 +61,11 @@ bool unpack_stereo_img_data(
 | 
				
			|||||||
    checksum = (checksum ^ packet[i]);
 | 
					    checksum = (checksum ^ packet[i]);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (img_packet.checksum != checksum) {
 | 
					  if (img_packet.checksum != checksum) {
 | 
				
			||||||
    LOG(WARNING) << "Image packet checksum should be 0x" << std::hex
 | 
					    VLOG(2) << "Image packet checksum should be 0x" << std::hex
 | 
				
			||||||
                 << std::uppercase << std::setw(2) << std::setfill('0')
 | 
					            << std::uppercase << std::setw(2) << std::setfill('0')
 | 
				
			||||||
                 << static_cast<int>(img_packet.checksum) << ", but 0x"
 | 
					            << static_cast<int>(img_packet.checksum) << ", but 0x"
 | 
				
			||||||
                 << std::setw(2) << std::setfill('0')
 | 
					            << std::setw(2) << std::setfill('0') << static_cast<int>(checksum)
 | 
				
			||||||
                 << static_cast<int>(checksum) << " now";
 | 
					            << " now";
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -160,7 +160,7 @@ bool Streams::PushStream(const Capabilities &capability, const void *data) {
 | 
				
			|||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        // discard left
 | 
					        // discard left
 | 
				
			||||||
        DiscardStreamData(Stream::LEFT);
 | 
					        DiscardStreamData(Stream::LEFT);
 | 
				
			||||||
        LOG(WARNING) << "Image packet is unaccepted, frame dropped";
 | 
					        VLOG(2) << "Image packet is unaccepted, frame dropped";
 | 
				
			||||||
        pushed = false;
 | 
					        pushed = false;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } break;
 | 
					    } break;
 | 
				
			||||||
 | 
				
			|||||||
@ -41,6 +41,10 @@ namespace uvc {
 | 
				
			|||||||
    LOG(severity) << str << " error " << errno << ", " << strerror(errno); \
 | 
					    LOG(severity) << str << " error " << errno << ", " << strerror(errno); \
 | 
				
			||||||
  } while (0)
 | 
					  } while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NO_DATA_MAX_COUNT 200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int no_data_count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
class device_error : public std::exception {
 | 
					class device_error : public std::exception {
 | 
				
			||||||
 public:
 | 
					 public:
 | 
				
			||||||
@ -194,6 +198,7 @@ struct device {
 | 
				
			|||||||
  ~device() {
 | 
					  ~device() {
 | 
				
			||||||
    VLOG(2) << __func__;
 | 
					    VLOG(2) << __func__;
 | 
				
			||||||
    stop_streaming();
 | 
					    stop_streaming();
 | 
				
			||||||
 | 
					    no_data_count = 0;
 | 
				
			||||||
    if (fd != -1 && close(fd) < 0) {
 | 
					    if (fd != -1 && close(fd) < 0) {
 | 
				
			||||||
      LOG_ERROR(WARNING, "close");
 | 
					      LOG_ERROR(WARNING, "close");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -386,6 +391,14 @@ struct device {
 | 
				
			|||||||
            throw_error("VIDIOC_QBUF");
 | 
					            throw_error("VIDIOC_QBUF");
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      no_data_count = 0;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      no_data_count++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (no_data_count > NO_DATA_MAX_COUNT) {
 | 
				
			||||||
 | 
					      throw_error("v4l2 get stream time out!");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user