18 using namespace TCLAP;
22 std::vector<std::string> tokens;
23 stringstream ss(input);
26 while (std::getline(ss, token, separator)) {
27 tokens.push_back(token);
36 ss <<
" Rotation Matrix:\n";
39 for (
auto i = 0;
i < 3; ++
i)
41 for (
auto j = 0;
j < 3; ++
j)
43 std::ostringstream oss;
46 ss <<
right << setw(4) << tokens[0];
47 if (tokens.size() > 1)
48 ss <<
"." <<
left << setw(12) << tokens[1];
53 ss <<
"\n Translation Vector: ";
55 ss << setprecision(15) << extrinsics.
translation[
i] <<
" ";
57 cout << ss.str() << endl << endl;
63 ss <<
"Bias Variances: \t";
66 ss << setprecision(15) << std::fixed << intrinsics.
bias_variances[
i] <<
" ";
68 ss <<
"\nNoise Variances: \t";
70 ss << setprecision(15) << std::fixed << intrinsics.
noise_variances[
i] <<
" ";
72 ss <<
"\nSensitivity : " << std::endl;
73 for (
auto i = 0u;
i <
sizeof(intrinsics.
data) /
sizeof(intrinsics.
data[0]); ++
i)
75 for (
auto j = 0u;
j <
sizeof(intrinsics.
data[0]) /
sizeof(intrinsics.
data[0][0]); ++
j)
76 ss <<
std::right << std::setw(13) << setprecision(6) << intrinsics.
data[
i][
j] <<
" ";
80 cout << ss.str() << endl << endl;
86 ss <<
left << setw(14) <<
" Width: " <<
"\t" << intrinsics.
width << endl <<
87 left << setw(14) <<
" Height: " <<
"\t" << intrinsics.
height << endl <<
88 left << setw(14) <<
" PPX: " <<
"\t" << setprecision(15) << intrinsics.
ppx << endl <<
89 left << setw(14) <<
" PPY: " <<
"\t" << setprecision(15) << intrinsics.
ppy << endl <<
90 left << setw(14) <<
" Fx: " <<
"\t" << setprecision(15) << intrinsics.
fx << endl <<
91 left << setw(14) <<
" Fy: " <<
"\t" << setprecision(15) << intrinsics.
fy << endl <<
93 left << setw(14) <<
" Coeffs: ";
95 for (
auto i = 0u;
i <
sizeof(intrinsics.
coeffs) /
sizeof(intrinsics.
coeffs[0]); ++
i)
96 ss <<
"\t" << setprecision(15) << intrinsics.
coeffs[
i] <<
" ";
100 ss << endl <<
left << setw(14) <<
" FOV (deg): " <<
"\t" << setprecision(4) << fov[0] <<
" x " << fov[1];
102 cout << ss.str() << endl << endl;
153 return (std::make_tuple(stream, stream_index) < std::make_tuple(obj.
stream, obj.
stream_index));
186 int main(
int argc,
char** argv)
try 190 SwitchArg short_view_arg(
"s",
"short",
"Provide a one-line summary of the devices");
191 SwitchArg compact_view_arg(
"S",
"compact",
"Provide a short summary of the devices");
192 SwitchArg show_options_arg(
"o",
"option",
"Show all the supported options per subdevice");
193 SwitchArg show_calibration_data_arg(
"c",
"calib_data",
"Show extrinsic and intrinsic of all subdevices");
194 SwitchArg show_defaults(
"d",
"defaults",
"Show the default streams configuration");
195 ValueArg<string> show_playback_device_arg(
"p",
"playback_device",
"Inspect and enumerate playback device (from file)",
196 false,
"",
"Playback device - ROSBag record full path");
197 cmd.
add(short_view_arg);
198 cmd.
add(compact_view_arg);
199 cmd.
add(show_options_arg);
200 cmd.
add(show_calibration_data_arg);
201 cmd.
add(show_defaults);
202 cmd.
add(show_playback_device_arg);
204 cmd.
parse(argc, argv);
206 #ifdef BUILD_EASYLOGGINGPP 210 bool short_view = short_view_arg.
getValue();
211 bool compact_view = compact_view_arg.
getValue();
212 bool show_options = show_options_arg.
getValue();
213 bool show_calibration_data = show_calibration_data_arg.
getValue();
214 bool show_modes = !(compact_view || short_view);
215 auto playback_dev_file = show_playback_device_arg.
getValue();
217 if ((short_view || compact_view) && (show_options || show_calibration_data))
220 s <<
"rs-enumerate-devices ";
221 for (
int i = 1;
i < argc; ++
i)
223 std::cout <<
"Warning: The command line \"" << s.str().c_str()
224 <<
"\" has conflicting requests.\n The flags \"-s\" / \"-S\" are compatible with \"-p\" only," 225 <<
" other options will be ignored.\nRefer to the tool's documentation for details\n" << std::endl;
231 if (!playback_dev_file.empty())
235 size_t device_count = devices_list.
size();
238 cout <<
"No device detected. Is it plugged in?\n";
243 std::vector<rs2::device>
devices;
245 for (
auto i = 0u;
i < device_count;
i++)
249 auto dev = devices_list[
i];
250 devices.emplace_back(
dev);
252 catch (
const std::exception &
e)
254 std::cout <<
"Could not create device - " << e.what() <<
" . Check SDK logs for details" << std::endl;
258 std::cout <<
"Failed to created device. Check SDK logs for details" << std::endl;
262 if (short_view || compact_view)
264 cout <<
left << setw(30) <<
"Device Name" 265 << setw(20) <<
"Serial Number" 266 << setw(20) <<
"Firmware Version" 269 for (
auto i = 0u;
i < devices.size(); ++
i)
271 auto dev = devices[
i];
279 show_options = show_calibration_data = show_modes =
false;
282 for (
auto i = 0u;
i < devices.size(); ++
i)
285 auto dev = devices[
i];
290 cout <<
"Device info: \n";
292 cout <<
"Playback Device (" << pb_dev.file_name() <<
")" << std::endl;
299 <<
": \t" <<
dev.get_info(
param) << endl;
309 cout <<
"Default streams:" << endl;
314 for (
auto&& sp :
profile.get_streams())
316 cout <<
" " << sp.stream_name() <<
" as " << sp.format() <<
" at " << sp.fps() <<
" Hz";
319 cout <<
"; Resolution: " << vp.width() <<
"x" << vp.height();
326 cout <<
"Cannot list default streams since the device does not provide a serial number!" << endl;
333 for (
auto&&
sensor :
dev.query_sensors())
337 cout << setw(35) <<
" Supported options:" << setw(10) <<
"min" << setw(10)
338 <<
" max" << setw(6) <<
" step" << setw(10) <<
" default" << endl;
347 cout <<
" " <<
left << setw(30) << opt <<
" : " 348 << setw(5) <<
range.min <<
"... " << setw(12) <<
range.max
349 << setw(6) <<
range.step << setw(10) <<
range.def <<
"\n";
363 for (
auto&&
sensor :
dev.query_sensors())
367 cout <<
" Supported modes:\n" << setw(16) <<
" stream" << setw(16)
368 <<
" resolution" << setw(10) <<
" fps" << setw(10) <<
" format" << endl;
389 if (show_calibration_data)
391 std::map<stream_and_index, stream_profile>
streams;
392 std::map<stream_and_resolution, std::vector<std::pair<std::set<rs2_format>,
rs2_intrinsics>>> intrinsics_map;
394 for (
auto&&
sensor :
dev.query_sensors())
401 if (streams.find(
stream_and_index{ profile.stream_type(), profile.stream_index() }) == streams.end())
410 auto it = std::find_if((intrinsics_map[stream_res]).
begin(), (intrinsics_map[stream_res]).
end(), [&](
const std::pair<std::set<rs2_format>,
rs2_intrinsics>&
kvp) {
413 if (
it == (intrinsics_map[stream_res]).
end())
427 if (streams.find(
stream_and_index{ profile.stream_type(), profile.stream_index() }) == streams.end())
436 auto it = std::find_if((motion_intrinsics_map[stream_res]).
begin(), (motion_intrinsics_map[stream_res]).
end(),
441 if (
it == (motion_intrinsics_map[stream_res]).
end())
455 if (streams.find(
stream_and_index{ profile.stream_type(), profile.stream_index() }) == streams.end())
469 if (intrinsics_map.size())
471 cout <<
"Intrinsic Parameters:\n" << endl;
472 for (
auto&
kvp : intrinsics_map)
474 auto stream_res =
kvp.first;
478 cout <<
" Intrinsic of \"" << stream_res.stream_name <<
"\" / " << stream_res.width <<
"x" 479 << stream_res.height <<
" / " << formats << endl;
482 cout <<
"Intrinsic NOT available!\n\n";
492 if (motion_intrinsics_map.size())
494 cout <<
"Motion Intrinsic Parameters:\n" << endl;
495 for (
auto&
kvp : motion_intrinsics_map)
497 auto stream_res =
kvp.first;
501 cout <<
"Motion Intrinsic of \"" << stream_res.stream_name <<
"\"\t " << formats << endl;
504 cout <<
"Intrinsic NOT available!\n\n";
517 cout <<
"\nExtrinsic Parameters:" << endl;
519 for (
auto kvp1 = streams.begin(); kvp1 != streams.end(); ++kvp1)
521 for (
auto kvp2 = streams.begin(); kvp2 != streams.end(); ++kvp2)
523 cout <<
"Extrinsic from \"" << kvp1->second.stream_name() <<
"\"\t " <<
524 "To" <<
"\t \"" << kvp2->second.stream_name() <<
"\" :\n";
527 extrinsics = kvp1->second.get_extrinsics_to(kvp2->second);
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
::realsense_legacy_msgs::extrinsics_< std::allocator< void > > extrinsics
std::vector< std::string > tokenize_floats(string input, char separator)
string get_str_formats(const set< rs2_format > &formats)
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
rs2_motion_device_intrinsic get_motion_intrinsics() const
static void rs2_fov(const struct rs2_intrinsics *intrin, float to_fov[2])
playback load_device(const std::string &file)
const char * rs2_distortion_to_string(rs2_distortion distortion)
device_list query_devices() const
bool safe_get_intrinsics(const video_stream_profile &profile, rs2_intrinsics &intrinsics)
void enable_device(const std::string &serial)
::realsense_legacy_msgs::pose_< std::allocator< void > > pose
const std::string & get_failed_args() const
static const char * log_to_console
bool operator<(failed, failed)
GLint GLint GLsizei GLint GLenum format
void print(const rs2_extrinsics &extrinsics)
bool operator==(const std::shared_ptr< librealsense::video_stream_profile > &a, const std::shared_ptr< librealsense::video_stream_profile > &b)
bool supports(rs2_camera_info info) const
rs2_intrinsics get_intrinsics() const
rs2_stream
Streams are different types of data provided by RealSense devices.
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
void next(auto_any_t cur, type2type< T, C > *)
int main(int argc, char **argv)
const char * rs2_camera_info_to_string(rs2_camera_info info)
void parse(int argc, const char *const *argv)
pipeline_profile resolve(std::shared_ptr< rs2_pipeline > p) const
GLenum GLenum GLenum input
#define RS2_API_VERSION_STR
::realsense_legacy_msgs::motion_intrinsics_< std::allocator< void > > motion_intrinsics
Motion device intrinsics: scale, bias, and variances.
option_range get_option_range(rs2_option option) const
const char * get_info(rs2_camera_info info) const
std::vector< stream_profile > get_stream_profiles() const
bool safe_get_motion_intrinsics(const motion_stream_profile &profile, rs2_motion_device_intrinsic &intrinsics)
const std::string & get_failed_function() const