42 #include <visp3/core/vpConfig.h>
44 #if defined(VISP_HAVE_OCCIPITAL_STRUCTURE) && (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
46 #include <visp3/gui/vpPlot.h>
47 #include <visp3/sensor/vpOccipitalStructure.h>
51 #ifdef ENABLE_VISP_NAMESPACE
55 double initial_ts, ts;
59 ST::CaptureSessionSettings settings;
60 settings.source = ST::CaptureSessionSourceId::StructureCore;
61 settings.structureCore.depthEnabled =
true;
62 settings.structureCore.visibleEnabled =
true;
63 settings.structureCore.accelerometerEnabled =
true;
64 settings.structureCore.gyroscopeEnabled =
true;
65 settings.structureCore.imuUpdateRate = ST::StructureCoreIMUUpdateRate::AccelAndGyro_1000Hz;
70 vpPlot acceleration_plotter(1, 400, 800, 10, 10,
"Accelerations");
71 vpPlot rotationRate_plotter(1, 400, 800, 10, 450,
"Rotation rates");
72 acceleration_plotter.initGraph(0, 3);
73 rotationRate_plotter.initGraph(0, 3);
82 acceleration_plotter.plot(0, 0, 0, 0);
83 acceleration_plotter.plot(0, 1, 0, 0);
84 acceleration_plotter.plot(0, 2, 0, 0);
85 rotationRate_plotter.plot(0, 0, 0, 0);
86 rotationRate_plotter.plot(0, 1, 0, 0);
87 rotationRate_plotter.plot(0, 2, 0, 0);
89 acceleration_plotter.setLegend(0, 0,
"X axis");
90 acceleration_plotter.setLegend(0, 1,
"Y axis");
91 acceleration_plotter.setLegend(0, 2,
"Z axis");
92 rotationRate_plotter.setLegend(0, 0,
"X axis");
93 rotationRate_plotter.setLegend(0, 1,
"Y axis");
94 rotationRate_plotter.setLegend(0, 2,
"Z axis");
96 sc.
getIMUData(&imu_vel, &imu_acc, &initial_ts);
102 acceleration_plotter.plot(0, ts - initial_ts, imu_acc);
103 rotationRate_plotter.plot(0, ts - initial_ts, imu_vel);
110 std::cerr <<
"Structure SDK error " << e.
what() << std::endl;
112 catch (
const std::exception &e) {
113 std::cerr << e.what() << std::endl;
121 #if !defined( VISP_HAVE_OCCIPITAL_STRUCTURE )
122 std::cout <<
"You do not have Occipital Structure SDK functionality enabled..." << std::endl;
123 std::cout <<
"Tip:" << std::endl;
124 std::cout <<
"- Install libStructure, configure again ViSP using cmake and build again this example" << std::endl;
126 #elif ( VISP_CXX_STANDARD < VISP_CXX_STANDARD_11 )
127 std::cout <<
"You do not build ViSP with c++11 or higher compiler flag" << std::endl;
128 std::cout <<
"Tip:" << std::endl;
129 std::cout <<
"- Configure ViSP again using cmake -DUSE_CXX_STANDARD=11, and build again this example" << std::endl;
Implementation of column vector and the associated operations.
static const vpColor blue
static const vpColor green
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
error that can be emitted by ViSP classes.
const char * what() const
void getIMUData(vpColVector *imu_vel, vpColVector *imu_acc, double *ts=nullptr)
bool open(const ST::CaptureSessionSettings &settings)
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...