@@ -87,6 +87,28 @@ std::string array_to_string(const T(&arr)[N])
8787    return  oss.str ();
8888}
8989
90+ template  <typename  T, size_t  N, size_t  M>
91+ std::string matrix_to_string (const  T (&arr)[N][M])
92+ {
93+     std::ostringstream oss;
94+     oss << " [" 
95+     for  (int  i = 0 ; i < N; i++)
96+     {
97+         if  (i != 0 )
98+             oss << " , " 
99+         oss << " [" 
100+         for  (int  j = 0 ; j < M; j++)
101+         {
102+             if  (j != 0 )
103+                 oss << " , " 
104+             oss << arr[i][j];
105+         }
106+         oss << " ]" 
107+     }
108+     oss << " ]" 
109+     return  oss.str ();
110+ }
111+ 
90112#define  BIND_RAW_ARRAY_GETTER (T, member, valueT, SIZE ) [](const  T& self) -> const  std::array<valueT, SIZE>& { return  reinterpret_cast <const  std::array<valueT, SIZE>&>(self.member ); }
91113#define  BIND_RAW_ARRAY_SETTER (T, member, valueT, SIZE ) [](T& self, const  std::array<valueT, SIZE>& src) { copy_raw_array (self.member , src); }
92114
@@ -189,11 +211,18 @@ PYBIND11_MODULE(NAME, m) {
189211            return  ss.str ();
190212        });
191213
192-     py::class_<rs2_motion_device_intrinsic> motion_device_inrinsic (m, " motion_device_intrinsic" " Motion device intrinsics: scale, bias, and variances." 
193-     motion_device_inrinsic .def (py::init<>())
194-         .def_property (BIND_RAW_2D_ARRAY_PROPERTY (rs2_motion_device_intrinsic, data, float , 3 , 4 ), " Interpret data array values " 
214+     py::class_<rs2_motion_device_intrinsic> motion_device_intrinsic (m, " motion_device_intrinsic" " Motion device intrinsics: scale, bias, and variances." 
215+     motion_device_intrinsic .def (py::init<>())
216+         .def_property (BIND_RAW_2D_ARRAY_PROPERTY (rs2_motion_device_intrinsic, data, float , 3 , 4 ), " 3x4 matrix with 3x3 scale and cross axis and 3x1 biases " 
195217        .def_property (BIND_RAW_ARRAY_PROPERTY (rs2_motion_device_intrinsic, noise_variances, float , 3 ), " Variance of noise for X, Y, and Z axis" 
196-         .def_property (BIND_RAW_ARRAY_PROPERTY (rs2_motion_device_intrinsic, bias_variances, float , 3 ), " Variance of bias for X, Y, and Z axis" 
218+         .def_property (BIND_RAW_ARRAY_PROPERTY (rs2_motion_device_intrinsic, bias_variances, float , 3 ), " Variance of bias for X, Y, and Z axis" 
219+         .def (" __repr__" const  rs2_motion_device_intrinsic& self) {
220+             std::stringstream ss;
221+             ss << " data: " matrix_to_string (self.data ) << " , " 
222+             ss << " noise_variances: " array_to_string (self.noise_variances ) << " , " 
223+             ss << " bias_variances: " array_to_string (self.bias_variances );
224+             return  ss.str ();
225+         });
197226
198227    /*  rs2_types.hpp */ 
199228    py::class_<rs2::option_range> option_range (m, " option_range" //  No docstring in C++
0 commit comments