78 lines
2.0 KiB
C
Raw Normal View History

2018-05-10 14:46:34 +08:00
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2018-10-27 21:24:04 +08:00
#ifndef MYNTEYE_DEVICE_MOTIONS_H_
#define MYNTEYE_DEVICE_MOTIONS_H_
2018-04-12 11:48:09 +08:00
#pragma once
#include <memory>
2018-04-12 12:22:55 +08:00
#include <mutex>
2018-04-12 11:48:09 +08:00
#include <vector>
#include "mynteye/mynteye.h"
2018-10-27 21:24:04 +08:00
#include "mynteye/device/callbacks.h"
2018-04-12 11:48:09 +08:00
MYNTEYE_BEGIN_NAMESPACE
class Channels;
class Motions {
public:
using motion_data_t = device::MotionData;
using motion_datas_t = std::vector<motion_data_t>;
using motion_callback_t = device::MotionCallback;
explicit Motions(std::shared_ptr<Channels> channels);
~Motions();
void SetMotionCallback(motion_callback_t callback);
void DoMotionTrack();
2018-04-12 11:48:09 +08:00
void StartMotionTracking();
void StopMotionTracking();
void DisableMotionDatas();
2018-04-12 11:48:09 +08:00
void EnableMotionDatas(std::size_t max_size);
motion_datas_t GetMotionDatas();
2019-03-15 19:46:20 +08:00
void SetMotionIntrinsics(const std::shared_ptr<MotionIntrinsics>& in);
void EnableProcessMode(const std::int32_t& mode);
2018-04-12 11:48:09 +08:00
private:
2019-03-15 19:46:20 +08:00
void ProcImuAssembly(std::shared_ptr<ImuData> data) const;
void ProcImuTempDrift(std::shared_ptr<ImuData> data) const;
2018-04-12 11:48:09 +08:00
std::shared_ptr<Channels> channels_;
motion_callback_t motion_callback_;
motion_datas_t motion_datas_;
bool motion_datas_enabled_;
std::size_t motion_datas_max_size_;
2018-04-12 11:48:09 +08:00
bool is_imu_tracking;
2018-04-12 12:22:55 +08:00
std::mutex mtx_datas_;
2018-08-16 19:34:01 +08:00
int accel_range;
int gyro_range;
2019-03-15 19:46:20 +08:00
std::int32_t proc_mode_;
std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
2018-04-12 11:48:09 +08:00
};
MYNTEYE_END_NAMESPACE
2018-10-27 21:24:04 +08:00
#endif // MYNTEYE_DEVICE_MOTIONS_H_