14
14
// M3T
15
15
#include < m3t/common.h>
16
16
#include < m3t/camera.h>
17
+
18
+ #ifdef PYM3T_WITH_REALSENSE
17
19
#include < m3t/realsense_camera.h>
20
+ #endif
21
+
18
22
#include < m3t/renderer_geometry.h>
19
23
#include < m3t/basic_depth_renderer.h>
20
24
#include < m3t/silhouette_renderer.h>
@@ -38,13 +42,6 @@ using namespace pybind11::literals; // to use "arg"_a shorthand
38
42
using namespace m3t ;
39
43
using namespace Eigen ;
40
44
41
- /* *
42
- * TODO:
43
- * - Read the flag USE_REALSENSE to decide whether or not to create bindings
44
- * */
45
-
46
-
47
-
48
45
PYBIND11_MODULE (_pym3t_mod, m) {
49
46
50
47
// Tracker: main interface with m3t
@@ -119,6 +116,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
119
116
// DepthCamera -> not constructible, just to enable automatic downcasting and binding of child classes
120
117
py::class_<DepthCamera, Camera, std::shared_ptr<DepthCamera>>(m, " DepthCamera" );
121
118
119
+ #ifdef PYM3T_WITH_REALSENSE
122
120
// RealSenseColorCamera
123
121
py::class_<RealSenseColorCamera, ColorCamera, std::shared_ptr<RealSenseColorCamera>>(m, " RealSenseColorCamera" )
124
122
.def (py::init<const std::string &, bool >(), " name" _a, " use_depth_as_world_frame" _a=false )
@@ -128,6 +126,7 @@ PYBIND11_MODULE(_pym3t_mod, m) {
128
126
py::class_<RealSenseDepthCamera, DepthCamera, std::shared_ptr<RealSenseDepthCamera>>(m, " RealSenseDepthCamera" )
129
127
.def (py::init<const std::string &, bool >(), " name" _a, " use_color_as_world_frame" _a=true )
130
128
;
129
+ #endif
131
130
132
131
// DummyColorCamera
133
132
py::class_<DummyColorCamera, ColorCamera, std::shared_ptr<DummyColorCamera>>(m, " DummyColorCamera" )
@@ -444,4 +443,12 @@ PYBIND11_MODULE(_pym3t_mod, m) {
444
443
.def_property (" tikhonov_parameter_translation" , &Optimizer::tikhonov_parameter_translation, &Optimizer::set_tikhonov_parameter_translation)
445
444
;
446
445
446
+ // Constants
447
+ m.attr (" WITH_REALSENSE" ) =
448
+ #ifdef PYM3T_WITH_REALSENSE
449
+ py::bool_ (true );
450
+ #else
451
+ py::bool_ (false );
452
+ #endif
453
+
447
454
}
0 commit comments