4 #include <visp3/core/vpCameraParameters.h> 5 #include <visp3/core/vpXmlParserCamera.h> 6 #include <visp3/gui/vpDisplayGDI.h> 7 #include <visp3/gui/vpDisplayX.h> 8 #include <visp3/io/vpImageIo.h> 9 #include <visp3/sensor/vpRealSense2.h> 10 #include <visp3/robot/vpRobotFranka.h> 12 #if defined(VISP_HAVE_REALSENSE2) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) && defined(VISP_HAVE_FRANKA) 14 int main(
int argc,
char **argv)
17 std::string robot_ip =
"192.168.1.1";
19 for (
int i = 1; i < argc; i++) {
20 if (std::string(argv[i]) ==
"--ip" && i + 1 < argc) {
21 robot_ip = std::string(argv[i + 1]);
23 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
24 std::cout << argv[0] <<
" [--ip 192.168.1.1] [--help] [-h]" 37 config.disable_stream(RS2_STREAM_DEPTH);
38 config.disable_stream(RS2_STREAM_INFRARED);
39 config.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGBA8, 30);
46 std::cout <<
"Image size: " << width <<
" x " << height << std::endl;
51 xml_camera.
save(cam,
"camera.xml",
"Camera", width, height);
53 #if defined(VISP_HAVE_X11) 55 #elif defined(VISP_HAVE_GDI) 76 std::stringstream ss_img, ss_pos;
78 ss_img <<
"image-" << cpt <<
".png";
79 ss_pos <<
"pose_fPe_" << cpt <<
".yaml";
80 std::cout <<
"Save: " << ss_img.str() <<
" and " << ss_pos.str() << std::endl;
92 std::cerr <<
"RealSense error " << e.
what() << std::endl;
93 }
catch (
const std::exception &e) {
94 std::cerr << e.what() << std::endl;
102 #if !defined(VISP_HAVE_REALSENSE2) 103 std::cout <<
"Install librealsense-2.x." << std::endl;
105 #if !(VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 106 std::cout <<
"Build ViSP with c++11 or higher compiler flag (cmake -DUSE_CXX_STANDARD=11)." << std::endl;
108 #if !defined(VISP_HAVE_FRANKA) 109 std::cout <<
"Install libfranka." << std::endl;
112 std::cout <<
"After installation of the missing 3rd parties, configure ViSP with cmake" 113 <<
" and build ViSP again." << std::endl;
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Display for windows using GDI (available on any windows 32 platform).
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
error that can be emited by ViSP classes.
void open(const rs2::config &cfg=rs2::config())
XML parser to load and save intrinsic camera parameters.
static void flush(const vpImage< unsigned char > &I)
static void write(const vpImage< unsigned char > &I, const std::string &filename)
static void display(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
void acquire(vpImage< unsigned char > &grey)
const char * what() const
unsigned int getHeight() const
vpCameraParameters getCameraParameters(const rs2_stream &stream, vpCameraParameters::vpCameraParametersProjType type=vpCameraParameters::perspectiveProjWithDistortion) const
Implementation of a pose vector and operations on poses.
int save(const vpCameraParameters &cam, const std::string &filename, const std::string &camera_name, unsigned int image_width=0, unsigned int image_height=0, const std::string &additionalInfo="")
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)
void connect(const std::string &franka_address, franka::RealtimeConfig realtime_config=franka::RealtimeConfig::kEnforce)
unsigned int getWidth() const