CameraARCore.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 #ifndef CAMERAARCORE_H_
29 #define CAMERAARCORE_H_
30 
31 #include "CameraMobile.h"
32 #include <rtabmap/core/Camera.h>
34 #include <rtabmap/utilite/UMutex.h>
38 #include <rtabmap/utilite/UEvent.h>
39 #include <rtabmap/utilite/UTimer.h>
40 #include <boost/thread/mutex.hpp>
41 #include <background_renderer.h>
42 
43 #include <arcore_c_api.h>
44 #include <camera/NdkCameraDevice.h>
45 #include <camera/NdkCameraManager.h>
46 #include <media/NdkImageReader.h>
47 #include <android/native_window.h>
48 
49 namespace rtabmap {
50 
51 class CameraARCore : public CameraMobile {
52 public:
53  CameraARCore(void* env, void* context, void* activity, bool depthFromMotion = false, bool smoothing = false, float upstreamRelocalizationAccThr = 0.0f);
54  virtual ~CameraARCore();
55 
56  virtual void setScreenRotationAndSize(ScreenRotation colorCameraToDisplayRotation, int width, int height);
57 
58  virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
59  virtual void close(); // close ARCore connection
60  virtual std::string getSerial() const;
61 
62 protected:
63  virtual SensorData updateDataOnRender(Transform & pose); // should be called in opengl thread
64 
65 private:
66  rtabmap::Transform getPoseAtTimestamp(double timestamp);
67 
68 private:
69  void * env_;
70  void * context_;
71  void * activity_;
72  ArSession* arSession_ = nullptr;
73  ArConfig* arConfig_ = nullptr;
74  ArFrame* arFrame_ = nullptr;
75  ArCameraIntrinsics *arCameraIntrinsics_ = nullptr;
76  ArPose * arPose_ = nullptr;
79 
81 };
82 
83 } /* namespace rtabmap */
84 #endif /* CAMERAARCORE_H_ */
rtabmap::SensorData
Definition: SensorData.h:51
rtabmap::CameraARCore::activity_
void * activity_
Definition: CameraARCore.h:71
background_renderer.h
CameraMobile.h
rtabmap::CameraARCore::setScreenRotationAndSize
virtual void setScreenRotationAndSize(ScreenRotation colorCameraToDisplayRotation, int width, int height)
Definition: CameraARCore.cpp:277
rtabmap::CameraARCore::close
virtual void close()
Definition: CameraARCore.cpp:241
rtabmap::CameraARCore::arCameraIntrinsics_
ArCameraIntrinsics * arCameraIntrinsics_
Definition: CameraARCore.h:75
rtabmap::CameraARCore::arSession_
ArSession * arSession_
Definition: CameraARCore.h:72
GeodeticCoords.h
rtabmap::CameraARCore::arInstallRequested_
bool arInstallRequested_
Definition: CameraARCore.h:77
rtabmap::CameraARCore::updateDataOnRender
virtual SensorData updateDataOnRender(Transform &pose)
Definition: CameraARCore.cpp:291
rtabmap::CameraARCore::arSessionMutex_
UMutex arSessionMutex_
Definition: CameraARCore.h:78
UTimer.h
rtabmap::CameraARCore::context_
void * context_
Definition: CameraARCore.h:70
rtabmap::CameraARCore::getSerial
virtual std::string getSerial() const
Definition: CameraARCore.cpp:119
rtabmap::CameraARCore::arPose_
ArPose * arPose_
Definition: CameraARCore.h:76
UEvent.h
UMutex
Definition: UMutex.h:54
UMutex.h
rtabmap::CameraARCore
Definition: CameraARCore.h:51
rtabmap::CameraARCore::init
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Definition: CameraARCore.cpp:124
f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
rtabmap::CameraARCore::getPoseAtTimestamp
rtabmap::Transform getPoseAtTimestamp(double timestamp)
UEventsSender.h
rtabmap::Transform
Definition: Transform.h:41
rtabmap::CameraARCore::~CameraARCore
virtual ~CameraARCore()
Definition: CameraARCore.cpp:50
rtabmap::ScreenRotation
ScreenRotation
Definition: util.h:194
env
USemaphore.h
UThread.h
rtabmap::CameraMobile
Definition: CameraMobile.h:71
rtabmap::CameraARCore::CameraARCore
CameraARCore(void *env, void *context, void *activity, bool depthFromMotion=false, bool smoothing=false, float upstreamRelocalizationAccThr=0.0f)
Definition: CameraARCore.cpp:40
Camera.h
rtabmap::CameraARCore::arFrame_
ArFrame * arFrame_
Definition: CameraARCore.h:74
rtabmap::CameraARCore::arConfig_
ArConfig * arConfig_
Definition: CameraARCore.h:73
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::CameraARCore::depthFromMotion_
bool depthFromMotion_
Definition: CameraARCore.h:80
rtabmap::CameraARCore::env_
void * env_
Definition: CameraARCore.h:69


rtabmap
Author(s): Mathieu Labbe
autogenerated on Sun Dec 1 2024 03:42:42