Merge branch 'develop' into feature/android
* develop: (28 commits) feat(*): add function to querry some hardware info feat: forbid 2100/210A uless update sdk to 2.3.1 and above refactor(synthetic): remove usless logic chore(readme): update readme docs(doxyfile): update version fix: change cmake version to 2.3.2 feat(api) sdk/firmware version check feat(api): version check fix(wrapper): fix camera info repeat bug build(makefile): ensure uninstall before install fix(correspondence): also wait stream matched ready fix(record): shield diable logic temporarily chore(readme): chore(readme): update readme chore(readme): update readme chore(doc): update version fix(samples): delete useless comment fix(ros): fix camera info bug fix(correspondence): improve warning if not start motion tracking fix(correspondence): fix include header fix(ros): record close bug ...
This commit is contained in:
@@ -460,6 +460,7 @@ bool Channels::GetFiles(
|
||||
while (i < end) {
|
||||
std::uint8_t file_id = *(data + i);
|
||||
std::uint16_t file_size = bytes::_from_data<std::uint16_t>(data + i + 1);
|
||||
LOG(INFO) << "GetFiles:data_size : " << file_size;
|
||||
VLOG(2) << "GetFiles id: " << static_cast<int>(file_id)
|
||||
<< ", size: " << file_size;
|
||||
i += 3;
|
||||
|
||||
@@ -32,6 +32,7 @@ std::size_t FileChannel::GetDeviceInfoFromData(
|
||||
const std::uint8_t *data, const std::uint16_t &data_size,
|
||||
device_info_t *info) {
|
||||
auto n = dev_info_parser_->GetFromData(data, data_size, info);
|
||||
LOG(INFO) << "GetDeviceInfoFromData:data_size : " << data_size;
|
||||
auto spec_version = info->spec_version;
|
||||
img_params_parser_->SetSpecVersion(spec_version);
|
||||
imu_params_parser_->SetSpecVersion(spec_version);
|
||||
@@ -113,6 +114,22 @@ std::size_t DeviceInfoParser::GetFromData(
|
||||
info->nominal_baseline = bytes::_from_data<std::uint16_t>(data + i);
|
||||
i += 2;
|
||||
|
||||
if (info->spec_version >= Version(1, 2)) {
|
||||
// auxiliary_chip_version, 2
|
||||
info->auxiliary_chip_version.set_major(data[i]);
|
||||
info->auxiliary_chip_version.set_minor(data[i + 1]);
|
||||
i += 2;
|
||||
// isp_version, 2
|
||||
info->isp_version.set_major(data[i]);
|
||||
info->isp_version.set_minor(data[i + 1]);
|
||||
i += 2;
|
||||
} else {
|
||||
info->auxiliary_chip_version.set_major(0);
|
||||
info->auxiliary_chip_version.set_minor(0);
|
||||
info->isp_version.set_major(0);
|
||||
info->isp_version.set_minor(0);
|
||||
}
|
||||
|
||||
// get other infos according to spec_version
|
||||
|
||||
MYNTEYE_UNUSED(data_size)
|
||||
@@ -155,6 +172,17 @@ std::size_t DeviceInfoParser::SetToData(
|
||||
bytes::_to_data(info->nominal_baseline, data + i);
|
||||
i += 2;
|
||||
|
||||
if (info->spec_version >= Version(1, 2)) {
|
||||
// auxiliary_chip_version, 2
|
||||
data[i] = info->auxiliary_chip_version.major();
|
||||
data[i + 1] = info->auxiliary_chip_version.minor();
|
||||
i += 2;
|
||||
// isp_version, 2
|
||||
data[i] = info->isp_version.major();
|
||||
data[i + 1] = info->isp_version.minor();
|
||||
i += 2;
|
||||
}
|
||||
|
||||
// set other infos according to spec_version
|
||||
|
||||
// others
|
||||
@@ -181,7 +209,7 @@ std::size_t ImgParamsParser::GetFromData(
|
||||
return GetFromData_v1_0(data, data_size, img_params);
|
||||
}
|
||||
// s210a old params
|
||||
if (spec_version_ == Version(1, 1) && data_size == 404) {
|
||||
if (spec_version_ >= Version(1, 1) && data_size == 404) {
|
||||
return GetFromData_v1_1(data, data_size, img_params);
|
||||
}
|
||||
// get img params with new version format
|
||||
@@ -406,7 +434,7 @@ std::size_t ImuParamsParser::GetFromData(
|
||||
return GetFromData_old(data, data_size, imu_params);
|
||||
}
|
||||
// s210a old params
|
||||
if (spec_version_ == Version(1, 1) && data_size == 384) {
|
||||
if (spec_version_ >= Version(1, 1) && data_size == 384) {
|
||||
return GetFromData_old(data, data_size, imu_params);
|
||||
}
|
||||
// get imu params with new version format
|
||||
|
||||
@@ -234,6 +234,10 @@ std::string Device::GetInfo(const Info &info) const {
|
||||
return device_info_->imu_type.to_string();
|
||||
case Info::NOMINAL_BASELINE:
|
||||
return std::to_string(device_info_->nominal_baseline);
|
||||
case Info::AUXILIARY_CHIP_VERSION:
|
||||
return device_info_->auxiliary_chip_version.to_string();
|
||||
case Info::ISP_VERSION:
|
||||
return device_info_->isp_version.to_string();
|
||||
default:
|
||||
LOG(WARNING) << "Unknown device info";
|
||||
return "";
|
||||
@@ -349,6 +353,9 @@ OptionInfo Device::GetOptionInfo(const Option &option) const {
|
||||
|
||||
std::int32_t Device::GetOptionValue(const Option &option) const {
|
||||
if (!Supports(option)) {
|
||||
if (option == Option::FRAME_RATE) {
|
||||
return GetStreamRequest().fps;
|
||||
}
|
||||
LOG(WARNING) << "Unsupported option: " << option;
|
||||
return -1;
|
||||
}
|
||||
@@ -466,6 +473,11 @@ std::vector<device::StreamData> Device::GetStreamDatas(const Stream &stream) {
|
||||
return streams_->GetStreamDatas(stream);
|
||||
}
|
||||
|
||||
void Device::DisableMotionDatas() {
|
||||
CHECK_NOTNULL(motions_);
|
||||
motions_->DisableMotionDatas();
|
||||
}
|
||||
|
||||
void Device::EnableMotionDatas() {
|
||||
EnableMotionDatas(std::numeric_limits<std::size_t>::max());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
|
||||
|
||||
std::lock_guard<std::mutex> _(mtx_datas_);
|
||||
motion_data_t data = {imu};
|
||||
if (motion_datas_enabled_) {
|
||||
if (motion_datas_enabled_ && motion_datas_max_size_ > 0) {
|
||||
if (motion_datas_.size() >= motion_datas_max_size_) {
|
||||
motion_datas_.erase(motion_datas_.begin());
|
||||
}
|
||||
motion_datas_.push_back(data);
|
||||
}
|
||||
|
||||
@@ -98,13 +101,21 @@ void Motions::StopMotionTracking() {
|
||||
}
|
||||
}
|
||||
|
||||
void Motions::DisableMotionDatas() {
|
||||
std::lock_guard<std::mutex> _(mtx_datas_);
|
||||
motion_datas_enabled_ = false;
|
||||
motion_datas_max_size_ = 0;
|
||||
motion_datas_.clear();
|
||||
}
|
||||
|
||||
void Motions::EnableMotionDatas(std::size_t max_size) {
|
||||
if (max_size <= 0) {
|
||||
LOG(WARNING) << "Could not enable motion datas with max_size <= 0";
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::mutex> _(mtx_datas_);
|
||||
motion_datas_enabled_ = true;
|
||||
motion_datas_max_size = max_size;
|
||||
motion_datas_max_size_ = max_size;
|
||||
}
|
||||
|
||||
Motions::motion_datas_t Motions::GetMotionDatas() {
|
||||
|
||||
@@ -42,6 +42,7 @@ class Motions {
|
||||
void StartMotionTracking();
|
||||
void StopMotionTracking();
|
||||
|
||||
void DisableMotionDatas();
|
||||
void EnableMotionDatas(std::size_t max_size);
|
||||
motion_datas_t GetMotionDatas();
|
||||
|
||||
@@ -52,7 +53,7 @@ class Motions {
|
||||
|
||||
motion_datas_t motion_datas_;
|
||||
bool motion_datas_enabled_;
|
||||
std::size_t motion_datas_max_size;
|
||||
std::size_t motion_datas_max_size_;
|
||||
|
||||
bool is_imu_tracking;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user