CameraMyntEye.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #pragma once
29 
30 #include "rtabmap/core/RtabmapExp.h" // DLL export/import defines
31 
32 #include "rtabmap/core/Camera.h"
33 #include "rtabmap/core/Version.h"
35 #include <memory>
36 
37 namespace mynteye {
38 class Device;
39 class API;
40 }
41 
42 namespace rtabmap
43 {
44 
50 {
51 public:
52  static bool available();
53 
54 public:
55  CameraMyntEye(const std::string & device = "", bool apiRectification = false, bool apiDepth = false, float imageRate = 0, const Transform & localTransform = Transform::getIdentity());
56  virtual ~CameraMyntEye();
57 
58  virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
59  virtual bool isCalibrated() const;
60  virtual std::string getSerial() const;
61  virtual bool odomProvided() const { return false; }
62 
63  void publishInterIMU(bool enabled);
64  void setAutoExposure();
65  void setManualExposure(int gain=24, int brightness=120, int constrast=116);
66  void setIrControl(int value);
67 
68 protected:
72  virtual SensorData captureImage(CameraInfo * info = 0);
73 
74 private:
75 #ifdef RTABMAP_MYNTEYE
76  double hardTimeToSoftTime(std::uint64_t hardTime);
77  void getPoseAndIMU(const double & stamp, IMU & imu, int maxWaitTimeMs = 35) const;
78  double checkUpTimeStamp(std::uint64_t _hard_time, std::uint8_t stream);
79 
80  std::shared_ptr<mynteye::Device> device_;
81  std::shared_ptr<mynteye::API> api_;
82  StereoCameraModel stereoModel_;
83  std::string deviceName_;
84  bool apiRectification_;
85  bool apiDepth_;
86  bool autoExposure_;
87  int gain_;
88  int brightness_;
89  int contrast_;
90  int irControl_;
91  USemaphore dataReady_;
92  UMutex dataMutex_;
93  cv::Mat leftFrameBuffer_;
94  cv::Mat rightFrameBuffer_;
95  std::pair<cv::Mat, cv::Mat> lastFrames_;
96  double lastFramesStamp_;
97  std::uint64_t stamp_;
98  bool publishInterIMU_;
99  Transform imuLocalTransform_;
100  std::map<double, std::pair<cv::Vec3f, cv::Vec3f> > imuBuffer_;
101  UMutex imuMutex_;
102 
103  double softTimeBegin_;
104  std::uint64_t hardTimeBegin_;
105  std::uint64_t unitHardTime_;
106  std::vector<std::uint64_t> lastHardTimes_;
107  std::vector<std::uint64_t> acc_;
108 #endif
109 };
110 
111 
112 } // namespace rtabmap
def init(descriptorDim, matchThreshold, iterations, cuda, model_path)
detail::uint8 uint8_t
Definition: fwd.hpp:908
#define RTABMAP_EXP
Definition: RtabmapExp.h:38
Definition: UMutex.h:54
virtual bool odomProvided() const
Definition: CameraMyntEye.h:61
detail::uint64 uint64_t
Definition: fwd.hpp:920


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:37:28