fix(imu): add func for junior api useing.
This commit is contained in:
parent
25e5a0bead
commit
db4f1908ed
|
@ -111,6 +111,7 @@ Channels::Channels(const std::shared_ptr<uvc::device> &device,
|
||||||
: device_(device),
|
: device_(device),
|
||||||
adapter_(adapter),
|
adapter_(adapter),
|
||||||
is_imu_tracking_(false),
|
is_imu_tracking_(false),
|
||||||
|
is_imu_proto2_(false),
|
||||||
imu_track_stop_(false),
|
imu_track_stop_(false),
|
||||||
imu_sn_(0),
|
imu_sn_(0),
|
||||||
imu_callback_(nullptr),
|
imu_callback_(nullptr),
|
||||||
|
@ -378,8 +379,7 @@ void Channels::SetImuCallback(imu_callback_t callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channels::DoImuTrack() {
|
void Channels::DoImuTrack() {
|
||||||
if (dev_info_->firmware_version >= Version(2, 0) &&
|
if (IsImuProc2()) {
|
||||||
strstr(dev_info_->name.c_str(), "S2") != nullptr ) {
|
|
||||||
return DoImuTrack2();
|
return DoImuTrack2();
|
||||||
} else {
|
} else {
|
||||||
return DoImuTrack1();
|
return DoImuTrack1();
|
||||||
|
@ -499,8 +499,7 @@ void Channels::StartImuTracking(imu_callback_t callback) {
|
||||||
<< ", sleep " << (IMU_TRACK_PERIOD - time_elapsed_ms) << " ms";
|
<< ", sleep " << (IMU_TRACK_PERIOD - time_elapsed_ms) << " ms";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (dev_info_->firmware_version >= Version(2, 0) &&
|
if (IsImuProc2()) {
|
||||||
strstr(dev_info_->name.c_str(), "S2") != nullptr ) {
|
|
||||||
while (!imu_track_stop_) {
|
while (!imu_track_stop_) {
|
||||||
auto &&time_beg = times::now();
|
auto &&time_beg = times::now();
|
||||||
DoImuTrack2();
|
DoImuTrack2();
|
||||||
|
@ -588,6 +587,9 @@ bool Channels::GetFiles(
|
||||||
<< "The firmware not support getting device info, you could "
|
<< "The firmware not support getting device info, you could "
|
||||||
"upgrade to latest";
|
"upgrade to latest";
|
||||||
dev_info_ = std::make_shared<DeviceInfo>(*info);
|
dev_info_ = std::make_shared<DeviceInfo>(*info);
|
||||||
|
is_imu_proto2_ = dev_info_ &&
|
||||||
|
dev_info_->firmware_version >= Version(2, 0) &&
|
||||||
|
strstr(dev_info_->name.c_str(), "S2") != nullptr;
|
||||||
} break;
|
} break;
|
||||||
case FID_IMG_PARAMS: {
|
case FID_IMG_PARAMS: {
|
||||||
if (file_size > 0) {
|
if (file_size > 0) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ class MYNTEYE_API Channels {
|
||||||
device_info_t *info, img_params_t *img_params, imu_params_t *imu_params);
|
device_info_t *info, img_params_t *img_params, imu_params_t *imu_params);
|
||||||
bool SetFiles(
|
bool SetFiles(
|
||||||
device_info_t *info, img_params_t *img_params, imu_params_t *imu_params);
|
device_info_t *info, img_params_t *img_params, imu_params_t *imu_params);
|
||||||
|
inline bool IsImuProc2() const { return is_imu_proto2_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool PuControlRange(
|
bool PuControlRange(
|
||||||
|
@ -132,6 +133,7 @@ class MYNTEYE_API Channels {
|
||||||
std::map<Option, control_info_t> control_infos_;
|
std::map<Option, control_info_t> control_infos_;
|
||||||
|
|
||||||
bool is_imu_tracking_;
|
bool is_imu_tracking_;
|
||||||
|
bool is_imu_proto2_;
|
||||||
std::thread imu_track_thread_;
|
std::thread imu_track_thread_;
|
||||||
volatile bool imu_track_stop_;
|
volatile bool imu_track_stop_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user