@@ -44,6 +44,26 @@ class PyRANGE(enum.Enum):
44
44
PyRANGE_MEDIUM = MAPPING_RANGE_MEDIUM
45
45
PyRANGE_FAR = MAPPING_RANGE_FAR
46
46
47
+ cdef class PyInputType:
48
+ def __cinit__ (self , input_type = 0 ):
49
+ if input_type == 0 :
50
+ self .input = InputType()
51
+ elif isinstance (input_type, PyInputType) :
52
+ input_t = < PyInputType> input_type
53
+ self .input = InputType(input_t.input)
54
+ else :
55
+ raise TypeError (" Argument is not of right type." )
56
+
57
+ def set_from_camera_id (self , id ):
58
+ self .input.setFromCameraID(id )
59
+
60
+ def set_from_serial_number (self , serial_number ):
61
+ self .input.setFromSerialNumber(serial_number)
62
+
63
+ def set_from_svo_file (self , str svo_input_filename ):
64
+ filename = svo_input_filename.encode()
65
+ self .input.setFromSVOFile(types.String(< char * > filename))
66
+
47
67
48
68
cdef class PyInitParameters:
49
69
cdef InitParameters* init
@@ -54,7 +74,8 @@ cdef class PyInitParameters:
54
74
coordinate_system = defines.PyCOORDINATE_SYSTEM.PyCOORDINATE_SYSTEM_IMAGE,
55
75
sdk_verbose = False , sdk_gpu_id = - 1 , depth_minimum_distance = - 1.0 , camera_disable_self_calib = False ,
56
76
camera_image_flip = False , enable_right_side_measure = False , camera_buffer_count_linux = 4 ,
57
- sdk_verbose_log_file = " " , depth_stabilization = True ):
77
+ sdk_verbose_log_file = " " , depth_stabilization = True , PyInputType input_t = PyInputType(),
78
+ optional_settings_path = " " ):
58
79
if (isinstance (camera_resolution, defines.PyRESOLUTION) and isinstance (camera_fps, int ) and
59
80
isinstance (camera_linux_id, int ) and isinstance (svo_input_filename, str ) and
60
81
isinstance (svo_real_time_mode, bool ) and isinstance (depth_mode, defines.PyDEPTH_MODE) and
@@ -63,16 +84,19 @@ cdef class PyInitParameters:
63
84
isinstance (sdk_gpu_id, int ) and isinstance (depth_minimum_distance, float ) and
64
85
isinstance (camera_disable_self_calib, bool ) and isinstance (camera_image_flip, bool ) and
65
86
isinstance (enable_right_side_measure, bool ) and isinstance (camera_buffer_count_linux, int ) and
66
- isinstance (sdk_verbose_log_file, str ) and isinstance (depth_stabilization, bool )):
87
+ isinstance (sdk_verbose_log_file, str ) and isinstance (depth_stabilization, bool ) and
88
+ isinstance (input_t, PyInputType) and isinstance (optional_settings_path, str )):
67
89
68
90
filename = svo_input_filename.encode()
69
91
filelog = sdk_verbose_log_file.encode()
92
+ fileoption = optional_settings_path.encode()
70
93
self .init = new InitParameters(camera_resolution.value, camera_fps, camera_linux_id,
71
94
types.String(< char * > filename), svo_real_time_mode, depth_mode.value,
72
95
coordinate_units.value, coordinate_system.value, sdk_verbose, sdk_gpu_id,
73
96
depth_minimum_distance, camera_disable_self_calib, camera_image_flip,
74
97
enable_right_side_measure, camera_buffer_count_linux,
75
- types.String(< char * > filelog), depth_stabilization)
98
+ types.String(< char * > filelog), depth_stabilization,
99
+ < CUcontext> 0 , input_t.input, types.String(< char * > fileoption))
76
100
else :
77
101
raise TypeError (" Argument is not of right type." )
78
102
@@ -243,6 +267,38 @@ cdef class PyInitParameters:
243
267
def depth_stabilization (self , bool value ):
244
268
self .init.depth_stabilization = value
245
269
270
+ @property
271
+ def input (self ):
272
+ input_t = PyInputType()
273
+ input_t.input = self .init.input
274
+ return input_t
275
+
276
+ @input .setter
277
+ def input (self , PyInputType input_t ):
278
+ self .init.input = input_t.input
279
+
280
+ @property
281
+ def optional_settings_path (self ):
282
+ if not self .init.svo_input_filename.empty():
283
+ return self .init.optional_settings_path.get().decode()
284
+ else :
285
+ return " "
286
+
287
+ @optional_settings_path.setter
288
+ def optional_settings_path (self , str value ):
289
+ value_filename = value.encode()
290
+ self .init.optional_settings_path.set(< char * > value_filename)
291
+
292
+ def set_from_camera_id (self , id ):
293
+ self .init.input.setFromCameraID(id )
294
+
295
+ def set_from_serial_number (self , serial_number ):
296
+ self .init.input.setFromSerialNumber(serial_number)
297
+
298
+ def set_from_svo_file (self , str svo_input_filename ):
299
+ filename = svo_input_filename.encode()
300
+ self .init.input.setFromSVOFile(types.String(< char * > filename))
301
+
246
302
247
303
cdef class PyRuntimeParameters:
248
304
cdef RuntimeParameters* runtime
@@ -334,6 +390,30 @@ cdef class PyTrackingParameters:
334
390
def enable_spatial_memory (self , bool value ):
335
391
self .tracking.enable_spatial_memory = value
336
392
393
+ @property
394
+ def enable_pose_smoothing (self ):
395
+ return self .tracking.enable_pose_smoothing
396
+
397
+ @enable_pose_smoothing.setter
398
+ def enable_pose_smoothing (self , bool value ):
399
+ self .tracking.enable_pose_smoothing = value
400
+
401
+ @property
402
+ def set_floor_as_origin (self ):
403
+ return self .tracking.set_floor_as_origin
404
+
405
+ @set_floor_as_origin.setter
406
+ def set_floor_as_origin (self , bool value ):
407
+ self .tracking.set_floor_as_origin = value
408
+
409
+ @property
410
+ def enable_imu_fusion (self ):
411
+ return self .tracking.enable_imu_fusion
412
+
413
+ @enable_imu_fusion.setter
414
+ def enable_imu_fusion (self , bool value ):
415
+ self .tracking.enable_imu_fusion = value
416
+
337
417
@property
338
418
def area_file_path (self ):
339
419
if not self .tracking.area_file_path.empty():
@@ -386,6 +466,14 @@ cdef class PySpatialMappingParameters:
386
466
else :
387
467
raise TypeError (" Argument is not of PyRESOLUTION type." )
388
468
469
+ def get_recommended_range (self , resolution , PyZEDCamera py_cam ):
470
+ if isinstance (resolution, PyRESOLUTION):
471
+ return self .spatial.getRecommendedRange(< MAPPING_RESOLUTION> resolution.value, py_cam.camera)
472
+ elif isinstance (resolution, float ):
473
+ return self .spatial.getRecommendedRange(< float > resolution, py_cam.camera)
474
+ else :
475
+ raise TypeError (" Argument is not of PyRESOLUTION or float type." )
476
+
389
477
@property
390
478
def max_memory_usage (self ):
391
479
return self .spatial.max_memory_usage
@@ -499,6 +587,12 @@ cdef class PyPose:
499
587
def pose_confidence (self ):
500
588
return self .pose.pose_confidence
501
589
590
+ @property
591
+ def pose_covariance (self ):
592
+ cdef np.ndarray arr = np.zeros(36 )
593
+ for i in range (36 ) :
594
+ arr[i] = self .pose.pose_covariance[i]
595
+ return arr
502
596
503
597
cdef class PyIMUData:
504
598
cdef IMUData imuData
@@ -743,6 +837,13 @@ cdef class PyZEDCamera:
743
837
def retrieve_mesh_async (self , mesh.PyMesh py_mesh ):
744
838
return types.PyERROR_CODE(self .camera.retrieveMeshAsync(deref(py_mesh.mesh)))
745
839
840
+ def find_plane_at_hit (self , coord , mesh.PyPlane py_plane ):
841
+ cdef types.Vector2[uint] vec = types.Vector2[uint](coord[0 ], coord[1 ])
842
+ return types.PyERROR_CODE(self .camera.findPlaneAtHit(vec, py_plane.plane))
843
+
844
+ def find_floor_plane (self , mesh.PyPlane py_plane , core.PyTransform resetTrackingFloorFrame , floor_height_prior = float (' nan' ), core.PyRotation world_orientation_prior = core.PyRotation(types.PyMatrix3f().zeros()), floor_height_prior_tolerance = float (' nan' )) :
845
+ return types.PyERROR_CODE(self .camera.findFloorPlane(py_plane.plane, resetTrackingFloorFrame.transform, floor_height_prior, world_orientation_prior.rotation, floor_height_prior_tolerance))
846
+
746
847
def disable_spatial_mapping (self ):
747
848
self .camera.disableSpatialMapping()
748
849
0 commit comments