#include <iostream>
#include <visp3/core/vpCameraParameters.h>
#include <visp3/core/vpXmlParserCamera.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/sensor/vpRealSense2.h>
#include <visp3/robot/vpRobotFranka.h>
#if defined(VISP_HAVE_REALSENSE2) && defined(VISP_HAVE_CPP11_COMPATIBILITY) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) && defined(VISP_HAVE_FRANKA)
int main(int argc, char **argv)
{
try {
std::string robot_ip = "192.168.1.1";
for (int i = 1; i < argc; i++) {
if (std::string(argv[i]) == "--ip" && i + 1 < argc) {
robot_ip = std::string(argv[i + 1]);
}
else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
std::cout << argv[0] << " [--ip 192.168.1.1] [--help] [-h]"
<< "\n";
return EXIT_SUCCESS;
}
}
rs2::config config;
config.disable_stream(RS2_STREAM_DEPTH);
config.disable_stream(RS2_STREAM_INFRARED);
config.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGBA8, 30);
std::cout << "Image size: " << width << " x " << height << std::endl;
xml_camera.
save(cam,
"camera.xml",
"Camera", width, height);
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GDI)
#endif
bool end = false;
unsigned cpt = 0;
while (! end) {
cpt ++;
std::stringstream ss_img, ss_pos;
ss_img << "image-" << cpt << ".png";
ss_pos << "pose_fPe_" << cpt << ".yaml";
std::cout << "Save: " << ss_img.str() << " and " << ss_pos.str() << std::endl;
}
end = true;
}
}
}
std::cerr <<
"RealSense error " << e.
what() << std::endl;
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}
return 0;
}
#else
int main()
{
#if !defined(VISP_HAVE_REALSENSE2)
std::cout << "Install librealsense-2.x." << std::endl;
#endif
#if !defined(VISP_HAVE_CPP11_COMPATIBILITY)
std::cout << "Build ViSP with C++11 compiler flag (cmake -DUSE_CPP11=ON)." << std::endl;
#endif
#if !defined(VISP_HAVE_FRANKA)
std::cout << "Install libfranka." << std::endl;
#endif
std::cout << "After installation of the missing 3rd parties, configure ViSP with cmake"
<< " and build ViSP again." << std::endl;
return 0;
}
#endif