This example displays information about a plugged RealSense sensor using librealsense2.
#include <iostream>
#include <visp3/core/vpConfig.h>
#include <visp3/sensor/vpRealSense2.h>
#if defined(VISP_HAVE_REALSENSE2) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
int main()
{
#ifdef ENABLE_VISP_NAMESPACE
#endif
try {
std::cout << "RealSense characteristics:\n" << rs << std::endl;
std::cout << "Product line: " << product << std::endl;
std::cout <<
"Depth scale: " << std::setprecision(std::numeric_limits<float>::max_digits10) << rs.
getDepthScale()
<< std::endl;
}
std::cerr <<
"RealSense error " << e.
what() << std::endl;
}
catch (const std::exception &e) {
std::cerr << e.
what() << std::endl;
}
return EXIT_SUCCESS;
}
#else
int main()
{
#if !defined(VISP_HAVE_REALSENSE2)
std::cout << "You do not have realsense2 SDK functionality enabled..." << std::endl;
std::cout << "Tip:" << std::endl;
std::cout << "- Install librealsense2, configure again ViSP using cmake and build again this example" << std::endl;
return EXIT_SUCCESS;
#endif
return EXIT_SUCCESS;
}
#endif
error that can be emitted by ViSP classes.
const char * what() const
bool open(const rs2::config &cfg=rs2::config())
std::string getProductLine()