Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-s-sdk into develop

This commit is contained in:
TinyOh 2019-03-19 09:39:49 +08:00
commit 2462c1b37a
3 changed files with 19 additions and 31 deletions

View File

@ -610,6 +610,8 @@ void Device::ReadAllInfos() {
device_info_->name = uvc::get_name(*device_);
motions_->SetDeviceInfo(device_info_);
bool img_params_ok = false;
for (auto &&params : all_img_params_) {
auto &&img_params = params.second;

View File

@ -170,7 +170,7 @@ Motions::motion_datas_t Motions::GetMotionDatas() {
void Motions::ProcImuAssembly(std::shared_ptr<ImuData> data) const {
if (nullptr == motion_intrinsics_ ||
IsNullAssemblyOrTempDrift(ProcessMode::PROC_IMU_ASSEMBLY))
IsNullAssemblyOrTempDrift())
return;
double dst[3][3] = {0};
@ -203,7 +203,7 @@ void Motions::ProcImuAssembly(std::shared_ptr<ImuData> data) const {
void Motions::ProcImuTempDrift(std::shared_ptr<ImuData> data) const {
if (nullptr == motion_intrinsics_ ||
IsNullAssemblyOrTempDrift(ProcessMode::PROC_IMU_TEMP_DRIFT))
IsNullAssemblyOrTempDrift())
return;
double temp = data->temperature;
@ -232,36 +232,18 @@ void Motions::EnableProcessMode(const std::int32_t& mode) {
proc_mode_ = mode;
}
bool Motions::IsNullAssemblyOrTempDrift(const ProcessMode& mode) const {
if (mode == ProcessMode::PROC_IMU_ASSEMBLY) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (motion_intrinsics_->accel.assembly[i][j] != 0.0)
bool Motions::IsNullAssemblyOrTempDrift() const {
if (!device_info_)
return true;
if (device_info_->spec_version >= Version(1, 2))
return false;
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (motion_intrinsics_->gyro.assembly[i][j] != 0.0)
return false;
}
}
} else if (mode == ProcessMode::PROC_IMU_TEMP_DRIFT) {
for (int i = 0; i < 2; i++) {
if (motion_intrinsics_->accel.x[i] != 0.0 ||
motion_intrinsics_->accel.y[i] != 0.0 ||
motion_intrinsics_->accel.z[i] != 0.0)
return false;
}
for (int i = 0; i < 2; i++) {
if (motion_intrinsics_->gyro.x[i] != 0 ||
motion_intrinsics_->gyro.y[i] != 0 ||
motion_intrinsics_->gyro.z[i] != 0)
return false;
}
}
return true;
}
void Motions::SetDeviceInfo(const std::shared_ptr<DeviceInfo>& in) {
device_info_ = in;
}
MYNTEYE_END_NAMESPACE

View File

@ -21,6 +21,7 @@
#include "mynteye/mynteye.h"
#include "mynteye/device/callbacks.h"
#include "mynteye/device/types.h"
MYNTEYE_BEGIN_NAMESPACE
@ -49,10 +50,12 @@ class Motions {
void SetMotionIntrinsics(const std::shared_ptr<MotionIntrinsics>& in);
void EnableProcessMode(const std::int32_t& mode);
void SetDeviceInfo(const std::shared_ptr<DeviceInfo>& in);
private:
void ProcImuAssembly(std::shared_ptr<ImuData> data) const;
void ProcImuTempDrift(std::shared_ptr<ImuData> data) const;
bool IsNullAssemblyOrTempDrift(const ProcessMode& mode) const;
bool IsNullAssemblyOrTempDrift() const;
std::shared_ptr<Channels> channels_;
@ -71,6 +74,7 @@ class Motions {
std::int32_t proc_mode_;
std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
std::shared_ptr<DeviceInfo> device_info_;
};
MYNTEYE_END_NAMESPACE