Successful first compilation after merge

This commit is contained in:
kalman 2018-11-27 14:50:12 +08:00
parent b346f7fec9
commit 7a9f9139fd
12 changed files with 75 additions and 32 deletions

View File

@ -213,6 +213,11 @@ class MYNTEYE_API API {
*/ */
bool RunOptionAction(const Option &option) const; bool RunOptionAction(const Option &option) const;
/**
* Init device resolution.
*/
void InitResolution(const Resolution &res);
/** /**
* Set the callback of stream. * Set the callback of stream.
*/ */

View File

@ -19,6 +19,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <map>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -29,6 +30,20 @@ MYNTEYE_BEGIN_NAMESPACE
namespace device { namespace device {
typedef struct ImgParams {
bool ok;
std::map<Resolution, Intrinsics> in_left_map;
std::map<Resolution, Intrinsics> in_right_map;
Extrinsics ex_right_to_left;
} img_params_t;
typedef struct ImuParams {
bool ok;
ImuIntrinsics in_accel;
ImuIntrinsics in_gyro;
Extrinsics ex_left_to_imu;
} imu_params_t;
/** /**
* @ingroup datatypes * @ingroup datatypes
* Frame with raw data. * Frame with raw data.

View File

@ -66,6 +66,9 @@ class MYNTEYE_API Device {
using stream_async_callback_ptr_t = std::shared_ptr<stream_async_callback_t>; using stream_async_callback_ptr_t = std::shared_ptr<stream_async_callback_t>;
using motion_async_callback_ptr_t = std::shared_ptr<motion_async_callback_t>; using motion_async_callback_ptr_t = std::shared_ptr<motion_async_callback_t>;
using img_params_t = device::img_params_t;
using imu_params_t = device::imu_params_t;
Device(const Model &model, std::shared_ptr<uvc::device> device); Device(const Model &model, std::shared_ptr<uvc::device> device);
virtual ~Device(); virtual ~Device();
@ -263,7 +266,7 @@ class MYNTEYE_API Device {
/** /**
* Get the device img params * Get the device img params
*/ */
Channels::img_params_t GetImgParams(); img_params_t GetImgParams();
protected: protected:
std::shared_ptr<uvc::device> device() const { std::shared_ptr<uvc::device> device() const {
@ -310,7 +313,7 @@ class MYNTEYE_API Device {
std::shared_ptr<MotionIntrinsics> motion_intrinsics_; std::shared_ptr<MotionIntrinsics> motion_intrinsics_;
std::map<Stream, Extrinsics> motion_from_extrinsics_; std::map<Stream, Extrinsics> motion_from_extrinsics_;
Channels::img_params_t img_params_; img_params_t img_params_;
stream_callbacks_t stream_callbacks_; stream_callbacks_t stream_callbacks_;
motion_callback_t motion_callback_; motion_callback_t motion_callback_;

View File

@ -287,6 +287,10 @@ bool API::Supports(const AddOns &addon) const {
return device_->Supports(addon); return device_->Supports(addon);
} }
void API::InitResolution(const Resolution &res) {
return device_->InitResolution(res);
}
void API::SetStreamRequest(const Format &format, const FrameRate &rate) { void API::SetStreamRequest(const Format &format, const FrameRate &rate) {
device_->SetStreamRequest(format, rate); device_->SetStreamRequest(format, rate);
} }

View File

@ -17,6 +17,8 @@
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
#include <opencv2/imgproc/imgproc.hpp>
#include "mynteye/logger.h" #include "mynteye/logger.h"
#include "mynteye/api/object.h" #include "mynteye/api/object.h"
#include "mynteye/api/plugin.h" #include "mynteye/api/plugin.h"

View File

@ -565,7 +565,7 @@ std::size_t from_data(
// TODO(Kalman): Is there a more elegant way? // TODO(Kalman): Is there a more elegant way?
std::size_t from_data( std::size_t from_data(
Channels::img_params_t *img_params, const std::uint8_t *data, device::img_params_t *img_params, const std::uint8_t *data,
const Version *spec_version) { const Version *spec_version) {
std::size_t i = 0; std::size_t i = 0;
@ -600,7 +600,7 @@ std::size_t from_data(
} }
std::size_t from_data( std::size_t from_data(
Channels::imu_params_t *imu_params, const std::uint8_t *data, device::imu_params_t *imu_params, const std::uint8_t *data,
const Version *spec_version) { const Version *spec_version) {
std::size_t i = 0; std::size_t i = 0;
i += from_data(&imu_params->in_accel, data + i, spec_version); i += from_data(&imu_params->in_accel, data + i, spec_version);
@ -864,7 +864,7 @@ std::size_t to_data(
} }
std::size_t to_data( std::size_t to_data(
const Channels::img_params_t *img_params, std::uint8_t *data, const device::img_params_t *img_params, std::uint8_t *data,
const Version *spec_version) { const Version *spec_version) {
std::size_t i = 3; // skip id, size std::size_t i = 3; // skip id, size

View File

@ -21,6 +21,7 @@
#include "mynteye/mynteye.h" #include "mynteye/mynteye.h"
#include "mynteye/types.h" #include "mynteye/types.h"
#include "mynteye/device/device.h"
#include "mynteye/device/types.h" #include "mynteye/device/types.h"
#include "mynteye/uvc/uvc.h" #include "mynteye/uvc/uvc.h"
@ -67,6 +68,9 @@ class MYNTEYE_API Channels {
using device_info_t = DeviceInfo; using device_info_t = DeviceInfo;
using imu_params_t = device::imu_params_t;
using img_params_t = device::img_params_t;
/*
typedef struct ImgParams { typedef struct ImgParams {
bool ok; bool ok;
std::map<Resolution, Intrinsics> in_left_map; std::map<Resolution, Intrinsics> in_left_map;
@ -80,7 +84,7 @@ class MYNTEYE_API Channels {
ImuIntrinsics in_gyro; ImuIntrinsics in_gyro;
Extrinsics ex_left_to_imu; Extrinsics ex_left_to_imu;
} imu_params_t; } imu_params_t;
*/
explicit Channels(std::shared_ptr<uvc::device> device); explicit Channels(std::shared_ptr<uvc::device> device);
~Channels(); ~Channels();

View File

@ -557,8 +557,8 @@ void Device::ReadAllInfos() {
device_info_ = std::make_shared<DeviceInfo>(); device_info_ = std::make_shared<DeviceInfo>();
CHECK_NOTNULL(channels_); CHECK_NOTNULL(channels_);
Channels::imu_params_t imu_params; Device::imu_params_t imu_params;
if (!channels_->GetFiles(device_info_.get(), &img_params, &imu_params)) { if (!channels_->GetFiles(device_info_.get(), &img_params_, &imu_params)) {
#if defined(WITH_DEVICE_INFO_REQUIRED) #if defined(WITH_DEVICE_INFO_REQUIRED)
LOG(FATAL) LOG(FATAL)
#else #else
@ -629,7 +629,7 @@ void Device::CallbackMotionData(const device::MotionData &data) {
} }
} }
Channels::img_params_t Device::GetImgParams() { Device::img_params_t Device::GetImgParams() {
return img_params_; return img_params_;
} }

View File

@ -26,11 +26,11 @@ include_directories(
## record ## record
make_executable(record # make_executable(record
SRCS record.cc dataset.cc # SRCS record.cc dataset.cc
LINK_LIBS mynteye ${OpenCV_LIBS} # LINK_LIBS mynteye ${OpenCV_LIBS}
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} # DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
) #)
make_executable(record2 make_executable(record2
SRCS record2.cc dataset.cc SRCS record2.cc dataset.cc

View File

@ -13,11 +13,8 @@
// limitations under the License. // limitations under the License.
#include "dataset/dataset.h" #include "dataset/dataset.h"
#ifdef WITH_OPENCV2
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#else #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#endif
#include <iomanip> #include <iomanip>
#include <limits> #include <limits>
@ -135,14 +132,24 @@ void Dataset::SaveStreamData(
void Dataset::SaveMotionData(const api::MotionData &data) { void Dataset::SaveMotionData(const api::MotionData &data) {
auto &&writer = GetMotionWriter(); auto &&writer = GetMotionWriter();
// auto seq = data.imu->serial_number;
auto seq = motion_count_; auto seq = motion_count_;
writer->ofs << seq << ", " << data.imu->frame_id << ", " if (data.imu->flag == 1 || data.imu->flag == 2) {
<< data.imu->timestamp << ", " << data.imu->accel[0] << ", " writer->ofs << seq << ", " << static_cast<int>(data.imu->flag) << ", "
<< data.imu->accel[1] << ", " << data.imu->accel[2] << ", " << data.imu->timestamp << ", " << data.imu->accel[0] << ", "
<< data.imu->gyro[0] << ", " << data.imu->gyro[1] << ", " << data.imu->accel[1] << ", " << data.imu->accel[2] << ", "
<< data.imu->gyro[2] << ", " << data.imu->temperature << data.imu->gyro[0] << ", " << data.imu->gyro[1] << ", "
<< std::endl; << data.imu->gyro[2] << ", " << data.imu->temperature
++motion_count_; << std::endl;
++motion_count_;
}
/*
if(motion_count_ != seq) {
LOG(INFO) << "motion_count_ != seq !" << " motion_count_: " << motion_count_
<< " seq: " << seq;
motion_count_ = seq;
}
*/
} }
Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) { Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) {

View File

@ -31,8 +31,8 @@ namespace tools {
class DeviceWriter { class DeviceWriter {
public: public:
using dev_info_t = DeviceInfo; using dev_info_t = DeviceInfo;
using img_params_t = Channels::img_params_t; using img_params_t = device::img_params_t;
using imu_params_t = Channels::imu_params_t; using imu_params_t = device::imu_params_t;
explicit DeviceWriter(std::shared_ptr<Device> device); explicit DeviceWriter(std::shared_ptr<Device> device);
~DeviceWriter(); ~DeviceWriter();

View File

@ -72,11 +72,14 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
} }
if (imu_time_beg_ != -1) { if (imu_time_beg_ != -1) {
if (publish_imu_by_sync_) { if (publish_imu_by_sync_) {
LOG(INFO) << "imu_sync_count: " << imu_sync_count_ LOG(INFO) << "imu_sync_count: " << imu_sync_count_ << ", hz: "
<< ", hz: " << (imu_sync_count_ / time_elapsed); << (imu_sync_count_ /
compute_time(time_end, imu_time_beg_));
} else { } else {
LOG(INFO) << "Imu count: " << imu_count_ LOG(INFO) << "Imu count: " << imu_count_ << ", hz: "
<< ", hz: " << (imu_count_ / time_elapsed); << (imu_count_ /
compute_time(time_end, imu_time_beg_));
}
} }
// ROS messages could not be reliably printed here, using glog instead :( // ROS messages could not be reliably printed here, using glog instead :(
@ -208,7 +211,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
} }
camera_encodings_ = {{Stream::LEFT, enc::BGR8}, camera_encodings_ = {{Stream::LEFT, enc::BGR8},
{Stream::RIGHT, enc::BGR8} {Stream::RIGHT, enc::BGR8},
{Stream::LEFT_RECTIFIED, enc::BGR8}, {Stream::LEFT_RECTIFIED, enc::BGR8},
{Stream::RIGHT_RECTIFIED, enc::BGR8}, {Stream::RIGHT_RECTIFIED, enc::BGR8},
{Stream::DISPARITY, enc::MONO8}, // float {Stream::DISPARITY, enc::MONO8}, // float